I've upgraded to version 0.9.5... It went fairly smoothly, but a few issues have surfaced. If anybody knows how to solve these, I'd appreciate it:
1. Shapes in Legends (for displaying/printing B&W line graphs,etc)...
I'm guessing the premium documentation will have an explanation how to do this... I couldn't find it in any of the new demos... Dave G: if this information is coming in the documention, no need to respond here also.
2. How to outline the boxes in the legend (for displaying/printing B&W bar graphs, etc):
We are printing using patterns in Bar type charts.... If an individual bar doesn't have a border around it, it bleeds into the background....
with ver0.9.4, I solved this issue with:
chart.getlegend.setOutlineKeyBoxes(true) and
plot.setSeriesOutlinePaint(new Paint[] = Color.black);
- How do I do this in version 0.9.5?
3. I am using ChartUtilities.saveChartAsPNG(dest, chart, width, height) to save the chart as a PNG...
I've noticed if the width and height are small (say 300 and 300 respectively), the size of the text in the axis titles and the size of the legend looks reasonable.
When I increase the size to be bigger (ie 800 and 800), the size of the text in the axes and legend doesn't grown proportionally (they look really small)
- Is there a way to have these items stay in some sort of proportion to the size of the chart (either programatically or via some sort of property setting somewhere)?
Thanks in advance!
3 Questions Regarding ver0.9.5
Re: 3 Questions Regarding ver0.9.5
Tom Mazzotta wrote:
> 1. Shapes in Legends (for displaying/printing B&W line
> graphs,etc)...
> I'm guessing the premium documentation will have an
> explanation how to do this... I couldn't find it in any of
> the new demos... Dave G: if this information is coming in the
> documention, no need to respond here also.
This was a last minute change, so it isn't 100 percent right yet. You need to add the following to your code:
StandardLegend legend = (StandardLegend) chart.getLegend();
legend.setDisplaySeriesShapes(true);
LineChartDemo1.java has an example.
> 2. How to outline the boxes in the legend (for
> displaying/printing B&W bar graphs, etc):
> We are printing using patterns in Bar type charts.... If an
> individual bar doesn't have a border around it, it bleeds
> into the background....
> with ver0.9.4, I solved this issue with:
> chart.getlegend.setOutlineKeyBoxes(true) and
> plot.setSeriesOutlinePaint(new Paint[] = Color.black);
> - How do I do this in version 0.9.5?
There methods setShapeOutlineStroke(...) and setShapeOutlinePaint(...) that control the outlines for the shapes.
> 3. I am using ChartUtilities.saveChartAsPNG(dest, chart,
> width, height) to save the chart as a PNG...
> I've noticed if the width and height are small (say 300 and
> 300 respectively), the size of the text in the axis titles
> and the size of the legend looks reasonable.
> When I increase the size to be bigger (ie 800 and 800), the
> size of the text in the axes and legend doesn't grown
> proportionally (they look really small)
> - Is there a way to have these items stay in some sort of
> proportion to the size of the chart (either programatically
> or via some sort of property setting somewhere)?
One approach you could try is to write a new saveChartAsPNG method that uses an AffineTransform to draw the chart at say 300 by 300, but scale it into your space of 800 by 800. This lets Java2D take care of scaling up fonts etc. The ChartPanel class does this when the panel gets bigger than the maximumDrawWidth and maximumDrawHeight values. Some people like the effect, others don't.
Regards,
Dave Gilbert
> 1. Shapes in Legends (for displaying/printing B&W line
> graphs,etc)...
> I'm guessing the premium documentation will have an
> explanation how to do this... I couldn't find it in any of
> the new demos... Dave G: if this information is coming in the
> documention, no need to respond here also.
This was a last minute change, so it isn't 100 percent right yet. You need to add the following to your code:
StandardLegend legend = (StandardLegend) chart.getLegend();
legend.setDisplaySeriesShapes(true);
LineChartDemo1.java has an example.
> 2. How to outline the boxes in the legend (for
> displaying/printing B&W bar graphs, etc):
> We are printing using patterns in Bar type charts.... If an
> individual bar doesn't have a border around it, it bleeds
> into the background....
> with ver0.9.4, I solved this issue with:
> chart.getlegend.setOutlineKeyBoxes(true) and
> plot.setSeriesOutlinePaint(new Paint[] = Color.black);
> - How do I do this in version 0.9.5?
There methods setShapeOutlineStroke(...) and setShapeOutlinePaint(...) that control the outlines for the shapes.
> 3. I am using ChartUtilities.saveChartAsPNG(dest, chart,
> width, height) to save the chart as a PNG...
> I've noticed if the width and height are small (say 300 and
> 300 respectively), the size of the text in the axis titles
> and the size of the legend looks reasonable.
> When I increase the size to be bigger (ie 800 and 800), the
> size of the text in the axes and legend doesn't grown
> proportionally (they look really small)
> - Is there a way to have these items stay in some sort of
> proportion to the size of the chart (either programatically
> or via some sort of property setting somewhere)?
One approach you could try is to write a new saveChartAsPNG method that uses an AffineTransform to draw the chart at say 300 by 300, but scale it into your space of 800 by 800. This lets Java2D take care of scaling up fonts etc. The ChartPanel class does this when the panel gets bigger than the maximumDrawWidth and maximumDrawHeight values. Some people like the effect, others don't.
Regards,
Dave Gilbert