ChartDirector Ver 3.1 (PHP Edition Edition)

Layer.setLegend


Usage

setLegend(m)

Description

Set the order of the data set names when entered into the legend box.

By default, if a data set has a name (see Layer.addDataSet), an entry will be added to the legend box. If there are multiple named data sets in a layer, multiple entries will be added to the legend box, in the same order as the data sets being added to the layer.

In some cases, it may be desirable not to add the data set names to the legend box, or to add them to the legend box in reverse order.

For example, in a vertical stacked chart with positive data, the first data set will be at the bottom, and the last data set will be stacked to the top. If a vertically laid out legend box is used, the first data set will be the first entry in the legend box, and so will be at the top of the legend box. Similarly, the last data set will be at the bottom of the legend box. This is in reverse to what is shown in the stacked chart. So it may be desirable to reverse the order that the data names are added to the legend box.

ChartDirector supports the following legend entry ordering methods represented by pre-defined constants.

ConstantValueDescription
NormalLegend0Data set names are added to the legend box in normal order.
ReverseLegend1Data set names are added to the legend box in reverse order.
NoLegend2Data set names are not added to the legend box at all.

Arguments

ArgumentDefaultDescription
m(Mandatory)One of the pre-defined constants representing the legend entry ordering method to use.

Return Value

None