Specify different marker types for each data point and have these markers appear in the legend

Article ID: 2280
Last updated: 29 May, 2018
Article ID: 2280
Last updated: 29 May, 2018
Revision: 3
Views: 522
Posted: 15 Jul, 2005
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How to specify different marker types for each data point and have these markers appear in the legend?

Answer

The IlvMarkerHint interface is designed to let you specify the marker symbol to be used to display a given data point.

To associate a marker hint with a renderer, you must use a class that implements both the IlvDataRenderingHint and the

IlvMarkerHint interfaces. Please refer to the IlvDataRenderingHint documentation to know how hints can be

associated with data points.


You can also use the CSS styling capabilities of the Charts to obtain the same result. Please refer to the JViews Charts User's manual,

Developing with the JViews Charts SDK > Styling > Styling the data series > Styling the chart data section for more information.

By default, that is, when no simultaneous instantiation of IlvDataRenderingHint and IlvMarkerHint has been used, the renderer will draw the marker associated with the renderer through the IlvChartRenderer.setMarker method. In this case, the  IlvMarkerHint is used to specify the marker symbol; hence the marker(s) will not automatically appear in your legend. To add these markers to the IlvLegend, you need to subclass the "single chart" renderer and override the following methods related to the legends:

  • createLegendItems: returns different legend items for different types of marker produced in the IlvMarkerHint interface
  • drawLegendSymbol: draws the appropriate marker for the legend item
  • getLegendText: draws the legend text for the legend item

If you use the IlvPolylineChartRenderer or another composite renderer type, then you need to override the createChild method to return your own "single chart" renderer.

Note: This feature can only apply to the renderers that use marker symbols such as Scatter, Bubble and Line charts.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2280
Last updated: 29 May, 2018
Revision: 3
Views: 522
Posted: 15 Jul, 2005 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Also listed in


Others in this category