#998 Series Order Cannot Be Changed

1.0.x
open
General (896)
6
2010-05-12
2010-05-12
No

Hi,

Try this:

XYPlot plot = chart.getXYPlot();

XYLineAndShapeRenderer renderer =
( XYLineAndShapeRenderer )plot.getRenderer( 0 );

renderer.setSeriesStroke( 1, new BasicStroke( 2.5f ) );
renderer.setSeriesLinesVisible( 1, true );

renderer.setSeriesShape( 0, new Ellipse2D.Double( 0, 0, 4, 4 ) );
renderer.setSeriesShapesVisible( 0, true );

It seems like I should be able to set the order using (or a variation of):

plot.setSeriesRenderingOrder( SeriesRenderingOrder.FORWARD );

However, it seems that shapes always trump lines, no matter what.

I need to make the line show up in front of the shape.

Any ideas?

JFreeChart 1.0.13.

Discussion

  • Anonymous - 2010-05-12
    • labels: --> General
    • milestone: --> 1.0.x
    • priority: 5 --> 6
    • assigned_to: nobody --> mungady
     
  • Anonymous - 2010-05-12

    This solves the problem:

    // Trend is series 1
    // Scatter is series 0
    //
    XYPlot plot = chart.getXYPlot();

    // Copy the data into a new dataset to control its line independently.
    //
    plot.setDataset( 1, plot.getDataset( 0 ) );

    // Turn off the lines and shapes for the scatter plot in the trend series.
    //
    XYLineAndShapeRenderer trend = new XYLineAndShapeRenderer();
    trend.setSeriesShapesVisible( 0, false );
    trend.setSeriesLinesVisible( 0, false );
    trend.setSeriesShapesVisible( 1, false );
    trend.setSeriesStroke( 1, new BasicStroke( 2.5f ) );

    // Change the look of the scatter plot.
    //
    XYLineAndShapeRenderer scatter =
    ( XYLineAndShapeRenderer )plot.getRenderer( 0 );
    scatter.setSeriesShape( 0, new Ellipse2D.Double( 0, 0, 4, 4 ) );
    scatter.setSeriesShapesVisible( 0, true );

    plot.setRenderer( 1, trend );
    plot.setRenderer( 0, scatter );
    plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks