I'm evaluating a bunch of charting solutions and JFreeChart is looking good at the moment, although I have a few things which I need to be able to do, but can't figure out how. Maybe someone could indicate whether/how you'd do some of these?
1) I need to be able to overlay an interpolated curve on top of a bar chart. So I have (say) 10 data points in two series, I want to display one set of 10 numbers as a bar chart, and the other 10 as curve rather than a normal (straight) line. Has anyone been able to do this? It looks like I might have to reimplement some stuff to allow the XY and Category plots to be overlaid.
2) Is it possible to have the axes in different colours/styles to the grid lines? I'd like grey dashed grid lines, but solid black axes.
3) Can the Value axes label be % based?
That's about it for now - thanks in advance for your help.
A couple of "can I do" questions...
Re: A couple of "can I do" questions...
Adam wrote:
> I'm evaluating a bunch of charting solutions and JFreeChart
> is looking good at the moment, although I have a few things
> which I need to be able to do, but can't figure out how.
> Maybe someone could indicate whether/how you'd do some of
> these?
>
> 1) I need to be able to overlay an interpolated curve on top
> of a bar chart. So I have (say) 10 data points in two series,
> I want to display one set of 10 numbers as a bar chart, and
> the other 10 as curve rather than a normal (straight) line.
> Has anyone been able to do this? It looks like I might have
> to reimplement some stuff to allow the XY and Category plots
> to be overlaid.
If your line just connects values where there is one value per category, then you can use the OverlaidVerticalCategoryPlot class. Try out the OverlaidBarChartDemo class for an example.
> 2) Is it possible to have the axes in different
> colours/styles to the grid lines? I'd like grey dashed grid
> lines, but solid black axes.
Someone asked about this recently. It is something that hasn't arisen in the past (surprisingly) so will require some new code which I hope to add for version 0.9.5.
> 3) Can the Value axes label be % based?
Yes. If your data values are percentages, you can use a DecimalFormat object in a NumberTickUnit on the axis to format the labels as percentages.
Regards,
DG
> I'm evaluating a bunch of charting solutions and JFreeChart
> is looking good at the moment, although I have a few things
> which I need to be able to do, but can't figure out how.
> Maybe someone could indicate whether/how you'd do some of
> these?
>
> 1) I need to be able to overlay an interpolated curve on top
> of a bar chart. So I have (say) 10 data points in two series,
> I want to display one set of 10 numbers as a bar chart, and
> the other 10 as curve rather than a normal (straight) line.
> Has anyone been able to do this? It looks like I might have
> to reimplement some stuff to allow the XY and Category plots
> to be overlaid.
If your line just connects values where there is one value per category, then you can use the OverlaidVerticalCategoryPlot class. Try out the OverlaidBarChartDemo class for an example.
> 2) Is it possible to have the axes in different
> colours/styles to the grid lines? I'd like grey dashed grid
> lines, but solid black axes.
Someone asked about this recently. It is something that hasn't arisen in the past (surprisingly) so will require some new code which I hope to add for version 0.9.5.
> 3) Can the Value axes label be % based?
Yes. If your data values are percentages, you can use a DecimalFormat object in a NumberTickUnit on the axis to format the labels as percentages.
Regards,
DG
Re: A couple of "can I do" questions...
Thanks for the responses.
Like you suggest, I have one value per category, but I want to generate a smooth curve via interpolation rather than straight lines between each point. I know there is some kind of support for generating curves using PlotFit, if you're using XYPlot , but it seems you can't overlay those onto the bar chart.
Like you suggest, I have one value per category, but I want to generate a smooth curve via interpolation rather than straight lines between each point. I know there is some kind of support for generating curves using PlotFit, if you're using XYPlot , but it seems you can't overlay those onto the bar chart.