Examples of HistogramDataset


Examples of org.jfree.data.statistics.HistogramDataset

     * A test to show the limitation addressed by patch 2902842.
     */
    public void test2902842() {
        this.lastEvent = null;
        double[] values = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
        HistogramDataset hd = new HistogramDataset();
        hd.addChangeListener(this);
        hd.addSeries("S1", values, 5);
        assertNotNull(this.lastEvent);
    }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramDataset

public class ChartCreator {
  public static JFreeChart createHistogram(List<List<Object>> series, ResultSetMetaData metaData, int numberOfCategories) {
    // if(histogramButton.isSelected()){
    // IntervalXYDataset dataset = createDataset(data);
    // printResultSet(data);
    HistogramDataset dataset = new HistogramDataset();
    for (int i = 0; i < series.size(); i++) {

      try {
        dataset.addSeries(metaData.getColumnName(i + 1), toDoubleArray(series.get(i)), numberOfCategories);
      } catch (SQLException e) {
        dataset.addSeries("Column " + i, toDoubleArray(series.get(i)), numberOfCategories);
      }

    }

    JFreeChart chart = ChartFactory.createHistogram("Histogram", null, null, dataset,
        PlotOrientation.VERTICAL, true, false, false);
    dataset.seriesChanged(new SeriesChangeEvent(new Object()));
    chart.getXYPlot().setForegroundAlpha(0.75f);

    return chart;
    // }
    // else{
View Full Code Here

Examples of org.jfree.data.statistics.HistogramDataset


  private void initChartPanel(){

    this.display = Display.getCurrent();
    JFreeChart chart = ChartFactory.createHistogram("Histogram", null, null, new HistogramDataset(),
        PlotOrientation.VERTICAL, true, false, false);
    chartPanel = new ChartPanel(chart);

  }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramDataset

     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
       
        final double[] values = {1.0, 2.0, 3.0, 4.0, 6.0, 12.0, 5.0, 6.3, 4.5};
        final HistogramDataset d1 = new HistogramDataset();
        d1.addSeries("Series 1", values, 5);
        final HistogramDataset d2 = new HistogramDataset();
        d2.addSeries("Series 1", values, 5);
       
        assertTrue(d1.equals(d2));
        assertTrue(d2.equals(d1));

    }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramDataset

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        final double[] values = {1.0, 2.0, 3.0, 4.0, 6.0, 12.0, 5.0, 6.3, 4.5};
        final HistogramDataset d1 = new HistogramDataset();
        d1.addSeries("Series 1", values, 5);
        HistogramDataset d2 = null;
        try {
            d2 = (HistogramDataset) d1.clone();
        }
        catch (CloneNotSupportedException e) {
            System.err.println("Failed to clone.");
        }
        assertTrue(d1 != d2);
        assertTrue(d1.getClass() == d2.getClass());
        assertTrue(d1.equals(d2));
    }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramDataset

     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        final double[] values = {1.0, 2.0, 3.0, 4.0, 6.0, 12.0, 5.0, 6.3, 4.5};
        final HistogramDataset d1 = new HistogramDataset();
        d1.addSeries("Series 1", values, 5);
        HistogramDataset d2 = null;

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

Examples of org.jfree.data.statistics.HistogramDataset

    /**
     * Some checks that the correct values are assigned to bins.
     */
    public void testBins() {
        double[] values = {1.0, 2.0, 3.0, 4.0, 6.0, 12.0, 5.0, 6.3, 4.5};
        HistogramDataset hd = new HistogramDataset();
        hd.addSeries("Series 1", values, 5);
        assertEquals(hd.getYValue(0, 0), 3.0, EPSILON);       
        assertEquals(hd.getYValue(0, 1), 3.0, EPSILON);       
        assertEquals(hd.getYValue(0, 2), 2.0, EPSILON);       
        assertEquals(hd.getYValue(0, 3), 0.0, EPSILON);       
        assertEquals(hd.getYValue(0, 4), 1.0, EPSILON);       
    }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramDataset

     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
       
        double[] values = {1.0, 2.0, 3.0, 4.0, 6.0, 12.0, 5.0, 6.3, 4.5};
        HistogramDataset d1 = new HistogramDataset();
        d1.addSeries("Series 1", values, 5);
        HistogramDataset d2 = new HistogramDataset();
        d2.addSeries("Series 1", values, 5);
       
        assertTrue(d1.equals(d2));
        assertTrue(d2.equals(d1));

    }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramDataset

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        double[] values = {1.0, 2.0, 3.0, 4.0, 6.0, 12.0, 5.0, 6.3, 4.5};
        HistogramDataset d1 = new HistogramDataset();
        d1.addSeries("Series 1", values, 5);
        HistogramDataset d2 = null;
        try {
            d2 = (HistogramDataset) d1.clone();
        }
        catch (CloneNotSupportedException e) {
            System.err.println("Failed to clone.");
        }
        assertTrue(d1 != d2);
        assertTrue(d1.getClass() == d2.getClass());
        assertTrue(d1.equals(d2));
    }
View Full Code Here

Examples of org.jfree.data.statistics.HistogramDataset

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        double[] values = {1.0, 2.0, 3.0, 4.0, 6.0, 12.0, 5.0, 6.3, 4.5};
        HistogramDataset d1 = new HistogramDataset();
        d1.addSeries("Series 1", values, 5);
        HistogramDataset d2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(d1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.