ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Legend Order
Posted by Adrian Groves on May-09-2014 17:38
Hi there,

I have a chart containing a legend with 5 rows of 3 items. The items are being added across
the legend (e.g. a,b,c,d,e on the first line then f,g,h,i,j on the second line).

Can the legend order be changed so that a,b,c are below each other then d,e,f are the
next 3 rows (next column) and so on ?

regards,

Ade

  Re: Legend Order
Posted by Peter Kwan on May-10-2014 04:14
Hi Adrian,

For the legend box, ChartDirector can only layout the legend box either vertically in one
column, or horizontally from left to right, top to bottom.

For your case, one method is to disable the automatic legend entries. Then you may use
LegendBox.addKey to manually add the legend entry. For example, you may configure the
legend box to use a grid layout of 5 cells wide, and add the legend entries in the order:

a f k b g l c h m d i n e j o

This will then produce the legend layout you need.

The method to disable the automatic legend entry depends on your chart type. For XY
charts, the Layer.setLegendMode can be used to disable automatic legend entry. For pie
charts, if you do not provide the sector labels (in PieChart.setData, just leave the labels
array empty), there will be no automatic legend entry. If you must include labels in the pie
(eg. for displaying them as sector labels or in tooltips), you may add them as extra field
instead (BaseChart.addExtraField), and use {field0} (instead of {label}) to represent them
in label format or tooltips.

Regards
Peter Kwan