A couple of "can I do" questions...

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Adam

A couple of "can I do" questions...

Post by Adam » Fri Nov 22, 2002 12:38 pm

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.

Dave Gilbert

Re: A couple of "can I do" questions...

Post by Dave Gilbert » Fri Nov 22, 2002 7:01 pm

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

Adam

Re: A couple of "can I do" questions...

Post by Adam » Mon Nov 25, 2002 11:49 am

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.

Locked