List of usage examples for org.jfree.chart JFreeChart setAntiAlias
public void setAntiAlias(boolean flag)
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a bar chart./*from ww w . j a v a 2s. co m*/ * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @return JfreeChart instance. */ public JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.01); domainAxis.setUpperMargin(0.01); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); return chart; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates an area chart.// w w w. j ava 2s . com * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @return JfreeChart instance. */ public JFreeChart createAreaChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset) { JFreeChart chart = ChartFactory.createAreaChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0); domainAxis.setUpperMargin(0); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); AreaRenderer renderer = (AreaRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); return chart; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a line chart.//w ww . ja va 2s . com * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @param includeZero * True when zero shall be included to the axis range. * @return JfreeChart instance. */ public JFreeChart createLineChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, boolean includeZero, boolean drawShapes) { JFreeChart chart = ChartFactory.createLineChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.025); domainAxis.setUpperMargin(0.025); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(includeZero); LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setBaseShapesVisible(drawShapes); renderer.setBaseShapesFilled(true); return chart; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a line chart.// ww w .j a va 2 s . com * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @param includeZero * True when zero shall be included to the axis range. * @return JfreeChart instance. */ public JFreeChart createXYLineChart(String title, String categoryAxisLabel, String valueAxisLabel, XYDataset dataset, boolean includeZero, boolean drawShapes) { JFreeChart chart = ChartFactory.createXYLineChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); XYPlot plot = chart.getXYPlot(); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.025); domainAxis.setUpperMargin(0.025); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(includeZero); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setBaseShapesVisible(drawShapes); renderer.setBaseShapesFilled(true); return chart; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a line chart./* w ww . ja v a 2s. co m*/ * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @param includeZero * True when zero shall be included to the axis range. * @return JfreeChart instance. */ public JFreeChart createXYLineSplineChart(String title, String categoryAxisLabel, String valueAxisLabel, XYDataset dataset, boolean includeZero, boolean drawShapes) { JFreeChart chart = ChartFactory.createXYLineChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); XYPlot plot = chart.getXYPlot(); plot.setBackgroundAlpha(0.4f); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.025); domainAxis.setUpperMargin(0.025); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(includeZero); plot.setRenderer(new XYSplineRenderer(100)); XYSplineRenderer renderer = (XYSplineRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setBaseShapesVisible(drawShapes); renderer.setBaseShapesFilled(true); return chart; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a XY bar chart.// w w w . j a va 2s.c o m * * @param title * @param categoryAxisLabel * @param valueAxisLabel * @param dataset * @param includeZero * @param shadow * @return */ public JFreeChart createXYBarChart(String title, String categoryAxisLabel, String valueAxisLabel, IntervalXYDataset dataset, boolean includeZero, boolean shadow) { JFreeChart chart = ChartFactory.createXYBarChart(title, categoryAxisLabel, false, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); XYPlot plot = chart.getXYPlot(); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.025); domainAxis.setUpperMargin(0.025); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(includeZero); XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setShadowVisible(shadow); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); return chart; }
From source file:com.mergano.core.AreaChart.java
private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createAreaChart("Order statistic", // chart title "Days", // domain axis label "Order Average", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend false, // tooltips false // urls );/*from w w w . ja va2s .c o m*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setAnchor(StandardLegend.SOUTH); chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); CategoryPlot plot = chart.getCategoryPlot(); plot.getRenderer().setSeriesPaint(0, new Color(0, 191, 165)); plot.setForegroundAlpha(0.75f); plot.setBackgroundPaint(Color.white); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); // disable this plot.setDomainGridlinesVisible(false); plot.setDomainGridlinePaint(new Color(240, 240, 240)); plot.setRangeGridlinesVisible(false); plot.setRangeGridlinePaint(new Color(240, 240, 240)); plot.setDomainCrosshairPaint(Color.MAGENTA); plot.setRangeCrosshairPaint(Color.CYAN); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); domainAxis.addCategoryLabelToolTip("Type 1", "The first type."); domainAxis.addCategoryLabelToolTip("Type 2", "The second type."); domainAxis.addCategoryLabelToolTip("Type 3", "The third type."); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLabelAngle(0 * Math.PI / 2.0); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:greenapi.ui.charts.LineChartPanelSupport.java
@Override public JFreeChart createChart() { this.timeSeries = new TimeSeriesCollection(); this.dataset = new TranslatingXYDataset(this.timeSeries); JFreeChart chart = ChartFactory.createTimeSeriesChart(this.getTitle(), null, this.getAxisLabel(), this.dataset, true, true, false); chart.setBackgroundPaint(getBackground()); XYPlot xyPlot = chart.getXYPlot();// w w w. j av a2 s . c om xyPlot.setOrientation(PlotOrientation.VERTICAL); xyPlot.setBackgroundPaint(Color.WHITE); xyPlot.setDomainGridlinePaint(Color.BLACK.darker()); xyPlot.setRangeGridlinePaint(Color.BLACK.darker()); xyPlot.setAxisOffset(new RectangleInsets(5.0D, 5.0D, 5.0D, 5.0D)); xyPlot.setDomainCrosshairLockedOnData(true); xyPlot.setRangeCrosshairVisible(true); chart.setAntiAlias(true); return chart; }
From source file:net.sf.eclipsecs.ui.stats.views.GraphStatsView.java
/** * Cre le graphe JFreeChart./*from w w w .j a v a2 s . co m*/ * * @param piedataset * : la source de donnes afficher * @return le diagramme */ private JFreeChart createChart(GraphPieDataset piedataset) { JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false); jfreechart.setAntiAlias(true); jfreechart.setTextAntiAlias(true); PiePlot pieplot3d = (PiePlot) jfreechart.getPlot(); pieplot3d.setInsets(new RectangleInsets(0, 0, 0, 0)); final double angle = 290D; pieplot3d.setStartAngle(angle); pieplot3d.setDirection(Rotation.CLOCKWISE); final float foreground = 0.5F; pieplot3d.setForegroundAlpha(foreground); pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay); pieplot3d.setCircular(true); pieplot3d.setOutlinePaint(null); pieplot3d.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); pieplot3d.setLabelGap(0.02); pieplot3d.setLabelOutlinePaint(null); pieplot3d.setLabelShadowPaint(null); pieplot3d.setLabelBackgroundPaint(Color.WHITE); pieplot3d.setBackgroundPaint(Color.WHITE); pieplot3d.setInteriorGap(0.02); pieplot3d.setMaximumLabelWidth(0.20); return jfreechart; }
From source file:com.tocea.scertify.eclipse.scertifycode.ui.stats.views.GraphStatsView.java
/** * Cre le graphe JFreeChart./*ww w . ja v a 2s . c o m*/ * * @param piedataset * : la source de donnes afficher * @return le diagramme */ private JFreeChart createChart(final GraphPieDataset piedataset) { final JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false); jfreechart.setAntiAlias(true); jfreechart.setTextAntiAlias(true); final PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot(); // pieplot3d.setInsets(new RectangleInsets(0, 0, 0, 0)); final double angle = 290D; pieplot3d.setStartAngle(angle); pieplot3d.setDirection(Rotation.CLOCKWISE); final float foreground = 0.5F; pieplot3d.setForegroundAlpha(foreground); pieplot3d.setBackgroundAlpha(0.0F); pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay); pieplot3d.setOutlinePaint(null); pieplot3d.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); pieplot3d.setLabelGap(0.02); pieplot3d.setLabelOutlinePaint(null); pieplot3d.setLabelShadowPaint(null); pieplot3d.setLabelBackgroundPaint(Color.WHITE); pieplot3d.setBackgroundPaint(Color.WHITE); pieplot3d.setInteriorGap(0.02); pieplot3d.setMaximumLabelWidth(0.20); return jfreechart; }