List of usage examples for org.jfree.chart JFreeChart getXYPlot
public XYPlot getXYPlot()
From source file:com.compomics.pepshell.view.statistics.JFreeChartPanel.java
static void prettifyChart(JFreeChart chart) { // set title font chart.getTitle().setFont(new Font("Tahoma", Font.BOLD, 12)); if (chart.getPlot() instanceof XYPlot) { XYPlot xYPlot = chart.getXYPlot(); setupPlot(xYPlot);// w ww . j av a 2 s.c o m } else if (chart.getPlot() instanceof CategoryPlot) { CategoryPlot categoryPlot = chart.getCategoryPlot(); setupPlot(categoryPlot); } setShadowVisible(chart, false); }
From source file:com.projity.pm.graphic.chart.ChartHelper.java
public static JFreeChart createBarLineChart(final XYDataset barDataset, final XYDataset lineDataset) { JFreeChart chart = createBarChart(barDataset); XYItemRenderer lineRenderer = new StandardXYItemRenderer(StandardXYItemRenderer.LINES); chart.getXYPlot().setDataset(1, lineDataset); chart.getXYPlot().setRenderer(1, lineRenderer); chart.getXYPlot().setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); chart.getXYPlot().setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // draw the line after the bar so it's superimposed return chart; }
From source file:simulador.controle.GraficoCategorias.java
private static void renderizarGrafico(JFreeChart grafico) { if (DEBUG) {//from w ww . ja v a 2 s .c o m System.out.println("GraficoRadiais.renderizarGrafico"); } XYLineAndShapeRenderer renderizador = new XYLineAndShapeRenderer(); int qtdSeries, aux; qtdSeries = grafico.getXYPlot().getDataset().getSeriesCount(); //aux = (Color.WHITE.getRGB() - Color.BLACK.getRGB())/qtdSeries; aux = 360 / qtdSeries; //System.out.println("aux = "+aux); for (int i = 0; i < qtdSeries; i++) { renderizador.setSeriesPaint(i, new Color(Color.HSBtoRGB((aux * i) / 360.0f, 1.0f, 1.0f))); renderizador.setSeriesStroke(i, new BasicStroke(1.0f)); } //renderizador.setSeriesLinesVisible(0, false); grafico.getXYPlot().setRenderer(renderizador); }
From source file:beadAnalyzer.DrawPoints.java
public static void setSmallUpTriangleShape(final JFreeChart chart, final int seriesIndex) { final XYPlot plot = chart.getXYPlot(); final XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesShape(seriesIndex, ShapeUtils.createUpTriangle(0.5f)); }
From source file:Methods.CalculusSecant.java
public static ChartPanel createChartSecant(XYDataset datasetFunction) {// Method that populates and returns a Chart Pannel object, uses an entering paramether for the equation dataset and a global variable for the iteration points data set datasetPointsSecant();/*from w w w.j a v a 2 s .co m*/ JFreeChart chart = ChartFactory.createXYLineChart("Equation Chart", "X Axys", "Y Axys", datasetFunction, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();//declaring a renderer used to plot more than one datatset on the table plot.setDataset(1, datasetPoints); renderer.setSeriesLinesVisible(1, false); renderer.setSeriesShapesVisible(1, false); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, true); plot.setRenderer(1, renderer); return new ChartPanel(chart); }
From source file:eu.kprod.gui.chart.MwChartFactory.java
public static MwChartPanel createChart(MwConfiguration conf, final XYDataset xyDataset) { final JFreeChart chart; chart = ChartFactory.createTimeSeriesChart(null, null, null, xyDataset, false, true, true); chart.setBackgroundPaint(conf.color.getColor(MwColor.BACKGROUND_COLOR)); chart.setBorderVisible(false);/*from w w w . java 2 s . c om*/ final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(conf.color.getColor(MwColor.BACKGROUND_COLOR)); plot.setDomainGridlinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setRangeGridlinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setDomainGridlinesVisible(false); plot.setDomainCrosshairPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); final DateAxis axis = (DateAxis) plot.getDomainAxis(); // axis.setDateFormatOverride(new SimpleDateFormat("mm''ss''''SSS")); axis.setAxisLineVisible(false); axis.setTickLabelsVisible(false); axis.setTickLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); // force integer display final ValueAxis va = plot.getRangeAxis(); va.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); va.setLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); va.setAxisLinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); va.setTickLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); // va.setRange(-280,280); // va.setFixedAutoRange(560); // va.setLowerBound(-280); // va.setUpperBound(280); // va.setAutoRange(false); va.setRangeWithMargins(-280, 280); final MwChartPanel chartPanel = new MwChartPanel(chart, conf); chartPanel.setMouseWheelEnabled(false); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); return chartPanel; }
From source file:org.multiwii.swingui.gui.chart.MwChartFactory.java
public static MwChartPanel createChart(MwConfiguration conf, final XYDataset xyDataset) { final JFreeChart chart; chart = ChartFactory.createTimeSeriesChart(null, null, null, xyDataset, false, true, true); chart.setBackgroundPaint(conf.color.getColor(MwColor.BACKGROUND_COLOR)); chart.setBorderVisible(false);//from w ww. j a v a 2 s . c o m final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(conf.color.getColor(MwColor.BACKGROUND_COLOR)); plot.setDomainGridlinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setRangeGridlinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setDomainGridlinesVisible(false); plot.setDomainCrosshairPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); final DateAxis axis = (DateAxis) plot.getDomainAxis(); // axis.setDateFormatOverride(new SimpleDateFormat("mm''ss''''SSS")); axis.setAxisLineVisible(false); axis.setTickLabelsVisible(false); axis.setTickLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); // force integer display final ValueAxis va = plot.getRangeAxis(); va.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); va.setLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); va.setAxisLinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); va.setTickLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); // va.setRange(-280,280); // va.setFixedAutoRange(560); // va.setLowerBound(-280); // va.setUpperBound(280); // va.setAutoRange(false); va.setRangeWithMargins(-280, 280); final MwChartPanel chartPanel = new MwChartPanel(chart, conf); chartPanel.setMouseWheelEnabled(false); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); return chartPanel; }
From source file:beadAnalyzer.DrawPoints.java
public static void setColor(final JFreeChart chart, final int seriesIndex, final Color col) { final XYPlot plot = chart.getXYPlot(); final XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(seriesIndex, col); }
From source file:beadAnalyzer.DrawPoints.java
public static void setShape(final JFreeChart chart, final int seriesIndex, final Shape shape) { final XYPlot plot = chart.getXYPlot(); final XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesShape(seriesIndex, shape); }
From source file:beadAnalyzer.DrawPoints.java
public static void setStroke(final JFreeChart chart, final int seriesIndex, final float stroke) { final XYPlot plot = chart.getXYPlot(); final XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesStroke(seriesIndex, new BasicStroke(stroke)); }