Hi!
I would like to add custom legend (or annotation) that is drawn in unusual way. For example I would like add Mean and Median markers explanation to BoxAndWhiskers chart. Or scale bar to XYPlot (Like scale on the google maps). What class should I use as a parent? And how are coordinates measured?
Thanx in advance!
Custom draw legends/subtitles.
Re: Custom draw legends/subtitles.
Seems that I have found how make mean and median legend:
I used LegendTitle class fot this purpose.
I used LegendTitle class fot this purpose.
Code: Select all
LegendTitle legend = new LegendTitle(new LegendItemSource() {
@Override
public LegendItemCollection getLegendItems() {
LegendItemCollection items = new LegendItemCollection();
int aRadius = 5;
Shape ellipseShape = new Ellipse2D.Double(5 + aRadius , 5 - aRadius, aRadius * 2, aRadius * 2);
items.add(new LegendItem("Ellipse", "", "", "", medianShape, Color.BLACK));
return items;
}
});
legend.setPosition(RectangleEdge.RIGHT);
chart.addLegend(legend);