Just a feature request. Wondering if you could add a feature to allow you to draw outlines around the little key boxes in the legend.
Essentially adding a protected boolean outlineKeyBoxes to Legend (which would default to false) and then providing getter/setters for it. Then draw in StandardLegend becomes (only relavent portion shown)
protected Rectangle2D draw(Graphics2D g2, Rectangle2D available,
boolean horizontal, boolean inverted) {
...
for (int i=0; i<items.length; i++) {
g2.setPaint(chart.getPlot().getSeriesPaint(i));
g2.fill(items.getMarker());
if (outlineKeyBoxes) {
g2.setPaint(outlinePaint);
g2.setStroke(outlineStroke);
g2.draw(legendArea);
}
g2.setPaint(itemPaint);
g2.drawString(items.label,
(float)items.labelPosition.getX(),
(float)items.labelPosition.getY());
}
...
}
I only ask because I need this feature (came up when we needed one of the series colors to be white (without the outline it sort of disappeared from the legend), and I have to go in and modify the code everytime I move to the latest version to put it back in. Thank goodness for opensource software, its not difficult to do, but I figure if I need to do it, then someone else out there must as well.
outlines around legend items
Re: outlines around legend items
I should check my java before posting.
preceding should be fixed as so:
...
if (outlineKeyBoxes) {
g2.setPaint(outlinePaint);
g2.setStroke(outlineStroke);
g2.draw(items.getMarker()); //this is the fixed line
}
...
preceding should be fixed as so:
...
if (outlineKeyBoxes) {
g2.setPaint(outlinePaint);
g2.setStroke(outlineStroke);
g2.draw(items.getMarker()); //this is the fixed line
}
...
Re: outlines around legend items
Hi Jim,
Thanks for your post. I'll add this feature for the next release.
Regards,
DG.
Thanks for your post. I'll add this feature for the next release.
Regards,
DG.
Re: outlines around legend items
noticed this feature still hasn't been added, so I'm just bumping it to the top.
As for now, I'm still manually making this change with each new release.
As for now, I'm still manually making this change with each new release.
Re: outlines around legend items
Hi Jim,
Sorry, I must have lost that one...thanks for the reminder. I've made the change, and also added attributes to control the paint and stroke separately (your code is using the settings for the outline of the legend box). It will be included with the next release (I'm about to commit the changes to CVS now).
Regards,
DG
Sorry, I must have lost that one...thanks for the reminder. I've made the change, and also added attributes to control the paint and stroke separately (your code is using the settings for the outline of the legend box). It will be included with the next release (I'm about to commit the changes to CVS now).
Regards,
DG