0

I have 2 questions:

  1. How to set the date axis range in jfreechart? The starting date should be 6days before current day & end date should be current day. So that there would be only 7 values in x-axis (dateaxis).

I am trying the following code, but it is not working:

    XYPlot plot = (XYPlot) jfreechart.getPlot();
    dateaxis.setDateFormatOverride(new SimpleDateFormat("dd/MM/yyyy"));
    plot.setRangeAxis(dateaxis);
  1. How to set specific color for the specific column of bar based on the state value? i.e, if i am adding "success" state on 6th sept & "failure" state on 7h sept & "success" state on 8th sept, then how do i represent them as green-red-green?

I am trying to add the the data in the following way. But colors are not actually changing based on state even if i override GradientPaint & setSeriesPaint function:

For the category named F7, i am adding the data in the following way.

defaultcategorydataset.addValue(6/8/2014 , "Successful", "F7");
defaultcategorydataset.addValue(7/8/2014 , "Failed", "F7");
defaultcategorydataset.addValue(8/8/2014 , "Successful", "F7");
defaultcategorydataset.addValue(9/8/2014 , "Failed", "F7");
defaultcategorydataset.addValue(10/8/2014 , "Successful", "F7");
defaultcategorydataset.addValue(11/8/2014 , "Successful", "F7");

Finally i am expecting the graph to be like this (In the screenshot F7 category is not properly represented according to the added value): enter image description here

SS Hegde
  • 729
  • 2
  • 14
  • 33
  • Please edit your question to include a [short, complete example](http://stackoverflow.com/help/mcve) that shows your current approach. – trashgod Sep 16 '14 at 17:35
  • The examples suggested in this possible [duplicate](http://stackoverflow.com/q/25751516/230513) may be a useful starting point. – trashgod Sep 16 '14 at 19:47

0 Answers0