| | | | Browse by category |
Question
Is there a sample that extends IlvLegend for a chart? How can I arrange chart legend items into columns corresponding to the appropriate y-axis?
Answer
When displaying a chart with multiple y-axes, it is often desirable to group legend items by their corresponding y-axis. This sample does that by extending IlvLegend
to arrange the items into columns.
Extending IlvLegend
makes it possible not only to arrange the items into groups, but also to customize the groups. For example, you might want to put a border around each column of items or color the background of each group differently.
This sample creates a separate column in the legend for each y-axis in the chart to which items have been assigned through a renderer.
The columns are simple JPanels, so they can be customized any way you like.
The complete source is provided in this file: multicollegend.zip.
Download and extract the file. Then read the html file it contains, readme
.
Note: In order to run this sample with JViews 8.7 and later, you must call the ilog.views.util.IlvProductUtil.DeploymentLicenseRequired
method with the appropriate argument. See the General information > Deployment licenses > Declaring the use of IBM ILOG JViews services
section in the documentation for more information.