0

I would like to use an Deviation renderer inside an Overlaid plot with JFreechart. But my problem is that i can't figure out how to change the axis into a custom one.

Here are my other plots :

public class OverlaidXYPlotDemo extends ApplicationFrame 
{

  final XYSeries series0 = new XYSeries("Graph0");
  final XYSeries series1 = new XYSeries("Graph1");
  final XYSeries series2 = new XYSeries("Graph2");
  final XYSeries series3 = new XYSeries("Graph3");

     public OverlaidXYPlotDemo(final String title) 
     {
       super(title);
       final JFreeChart chart = createOverlaidChart();
       final ChartPanel panel = new ChartPanel(chart, true, true, true, true, true);
       panel.setPreferredSize(new java.awt.Dimension(800, 600));
       chart.setBackgroundPaint(Color.white);

       JCheckBox chckbxCheck = new JCheckBox("CHECK");
       panel.add(chckbxCheck, BorderLayout.SOUTH);
    
       setContentPane(panel);
      }


     public void addElem0(double x, double y)
     {
       this.series0.add(x, y);
     }

     public void addElem1(double x, double y)
     {
       this.series1.add(x, y);
     }

     private IntervalXYDataset createDataset0() 
     {
       // create dataset 0...
       final XYSeriesCollection coll0 = new XYSeriesCollection(series0);
       return coll0;
      }

     private IntervalXYDataset createDataset1() 
     {
       // create dataset 1...
       final XYSeriesCollection coll1 = new XYSeriesCollection(series1);
       return coll1;
     }
     private JFreeChart createOverlaidChart() 
     {
      // Make the two axis
      final NumberAxis domainAxis = new NumberAxis("Speed (m / s)");
      final ValueAxis rangeAxis = new NumberAxis("Power (kw)");

      // create plot ...
      final IntervalXYDataset data0 = createDataset0();
      final XYItemRenderer renderer0 = new XYBarRenderer(0.20);
      // change "new XYBarRenderer(0.20)" to "StandardXYItemRenderer()" if you want to change  type of graph
     final XYPlot plot = new XYPlot(data0, domainAxis, rangeAxis, renderer0);
     // add a second dataset and renderer... 
     final IntervalXYDataset data1 = createDataset1();
     final XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer(false, true); 
    // arguments of new XYLineAndShapeRenderer are to activate or deactivate the display of points or line. Set first argument to true if you want to draw lines between the points for e.g.
     plot.setDataset(1, data1);
     plot.setRenderer(1, renderer1);

     plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
     return new JFreeChart("Test", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    }
}

I would like to do something like this with my deviation renderer. Any idea how to do that? :) If you want me to be more precise, or provide more code i will.

Thanks

Community
  • 1
  • 1
trolologuy
  • 1,900
  • 4
  • 21
  • 32
  • @DavidGilbert sorry for that, do you want me to remove the link? And have you got any idea or a clue of how to solve my problem? – trolologuy Sep 25 '13 at 07:18
  • @trolologuy have you solved your problem yet? I am having trouble making distributable jar with netbeans and jFreeCharts – Gaurav K Nov 13 '13 at 16:47
  • @GauravK hello, sadly that's one of the few issues i couldn't solve with JFreechart... But still hoping that someone will answer :p (i'm using Eclipse, and it was quite easy to make distributable jars, MP me if you need help). – trolologuy Nov 15 '13 at 09:23

0 Answers0