List of usage examples for org.jfree.data.xy MatrixSeriesCollection MatrixSeriesCollection
public MatrixSeriesCollection(MatrixSeries series)
From source file:org.jfree.chart.demo.BubblyBubblesDemo.java
/** * A demonstration application showing a bubble chart using matrix series. * * @param title the frame title.//from w ww. j av a 2s .c o m */ public BubblyBubblesDemo(final String title) { super(title); this.series = createInitialSeries(); final MatrixSeriesCollection dataset = new MatrixSeriesCollection(this.series); final JFreeChart chart = ChartFactory.createBubbleChart(TITLE, "X", "Y", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue)); final XYPlot plot = chart.getXYPlot(); plot.setForegroundAlpha(0.5f); final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setLowerBound(-0.5); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); // rangeAxis.setInverted(true); // uncoment to reproduce a bug in jFreeChart rangeAxis.setLowerBound(-0.5); final ChartPanel chartPanel = new ChartPanel(chart); // chartPanel.setVerticalZoom(true); // chartPanel.setHorizontalZoom(true); setContentPane(chartPanel); }
From source file:org.jfree.chart.demo.BubblyBubblesDemo2.java
/** * A demonstration application showing a bubble chart using matrix series. * * @param title the frame title./*from w ww. jav a2s . c om*/ */ public BubblyBubblesDemo2(final String title) { super(title); this.series = createInitialSeries(); final MatrixSeriesCollection dataset = new MatrixSeriesCollection(this.series); final JFreeChart chart = ChartFactory.createBubbleChart(TITLE, "X", "Y", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.yellow)); final XYPlot plot = chart.getXYPlot(); plot.setForegroundAlpha(0.5f); final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setLowerBound(-0.5); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLowerBound(-0.5); final ChartPanel chartPanel = new ChartPanel(chart); // chartPanel.setVerticalZoom(true); // chartPanel.setHorizontalZoom(true); setContentPane(chartPanel); }
From source file:org.objectweb.proactive.extensions.timitspmd.util.charts.MatrixChart.java
private void buildMainChart(String title, String subTitle, String xAxisLabel, String yAxisLabel, String fileName) {// ww w. ja v a 2 s. com 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; }
From source file:org.objectweb.proactive.extensions.timitspmd.util.charts.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); }//from www . ja v a2 s .c om } 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; }