Menu

#675 XYStepRenderer horizontal plot orientation: wrong step order

closed-fixed
General (896)
5
2006-10-11
2006-10-02
No

When encountering a step in the given data set, the
XYStepRenderer is supposed to draw two lines. The first
line should be drawn in parallel with the value axis,
the second line in parallel with the range axis. If the
plot orientation is set to horizontal, the renderer
wrongly reverses this order.

For example, given the two data items (0,0) and (1,2),
the lines should run from (0,0) to (1,0) and then from
(1,0) to (1,2). If the plot orientation is set to
horizontal, the first line is wrongly drawn from (0,0)
to (0,2) and the second line from (0,2) to (1,2).

The fix in the code of XYStepRenderer is obvious:

if (orientation == PlotOrientation.HORIZONTAL) {
if (transY0 == transY1) {
//this represents the situation
// for drawing a horizontal bar.
line.setLine(transY0, transX0, transY1, transX1);
g2.draw(line);
}
else {
//this handles the need to perform a 'step'.
// line.setLine(transY0, transX0, transY1, transX0);
line.setLine(transY0, transX0, transY0, transX1);
g2.draw(line);
// line.setLine(transY1, transX0, transY1, transX1);
line.setLine(transY0, transX1, transY1, transX1);
g2.draw(line);
}
}

Discussion

  • Gerald Struck

    Gerald Struck - 2006-10-02

    A short demonstration of the erroneous behaviour using the data items (0,0) and (1,2).

     
  • Gerald Struck

    Gerald Struck - 2006-10-08

    Logged In: YES
    user_id=1611020

    I submitted the patch (same as patch request ID 1572964).

    Regards,
    Gerald

     
  • Gerald Struck

    Gerald Struck - 2006-10-08

    Patch against 1.0.2

     
  • David Gilbert

    David Gilbert - 2006-10-11

    Logged In: YES
    user_id=112975

    Thanks for the report. I've committed your fix to CVS for
    inclusion in the 1.0.3 release.

    Regards,

    Dave Gilbert
    JFreeChart Project Leader

     
  • David Gilbert

    David Gilbert - 2006-10-11
    • assigned_to: nobody --> mungady
    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB