Chart legend width

View: New views
3 Messages — Rating Filter:   Alert me  

Chart legend width

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I've noticed that my chart legends are built using a table with one row. That, of course, fails to wrap when the end of the container has been reached. The net result I get is just one visible item in the legend. I find this behavior weird. Is it the norm?

Regards

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: Chart legend width

by Eugene Lazutkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It looks like you are talking about horizontal legends, which use one
<tr> with multiple <td> inside. Vertical legends use one <tr> per series.

By default a horizontal legend is generated. If you specify "horizontal:
false" when creating a legend, it will be vertical.

This is how you can do that from the markup:

<div dojoType="dojox.charting.widget.Legend"
  chartRef="chart1" horizontal="false">
</div>

This is how you can do that from JavaScript:

var legend = new dojox.charting.widget.Legend({
  chartRef: "chart1WidgetId",
  // or
  //chart: chart1,
  horizontal: false
}, node);

If you want to update the legend because something has changed (e.g.,
you added/removed series or modified some parameters) just call
refresh() on your legend widget:

legend.horizontal = true;
legend.refresh();
...
legend.horizontal = false;
legend.refresh();

You can find multiple examples of legends in test_event2d.html (source
code:
http://bugs.dojotoolkit.org/browser/dojox/trunk/charting/tests/test_event2d.html,
live:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/charting/tests/test_event2d.html).

Thanks,

Eugene Lazutkin
Dojo Toolkit, Committer
http://lazutkin.com/

On 08/13/2009 04:18 AM, Jose Noheda wrote:

> Hi,
>
> I've noticed that my chart legends are built using a table with one row.
> That, of course, fails to wrap when the end of the container has been
> reached. The net result I get is just one visible item in the legend. I
> find this behavior weird. Is it the norm?
>
> Regards
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Re: Chart legend width

by Eugene Lazutkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Should be easy to do. The legend widget was contributed to us ---
patches are truly welcomed!

Thanks,

Eugene Lazutkin
Dojo Toolkit, Committer
http://lazutkin.com/

On 08/14/2009 04:26 AM, Jose Noheda wrote:

> Thanks Eugene. I'll try vertical legends but what about multicolumn
> legends? It's easy to do (discarding tables) and seems logical to me.
>
> Regards
>
> On Fri, Aug 14, 2009 at 6:22 AM, Eugene Lazutkin
> <eugene.lazutkin@... <mailto:eugene.lazutkin@...>> wrote:
>
>     It looks like you are talking about horizontal legends, which use one
>     <tr> with multiple <td> inside. Vertical legends use one <tr> per
>     series.
>
>     By default a horizontal legend is generated. If you specify "horizontal:
>     false" when creating a legend, it will be vertical.
>
>     This is how you can do that from the markup:
>
>     <div dojoType="dojox.charting.widget.Legend"
>      chartRef="chart1" horizontal="false">
>     </div>
>
>     This is how you can do that from JavaScript:
>
>     var legend = new dojox.charting.widget.Legend({
>      chartRef: "chart1WidgetId",
>      // or
>      //chart: chart1,
>      horizontal: false
>     }, node);
>
>     If you want to update the legend because something has changed (e.g.,
>     you added/removed series or modified some parameters) just call
>     refresh() on your legend widget:
>
>     legend.horizontal = true;
>     legend.refresh();
>     ...
>     legend.horizontal = false;
>     legend.refresh();
>
>     You can find multiple examples of legends in test_event2d.html (source
>     code:
>     http://bugs.dojotoolkit.org/browser/dojox/trunk/charting/tests/test_event2d.html,
>     live:
>     http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/charting/tests/test_event2d.html).
>
>     Thanks,
>
>     Eugene Lazutkin
>     Dojo Toolkit, Committer
>     http://lazutkin.com/
>
>     On 08/13/2009 04:18 AM, Jose Noheda wrote:
>     > Hi,
>     >
>     > I've noticed that my chart legends are built using a table with
>     one row.
>     > That, of course, fails to wrap when the end of the container has been
>     > reached. The net result I get is just one visible item in the
>     legend. I
>     > find this behavior weird. Is it the norm?
>     >
>     > Regards
>     >
>     >
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > FAQ: http://dojotoolkit.org/support/faq
>     > Book: http://dojotoolkit.org/docs/book
>     > Forums: http://dojotoolkit.org/forum
>     > Dojo-interest@...
>     <mailto:Dojo-interest@...>
>     > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>     _______________________________________________
>     FAQ: http://dojotoolkit.org/support/faq
>     Book: http://docs.dojocampus.org
>     Dojo-interest@...
>     <mailto:Dojo-interest@...>
>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> Dojo-interest@...
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest