stepped chart with the step before the point

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
doudou
Posts: 27
Joined: Tue Mar 14, 2006 6:05 pm

stepped chart with the step before the point

Post by doudou » Tue Jun 26, 2007 2:48 pm

Dear all,

Here is my issue: I need to draw a stepped chart, but with the step being drawn before the point defined.

For example if I have the following serie:
(1,100),(2,50),(3,70),...
I would need to have a step at "100" between 0 and 1, a step at 50 between 1 and 2, etc...

I did not find a way to do it with the current API.

Is there something I missed? Is there a way to implement it?

Just another point I'd like to stress out: I cannot just translate all points to the ont before, as I need to show the actual value when the user clicks on the point (in my example, when I point on "2", I want to show "50"

Thank you in advance for your help and advice

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Jun 27, 2007 9:38 am

When this code was originally submitted, I wondered if someone would want the steps to go the other way around. What you'll need to do is modify the lines drawn by the drawItem() method in the XYStepRenderer class.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

doudou
Posts: 27
Joined: Tue Mar 14, 2006 6:05 pm

Post by doudou » Thu Jun 28, 2007 1:42 pm

Thank you for the answer, that's what I was suspecting.
For the implementation, I found someone that posted this suggestion, which I'm going to try:
http://www.jfree.org/phpBB2/viewtopic.p ... light=step

Indeed it is sometimes necessary to show the steps the other way than the usual...

Locked