ChartDirector 7.1 (C++ Edition)

Layer.setLegendOrder


Usage

void setLegendOrder(int dataSetOrder, int layerOrder = -1);

Description

Sets the order of the data set names as appeared in the legend box.

By default, ChartDirector will add named data sets to the the legend box. The ordering of the entries follows the order in which the layers are created. For data sets within the same layer, the ordering follows the order in which the data sets are added.

To support flexible ordering of the legend entries, ChartDirector employs a legend entry priority system. Please refer to LegendBox for details of the legend entry priority system.

The base priority of the layer can be specified using the layerOrder argument. The priority of the data sets within a layer can be modified by using the dataSetOrder argument, which must be one of the following predefined constant.

ConstantValueDescription
NormalLegend0The data set priority is 10 x (data_set_index + 1). Legend entries are ordered in the order with which the data sets are created.
ReverseLegend1The data sets priority is the reverse of the normal data set priority. Legend entries are ordered in the reverse order with which the data sets are created.
NoLegend2The data set names are not added to the legend box at all.

Arguments

ArgumentDefaultDescription
dataSetOrder(Mandatory)One of the predefined constants representing the legend entry ordering method for data sets within the layer.
layerOrder-1The base legend entry priority of the layer. -1 means the priority is 10000 x (layer_index + 1).

Return Value

None