Java 类org.jfree.data.xy.MatrixSeriesCollection 实例源码

项目:parabuild-ci    文件:MatrixSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeries s2 = new MatrixSeries("Series", 2, 3);
    s2.update(0, 0, 1.1);
    MatrixSeriesCollection c2 = new MatrixSeriesCollection();
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));
    assertTrue(c2.equals(c1));

    c1.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertFalse(c1.equals(c2));

    c2.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertTrue(c1.equals(c2));
}
项目:gama    文件:ChartJFreeChartOutputHeatmap.java   
@Override
protected void clearDataSet(final IScope scope) {
    // TODO Auto-generated method stub
    super.clearDataSet(scope);
    final XYPlot plot = (XYPlot) this.chart.getPlot();
    for (int i = plot.getDatasetCount() - 1; i >= 1; i--) {
        plot.setDataset(i, null);
        plot.setRenderer(i, null);
    }
    ((MatrixSeriesCollection) jfreedataset.get(0)).removeAllSeries();
    jfreedataset.clear();
    jfreedataset.add(0, new MatrixSeriesCollection());
    plot.setDataset((MatrixSeriesCollection) jfreedataset.get(0));
    plot.setRenderer(0, null);

    IdPosition.clear();
}
项目:nabs    文件:MatrixSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeries s2 = new MatrixSeries("Series", 2, 3);
    s2.update(0, 0, 1.1);
    MatrixSeriesCollection c2 = new MatrixSeriesCollection();
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));
    assertTrue(c2.equals(c1));

    c1.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertFalse(c1.equals(c2));

    c2.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertTrue(c1.equals(c2));
}
项目:astor    文件:MatrixSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeries s2 = new MatrixSeries("Series", 2, 3);
    s2.update(0, 0, 1.1);
    MatrixSeriesCollection c2 = new MatrixSeriesCollection();
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));
    assertTrue(c2.equals(c1));

    c1.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertFalse(c1.equals(c2));

    c2.addSeries(new MatrixSeries("Empty Series", 1, 1));
    assertTrue(c1.equals(c2));
}
项目:groovychart    文件:MatrixSeriesCollectionBuilder.java   
public void processNode(Object name, Map map, Object value) throws Exception {
    if(value != null && value instanceof MatrixSeriesCollection) {
        this.collection = (MatrixSeriesCollection)value;
    }else {
        // TODO
    }           
}
项目:gama    文件:ChartJFreeChartOutputHeatmap.java   
@Override
public void createChart(final IScope scope) {
    super.createChart(scope);

    jfreedataset.add(0, new MatrixSeriesCollection());
    PlotOrientation orientation = PlotOrientation.VERTICAL;
    if (reverse_axes)
        orientation = PlotOrientation.HORIZONTAL;

    chart = ChartFactory.createXYLineChart(getName(), "", "", (MatrixSeriesCollection) jfreedataset.get(0),
            orientation, true, false, false);

}
项目:gama    文件:ChartJFreeChartOutputHeatmap.java   
@Override
protected void createNewSerie(final IScope scope, final String serieid) {

    final ChartDataSeries dataserie = chartdataset.getDataSeries(scope, serieid);
    final MatrixSeries serie = new MatrixSeries((String) dataserie.getSerieLegend(scope),
            Math.max(1, this.getChartdataset().getYSeriesValues().size()),
            Math.max(1, this.getChartdataset().getXSeriesValues().size()));
    final XYPlot plot = (XYPlot) this.chart.getPlot();

    final MatrixSeriesCollection firstdataset = (MatrixSeriesCollection) plot.getDataset();

    if (!IdPosition.containsKey(serieid)) {

        if (firstdataset.getSeriesCount() == 0) {
            firstdataset.addSeries(serie);
            plot.setDataset(0, firstdataset);

        } else {

            final MatrixSeriesCollection newdataset = new MatrixSeriesCollection();
            newdataset.addSeries(serie);
            jfreedataset.add(newdataset);
            plot.setDataset(jfreedataset.size() - 1, newdataset);

        }
        plot.setRenderer(jfreedataset.size() - 1, (XYItemRenderer) getOrCreateRenderer(scope, serieid));
        IdPosition.put(serieid, jfreedataset.size() - 1);
        // System.out.println("new serie"+serieid+" at
        // "+IdPosition.get(serieid)+" fdsize "+plot.getSeriesCount()+" jfds
        // "+jfreedataset.size()+" datasc "+plot.getDatasetCount());
        // TODO Auto-generated method stub

    }
}
项目:proactive-component-monitoring    文件:MatrixChart.java   
private void buildMainChart(String title, String subTitle, String xAxisLabel, String yAxisLabel,
        String fileName) {
    final MatrixSeriesCollection dataset = new MatrixSeriesCollection(this.createMatrixDataSet());

    final JFreeChart chart = ChartFactory.createBubbleChart(title, xAxisLabel, yAxisLabel, dataset,
            PlotOrientation.VERTICAL, true, true, false);

    chart.addSubtitle(new TextTitle(subTitle));
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.WHITE));
    chart.removeLegend();

    // Perform customizations starts here ...
    final XYPlot plot1 = chart.getXYPlot();

    plot1.setDomainGridlinesVisible(false);
    plot1.setRangeGridlinesVisible(false);
    plot1.setForegroundAlpha(0.5f);
    plot1.setDomainAxis(new CustomAxis(plot1.getDomainAxis().getLabel()));
    plot1.setRangeAxis(new CustomAxis(plot1.getRangeAxis().getLabel()));

    // Custumize the domain axis ( y )
    final NumberAxis domainAxis = (NumberAxis) plot1.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    domainAxis.setRange(-1, this.array.length);

    // Custumize the range axis ( y )
    final NumberAxis rangeAxis = (NumberAxis) plot1.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setRange(-1, this.array.length);

    // Create custom renderer
    StandardXYItemRenderer ren = new CustomRenderer(false);
    ren.setSeriesItemLabelPaint(0, Color.BLACK);
    plot1.setRenderer(ren);
    this.mainChart = chart;
}
项目:gama    文件:ChartJFreeChartOutputHeatmap.java   
Dataset createDataset(final IScope scope) {
    return new MatrixSeriesCollection();
}
项目:gama    文件:ChartJFreeChartOutputHeatmap.java   
@Override
    protected void resetSerie(final IScope scope, final String serieid) {
        // TODO Auto-generated method stub
        this.createNewSerie(scope, serieid);
        final ChartDataSeries dataserie = chartdataset.getDataSeries(scope, serieid);
        final MatrixSeries serie =
                ((MatrixSeriesCollection) jfreedataset.get(IdPosition.get(dataserie.getSerieId(scope)))).getSeries(0);
        final ArrayList<Double> XValues = dataserie.getXValues(scope);
        final ArrayList<Double> YValues = dataserie.getYValues(scope);
        final ArrayList<Double> SValues = dataserie.getSValues(scope);
        final NumberAxis domainAxis = (NumberAxis) ((XYPlot) this.chart.getPlot()).getDomainAxis();
        if (XValues.size()==0)
        {
            if (!usexrangeinterval && !usexrangeminmax) 
            {
                domainAxis.setAutoRange(false);
                domainAxis.setRange(-0.5,XValues.size()+0.5);               
            }

        }
        final NumberAxis rangeAxis = (NumberAxis) ((XYPlot) this.chart.getPlot()).getRangeAxis();
        if (YValues.size()==0)
        {
            if (!useyrangeinterval && !useyrangeminmax) 
            {
                rangeAxis.setAutoRange(false);
                rangeAxis.setRange(-0.5,YValues.size()+0.5);                
            }

        }
//      final NumberAxis domainAxis = (NumberAxis) ((XYPlot) this.chart.getPlot()).getDomainAxis();
//      final NumberAxis rangeAxis = (NumberAxis) ((XYPlot) this.chart.getPlot()).getRangeAxis();

        if (XValues.size() > 0) {
            domainAxis.setAutoRange(false);
            rangeAxis.setAutoRange(false);
                domainAxis.setTickLabelsVisible(this.getXTickValueVisible(scope));
                domainAxis.setTickMarksVisible(this.getXTickValueVisible(scope));
                rangeAxis.setTickLabelsVisible(this.getYTickValueVisible(scope));
                rangeAxis.setTickMarksVisible(this.getYTickValueVisible(scope));
            for (int i = 0; i < XValues.size(); i++) {

                if (XValues.get(i)>domainAxis.getUpperBound())
                {
                    if (!usexrangeinterval && !usexrangeminmax) 
                    {
                        domainAxis.setAutoRange(false);
                        domainAxis.setRange(-0.5,YValues.get(i)+0.5);               
                    }

                }
                if (YValues.get(i)>rangeAxis.getUpperBound())
                {
                    if (!useyrangeinterval && !useyrangeminmax) 
                    {
                        rangeAxis.setAutoRange(false);
                        rangeAxis.setRange(-0.5,YValues.get(i)+0.5);                
                    }

                }

                serie.update(YValues.get(i).intValue(), XValues.get(i).intValue(), SValues.get(i).doubleValue());
            }
        }
        this.resetRenderer(scope, serieid);

    }
项目:astor    文件:MatrixSeriesCollectionTests.java   
/**
 * Verify that this class implements {@link PublicCloneable}.
 */
public void testPublicCloneable() {
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    assertTrue(c1 instanceof PublicCloneable);
}
项目:proactive-component-monitoring    文件:MatrixChart.java   
private void buildLegendChart(int nbValues) {
    this.legendValues = new int[nbValues + 1];
    this.legendValues[0] = 0;
    int offset = 255 / nbValues;
    int step = offset;

    if (this.scaleMode == Chart.Scale.LOGARITHMIC) {
        double logStep = (Math.log(this.maxValue) / Math.log(2)) / nbValues;
        for (int i = 1; i < (nbValues + 1); i++) {
            this.legendValues[i] = (int) Math.pow(2, logStep * i);
        }
    } else { // Linear scale mode
        for (int i = 1; i < (nbValues + 1); i++) {
            this.legendValues[i] = (step * this.maxValue) / 255;
            step += offset;
        }
    }

    final MatrixSeriesCollection dataset = new MatrixSeriesCollection(this.createLegendDataSet());

    final JFreeChart chart = ChartFactory.createBubbleChart("", "", "", dataset,
            PlotOrientation.VERTICAL, true, true, false);

    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.WHITE));
    chart.removeLegend();

    // Perform customizations starts here ...
    final XYPlot plot1 = chart.getXYPlot();

    plot1.setDomainGridlinesVisible(false);
    plot1.setRangeGridlinesVisible(false);
    plot1.setForegroundAlpha(0.5f);
    plot1.setDomainAxis(new CustomAxis(plot1.getDomainAxis().getLabel()));
    plot1.setRangeAxis(new CustomAxis(plot1.getRangeAxis().getLabel()));

    // Custumize the domain axis ( x )
    final NumberAxis domainAxis = (NumberAxis) plot1.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    domainAxis.setRange(-1, 1);
    domainAxis.setVisible(false);

    // Custumize the range axis ( y )
    final NumberAxis rangeAxis = (NumberAxis) plot1.getRangeAxis();
    rangeAxis.setTickUnit(new CustomTickUnit(rangeAxis.getTickUnit().getSize()));
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setRange(-1, this.legendValues.length);
    rangeAxis.setTickLabelsVisible(true);
    rangeAxis.setTickMarkInsideLength(4);

    // Create custom renderer
    StandardXYItemRenderer ren = new CustomRenderer(true);
    ren.setSeriesItemLabelPaint(0, Color.BLUE);
    plot1.setRenderer(ren);
    plot1.setRangeAxisLocation(AxisLocation.TOP_OR_RIGHT);

    this.legendChart = chart;
}
项目:groovychart    文件:MatrixSeriesCollectionBuilder.java   
/**
 * Getter for property collection.
 * @return Value of property collection.
 */
public MatrixSeriesCollection getCollection() {
    return this.collection;
}
项目:groovychart    文件:MatrixSeriesCollectionBuilder.java   
/**
 * Setter for property collection.
 * @param collection New value of property collection.
 */
public void setCollection(MatrixSeriesCollection collection) {
    this.collection = collection;
}