private XYPlot createScalabilityPlot(List<XYSeries> seriesList, String xAxisLabel, NumberFormat xAxisNumberFormat, String yAxisLabel, NumberFormat yAxisNumberFormat) { NumberAxis xAxis; if (useLogarithmicProblemScale(seriesList)) { LogarithmicAxis logarithmicAxis = new LogarithmicAxis(xAxisLabel + " (logarithmic)"); logarithmicAxis.setAllowNegativesFlag(true); xAxis = logarithmicAxis; } else { xAxis = new NumberAxis(xAxisLabel); } xAxis.setNumberFormatOverride(xAxisNumberFormat); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setNumberFormatOverride(yAxisNumberFormat); XYPlot plot = new XYPlot(null, xAxis, yAxis, null); int seriesIndex = 0; for (XYSeries series : seriesList) { XYSeriesCollection seriesCollection = new XYSeriesCollection(); seriesCollection.addSeries(series); plot.setDataset(seriesIndex, seriesCollection); XYItemRenderer renderer = createScalabilityPlotRenderer(yAxisNumberFormat); plot.setRenderer(seriesIndex, renderer); seriesIndex++; } plot.setOrientation(PlotOrientation.VERTICAL); return plot; }
private JFreeChart createChart(String title, XYDataset magDataset, String freqUnits, String magnitudeUnits) { XYItemRenderer renderer1 = new StandardXYItemRenderer(); NumberAxis rangeAxis1 = new NumberAxis("Magnitude " + magnitudeUnits); XYPlot subplot1 = new XYPlot(magDataset, new LogarithmicAxis("Frequency " + freqUnits), rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); renderer1.setSeriesVisibleInLegend(0, false); return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, subplot1, true); } }
private JFreeChart createChart(String title, XYDataset magDataset, String freqUnits, String magnitudeUnits) { XYItemRenderer renderer1 = new StandardXYItemRenderer(); NumberAxis rangeAxis1 = new NumberAxis("Magnitude " + magnitudeUnits); XYPlot subplot1 = new XYPlot(magDataset, new LogarithmicAxis("Frequency " + freqUnits), rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); renderer1.setSeriesVisibleInLegend(0, false); return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, subplot1, true); } }
private JFreeChart createChart(String title, XYDataset magDataset, String freqUnits, String magnitudeUnits) { XYItemRenderer renderer1 = new StandardXYItemRenderer(); NumberAxis rangeAxis1 = new NumberAxis("Magnitude " + magnitudeUnits); XYPlot subplot1 = new XYPlot(magDataset, new LogarithmicAxis("Frequency " + freqUnits), rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); renderer1.setSeriesVisibleInLegend(0, false); return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, subplot1, true); } }
public void setLogScale(boolean range, boolean domain) { if( domain ) { NumberAxis axis = (NumberAxis)plot.getDomainAxis(); axis = new LogarithmicAxis(axis.getLabel()); plot.setDomainAxis(axis); } if( range ) { NumberAxis axis = (NumberAxis)plot.getRangeAxis(); axis = new LogarithmicAxis(axis.getLabel()); plot.setRangeAxis(axis); } }
private void setXAxis() { ValueAxis axis; switch (xAxisScaling) { case LOGARITHMIC: axis = new LogarithmicAxis(xLabel); break; case CONSTANT: default: axis = new NumberAxis(xLabel); break; } graph.getXYPlot().setDomainAxis(0, axis); }
private void setYAxis() { ValueAxis axis; switch (yAxisScaling) { case LOGARITHMIC: axis = new LogarithmicAxis(xLabel); break; case CONSTANT: default: axis = new NumberAxis(xLabel); break; } graph.getXYPlot().setRangeAxis(0, axis); }
private JFreeChart createChart(final String title, final String categoryAxisLabel, final String valueAxisLabel, final XYSeriesCollection dataset) { JFreeChart c = ChartFactory.createXYLineChart(title, categoryAxisLabel, valueAxisLabel, dataset, PlotOrientation.VERTICAL, true, // legend? false, // tooltips? false // URLs? ); if (this.isLogarithmicAxis){ XYPlot p = (XYPlot) c.getPlot(); LogarithmicAxis axis_x = new LogarithmicAxis(this.xAxisLabel); LogarithmicAxis axis_y = new LogarithmicAxis(this.yAxisLabel); axis_x.setAllowNegativesFlag(false); axis_y.setAllowNegativesFlag(false); p.setDomainAxis(axis_x); p.setRangeAxis(axis_y); } return c; }
private JFreeChart createChart(final String title, final String categoryAxisLabel, final String valueAxisLabel, final XYSeriesCollection dataset) { JFreeChart c = ChartFactory.createScatterPlot(title, categoryAxisLabel, valueAxisLabel, dataset, PlotOrientation.VERTICAL, true, // legend? false, // tooltips? false // URLs? ); if (this.isLogarithmicAxis) { XYPlot p = (XYPlot) c.getPlot(); LogarithmicAxis axis_x = new LogarithmicAxis(this.xAxisLabel); LogarithmicAxis axis_y = new LogarithmicAxis(this.yAxisLabel); axis_x.setAllowNegativesFlag(false); axis_y.setAllowNegativesFlag(false); p.setDomainAxis(axis_x); p.setRangeAxis(axis_y); } return c; }
public void createXYLineChart(double[][] xDATA, double[][] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC) { XYDataset dataset = createDataset(xDATA, yDATA); JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.lightGray); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis, domainAxis; if (ISXAXISLOGARITHMIC) domainAxis = new LogarithmicAxis(XLABEL); else domainAxis = new NumberAxis(XLABEL); if (ISYAXISLOGARITHMIC) rangeAxis = new LogarithmicAxis(YLABEL); else rangeAxis = new NumberAxis(YLABEL); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.blue); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT)); this.setContentPane(chartPanel); }
public void createXYLineChart(double[] xDATA, double[] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC) { XYDataset dataset = createDataset(xDATA, yDATA); JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.lightGray); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis, domainAxis; if (ISXAXISLOGARITHMIC) domainAxis = new LogarithmicAxis(XLABEL); else domainAxis = new NumberAxis(XLABEL); if (ISYAXISLOGARITHMIC) rangeAxis = new LogarithmicAxis(YLABEL); else rangeAxis = new NumberAxis(YLABEL); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.blue); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT)); this.setContentPane(chartPanel); }
public void createXYLineChart(double[][] xDATA, double[][] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC) { XYDataset dataset = createDataset(xDATA, yDATA); JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.lightGray); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis, domainAxis; if (ISXAXISLOGARITHMIC) domainAxis = new LogarithmicAxis(XLABEL); else domainAxis = new NumberAxis(XLABEL); if (ISYAXISLOGARITHMIC) rangeAxis = new LogarithmicAxis(YLABEL); else rangeAxis = new NumberAxis(YLABEL); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.blue); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT)); this.setContentPane(chartPanel); }
public void createXYLineChart(double[] xDATA, double[] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC) { XYDataset dataset = createDataset(xDATA, yDATA); JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.lightGray); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis, domainAxis; if (ISXAXISLOGARITHMIC) domainAxis = new LogarithmicAxis(XLABEL); else domainAxis = new NumberAxis(XLABEL); if (ISYAXISLOGARITHMIC) rangeAxis = new LogarithmicAxis(YLABEL); else rangeAxis = new NumberAxis(YLABEL); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.blue); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT)); this.setContentPane(chartPanel); }
public static JFreeChart createStatisticalBarChart(CategoryDataset dataset) { final CategoryAxis xAxis = new CategoryAxis("Type"); xAxis.setLowerMargin(0.01d); // percentage of space before first bar xAxis.setUpperMargin(0.01d); // percentage of space after last bar xAxis.setCategoryMargin(0.3d); // percentage of space between // categories xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); final LogarithmicAxis yAxis = new LogarithmicAxis("Time (s)");//new NumberAxis("Value"); yAxis.setAutoRange(true); //yAxis.setAutoRangeMinimumSize(/size); yAxis.setLowerBound(0.0001); yAxis.setMinorTickMarksVisible(true); yAxis.setAutoRangeIncludesZero(false); yAxis.setStrictValuesFlag(false); // define the plot final CategoryItemRenderer renderer = new StatisticalBarRenderer(); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); final JFreeChart chart = new JFreeChart("Performance Comparison", new Font("Helvetica", Font.BOLD, 14), plot, true); return chart; }
valueAxis[i] = new LogarithmicAxis(XLABEL[i]); else valueAxis[i] = new NumberAxis(XLABEL[i]); rangeAxis[i] = new LogarithmicAxis(YLABEL[i]); else rangeAxis[i] = new NumberAxis(YLABEL[i]);
LogarithmicAxis logAxisX = new LogarithmicAxis(resultUnitX); logAxisX.setAllowNegativesFlag(true); plot.setDomainAxis(logAxisX); LogarithmicAxis logAxis = new LogarithmicAxis(resultUnit); logAxis.setAllowNegativesFlag(true); plot.setRangeAxis(logAxis);
valueAxis[i] = new LogarithmicAxis(XLABEL[i]); else valueAxis[i] = new NumberAxis(XLABEL[i]); rangeAxis[i] = new LogarithmicAxis(YLABEL[i]); else rangeAxis[i] = new NumberAxis(YLABEL[i]);
); LogarithmicAxis yAxis = new LogarithmicAxis("Y");
final NumberAxis rangeAxis2 = new LogarithmicAxis("Log(y)"); plot.setRangeAxis(rangeAxis2);
final NumberAxis rangeAxis2 = new LogarithmicAxis("Log(y)"); plot.setRangeAxis(rangeAxis2);