| | | | Browse by category |
Question
How to use the dataLabels value in the IlvSwingTableDataSource as the labels of the X axis?
Answer
The IlvSwingTableDataSource
makes its 'dataLabels'
column available through the getDataLabel(index)
method of the
datasets that it creates and provides.
The result of the getDataLabel()
is being used in the following scenarios:
- As X axis label in
'category'
mode - As legend text for PIE charts
- For data labels inside the plot area, if the renderer's labeling mode isset to DATA_LABEL
- In CSS rules for
'point'
, when you access the'label'
property
There are three options to get the dataLabel
values to display on the X axis:
- Use a Chart in
"category"
mode - Override the
IlvScale.computeLabel
method to perform a dataset lookup - Provide a custom
IlvValueFormat
as the X scale's label format to perform a dataset lookup
The attached sample illustrates the implementation of option 3 (using a custom IlvValueFormat
) to display the dataLabels
of the
IlvSwingTableDataSource
on the X axis.
Note: the predefined IlvCategoryStepsDefinition
expects the
value to be numbers. If you have dates in the X values, it is recommended that
you select either option 2 or 3 to display the dataLabels
values
on the X axis.