Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#696 CategoryPlot Column data is not sorted appropriately

closed-rejected
David Gilbert
General (896)
5
2006-11-22
2006-11-21
Mauricio Ramirez
No

Hi everybody.

I have a dataset as follows

Region Week Data
------ ---- ----
Alabama 39 29
Alabama 40 31
Alabama 41 32

Florida 39 50
Florida 40 51
Florida 41 47

Georgia 38 35
Georgia 39 37
Georgia 40 33
Georgia 41 31

Because Georgia is the last row and it has data for week 38 (column data), the CategoryPlot is shown with wrong sort in the column values, showing weeks 39, 40, 41 and 38 as the last one.

The attached graph is a sample of the problem.

The code is as follows:

CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.white);
plot.setRangeGridlinePaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setDomainGridlinesVisible(true);
plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
plot.setRowRenderingOrder(SortOrder.DESCENDING);
plot.setColumnRenderingOrder(SortOrder.ASCENDING);

Thanks.

Mauricio Ramirez

Discussion

  • David Gilbert
    David Gilbert
    2006-11-22

    Logged In: YES
    user_id=112975
    Originator: NO

    This isn't a bug, although I've updated the API docs to make it a bit clearer why. The row and column rendering order ONLY change the order in which the items are drawn, NOT their position on the chart (this is only important for renderers that can draw overlapping items, like the stacked bar renderer with 3D effect). In general, the position of each item on the chart is determined by the order of the items in the dataset, so you should look carefully at how you construct your dataset and get the right order there.

    That said, I plan to introduce options for reordering the items in a dataset in a future release.

     
  • David Gilbert
    David Gilbert
    2006-11-22

    • labels: --> General
    • assigned_to: nobody --> mungady
    • status: open --> closed-rejected