Package org.jfree.data.xy

Examples of org.jfree.data.xy.DefaultHighLowDataset


  protected JFreeChart createCandlestickChart() throws JRException
  {
    JFreeChart jfreeChart = super.createCandlestickChart();
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    CandlestickRenderer renderer = (CandlestickRenderer)xyPlot.getRenderer();
    DefaultHighLowDataset dataset = (DefaultHighLowDataset)xyPlot.getDataset();
    List seriesPaints = (List)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);

    for(int i = 0; i < dataset.getSeriesCount(); i++)
    {
     
      renderer.setSeriesFillPaint(i, (Paint)seriesPaints.get(i));
      renderer.setSeriesPaint(i, Color.DARK_GRAY);
    }
View Full Code Here


        openArray[i] = bean.getOpen().doubleValue();
        closeArray[i] = bean.getClose().doubleValue();
        volumeArray[i] = bean.getVolume().doubleValue();
      }

      return new DefaultHighLowDataset(series, dateArray, highArray, lowArray, openArray, closeArray, volumeArray);
    }
   
    return null;
  }
View Full Code Here

      low[46]   = 41.0;
      open[46= 46.0;
      close[46] = 41.0;
      volume[46] = 100.0;
     
      sampleHighLowDataset = new DefaultHighLowDataset("First", date, high, low, open, close, volume);
    }
   
    return sampleHighLowDataset;
  }
View Full Code Here

  protected JFreeChart createCandlestickChart() throws JRException
  {
    JFreeChart jfreeChart = super.createCandlestickChart();
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    CandlestickRenderer renderer = (CandlestickRenderer)xyPlot.getRenderer();
    DefaultHighLowDataset dataset = (DefaultHighLowDataset)xyPlot.getDataset();
    if(dataset != null)
    {
      for(int i = 0; i < dataset.getSeriesCount(); i++)
      {
        renderer.setSeriesFillPaint(i, (Paint)ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(i));
        renderer.setSeriesPaint(i, Color.DARK_GRAY);
      }
    }
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
        DefaultHighLowDataset d1 = new DefaultHighLowDataset("Series 1",
                new Date[0], new double[0], new double[0], new double[0],
                new double[0], new double[0]);
        DefaultHighLowDataset d2 = new DefaultHighLowDataset("Series 1",
                new Date[0], new double[0], new double[0], new double[0],
                new double[0], new double[0]);
        assertTrue(d1.equals(d2));
        assertTrue(d2.equals(d1));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[0], new double[0], new double[0], new double[0],
                new double[0], new double[0]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[0], new double[0], new double[0], new double[0],
                new double[0], new double[0]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[1], new double[1],
                new double[1], new double[1], new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[1], new double[1],
                new double[1], new double[1], new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2}, new double[1],
                new double[1], new double[1], new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2}, new double[1],
                new double[1], new double[1], new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[1], new double[1],
                new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[1], new double[1],
                new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[1],
                new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[1],
                new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[] {99.9});
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[] {99.9});
        assertTrue(d1.equals(d2));

View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        DefaultHighLowDataset d1 = new DefaultHighLowDataset("Series 1",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[] {99.9});
        DefaultHighLowDataset d2 = null;
        try {
            d2 = (DefaultHighLowDataset) d1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(d1 != d2);
        assertTrue(d1.getClass() == d2.getClass());
        assertTrue(d1.equals(d2));
    }
View Full Code Here

    /**
     * Verify that this class implements {@link PublicCloneable}.
     */
    public void testPublicCloneable() {
        DefaultHighLowDataset d1 = new DefaultHighLowDataset("Series 1",
                new Date[0], new double[0], new double[0], new double[0],
                new double[0], new double[0]);
        assertTrue(d1 instanceof PublicCloneable);
    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        DefaultHighLowDataset d1 = new DefaultHighLowDataset("Series 1",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[] {99.9});
        DefaultHighLowDataset d2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(d1);
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
        DefaultHighLowDataset d1 = new DefaultHighLowDataset("Series 1",
                new Date[0], new double[0], new double[0], new double[0],
                new double[0], new double[0]);
        DefaultHighLowDataset d2 = new DefaultHighLowDataset("Series 1",
                new Date[0], new double[0], new double[0], new double[0],
                new double[0], new double[0]);
        assertTrue(d1.equals(d2));
        assertTrue(d2.equals(d1));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[0], new double[0], new double[0], new double[0],
                new double[0], new double[0]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[0], new double[0], new double[0], new double[0],
                new double[0], new double[0]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[1], new double[1],
                new double[1], new double[1], new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[1], new double[1],
                new double[1], new double[1], new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2}, new double[1],
                new double[1], new double[1], new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2}, new double[1],
                new double[1], new double[1], new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[1], new double[1],
                new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[1], new double[1],
                new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[1],
                new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[1],
                new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[1]);
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[1]);
        assertTrue(d1.equals(d2));

        d1 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[] {99.9});
        assertFalse(d1.equals(d2));
        d2 = new DefaultHighLowDataset("Series 2",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[] {99.9});
        assertTrue(d1.equals(d2));

View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        DefaultHighLowDataset d1 = new DefaultHighLowDataset("Series 1",
                new Date[] {new Date(123L)}, new double[] {1.2},
                new double[] {3.4}, new double[] {5.6}, new double[] {7.8},
                new double[] {99.9});
        DefaultHighLowDataset d2 = null;
        try {
            d2 = (DefaultHighLowDataset) d1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(d1 != d2);
        assertTrue(d1.getClass() == d2.getClass());
        assertTrue(d1.equals(d2));
    }
View Full Code Here

TOP

Related Classes of org.jfree.data.xy.DefaultHighLowDataset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.