Data Indicator
A data indicator is a graphical indicator of a data value. The data value to represent can be of different types:
-
a value along the x-axis,
-
a value along the y-axis,
-
a data interval along the x-axis,
-
a data interval along the y-axis,
-
a data window.
The graphical representation of a data indicator is composed of:
-
A delimiter that indicates the data area (a simple line for an x- or y-value or a more complex shape that represents a data interval or a data window that depends on the projection).
-
An optional label.
Data indicators are instances of the IlvDataIndicator class and are handled directly by a chart. The IlvDataIndicator class is a subclass of IlvChartDecoration.
If you want to add a data indicator to a chart, use the method addDecoration.
If you want to remove a data indicator from a chart, use the method removeDecoration.
The complete source code of this example can be found in <installdir>/jviews-charts/codefragments/chart/data-indicator/src/DataIndicator.java.
// A data indictor that highlights the range [5,13] along the x-axis.
IlvDataIndicator indic = new IlvDataIndicator(-1, new
IlvDataInterval(5,13), null);
// set the rendering style
indic.setStyle(INDICATOR_STYLE);
chart.addDecoration(indic);
// A data indicator that indicates the value 23 as a threshold line
// along the y-axis. It displays the 'Threshold' value.
indic = new IlvDataIndicator(0, 23, "Threshold");
indic.setStyle(INDICATOR_STYLE);
// change its draw order so that it is drawn ABOVE renderers
indic.setDrawOrder(IlvChart.DRAW_ABOVE);
// customizer its label renderer
indic.getLabelRenderer().setOpaque(true);
indic.getLabelRenderer().setBorder(BorderFactory.createLineBorder(CHART_FOREGRO
UND_COLOR));
indic.getLabelRenderer().setBackground(INDIC_FILL_COLOR);
chart.addDecoration(indic);