List of usage examples for org.jfree.chart.plot XYPlot setRenderer
public void setRenderer(int index, XYItemRenderer renderer)
From source file:com.android.ddmuilib.log.event.DisplaySync.java
/** * Resets the display.//from w w w. j a v a 2 s .c o m */ @Override void resetUI() { super.resetUI(); XYPlot xyPlot = mChart.getXYPlot(); XYBarRenderer br = new XYBarRenderer(); mDatasetsSync = new TimePeriodValues[NUM_AUTHS]; @SuppressWarnings("unchecked") List<String> mTooltipsSyncTmp[] = new List[NUM_AUTHS]; mTooltipsSync = mTooltipsSyncTmp; mTooltipGenerators = new CustomXYToolTipGenerator[NUM_AUTHS]; TimePeriodValuesCollection tpvc = new TimePeriodValuesCollection(); xyPlot.setDataset(tpvc); xyPlot.setRenderer(0, br); XYLineAndShapeRenderer ls = new XYLineAndShapeRenderer(); ls.setBaseLinesVisible(false); mDatasetsSyncTickle = new TimeSeries[NUM_AUTHS]; TimeSeriesCollection tsc = new TimeSeriesCollection(); xyPlot.setDataset(1, tsc); xyPlot.setRenderer(1, ls); mDatasetError = new TimeSeries("Errors", FixedMillisecond.class); xyPlot.setDataset(2, new TimeSeriesCollection(mDatasetError)); XYLineAndShapeRenderer errls = new XYLineAndShapeRenderer(); errls.setBaseLinesVisible(false); errls.setSeriesPaint(0, Color.RED); xyPlot.setRenderer(2, errls); for (int i = 0; i < NUM_AUTHS; i++) { br.setSeriesPaint(i, AUTH_COLORS[i]); ls.setSeriesPaint(i, AUTH_COLORS[i]); mDatasetsSync[i] = new TimePeriodValues(AUTH_NAMES[i]); tpvc.addSeries(mDatasetsSync[i]); mTooltipsSync[i] = new ArrayList<String>(); mTooltipGenerators[i] = new CustomXYToolTipGenerator(); br.setSeriesToolTipGenerator(i, mTooltipGenerators[i]); mTooltipGenerators[i].addToolTipSeries(mTooltipsSync[i]); mDatasetsSyncTickle[i] = new TimeSeries(AUTH_NAMES[i] + " tickle", FixedMillisecond.class); tsc.addSeries(mDatasetsSyncTickle[i]); ls.setSeriesShape(i, ShapeUtilities.createUpTriangle(2.5f)); } }
From source file:be.nbb.demetra.dfm.output.simulation.RMSEGraphView.java
private JFreeChart createChart() { JFreeChart result = ChartFactory.createXYBarChart("", "", false, "", Charts.emptyXYDataset(), PlotOrientation.VERTICAL, false, false, false); result.setPadding(TsCharts.CHART_PADDING); result.getTitle().setFont(TsCharts.CHART_TITLE_FONT); XYPlot plot = result.getXYPlot(); plot.setDataset(DFM_INDEX, Charts.emptyXYDataset()); plot.setRenderer(DFM_INDEX, dfmRenderer); plot.mapDatasetToDomainAxis(DFM_INDEX, 0); plot.mapDatasetToRangeAxis(DFM_INDEX, 0); plot.setDataset(ARIMA_INDEX, Charts.emptyXYDataset()); plot.setRenderer(ARIMA_INDEX, arimaRenderer); plot.mapDatasetToDomainAxis(ARIMA_INDEX, 0); plot.mapDatasetToRangeAxis(ARIMA_INDEX, 0); plot.setDataset(STDEV_INDEX, Charts.emptyXYDataset()); plot.setRenderer(STDEV_INDEX, stdevRenderer); plot.mapDatasetToDomainAxis(STDEV_INDEX, 0); plot.mapDatasetToRangeAxis(STDEV_INDEX, 0); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); NumberAxis rangeAxis = new NumberAxis(); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setTickLabelPaint(TsCharts.CHART_TICK_LABEL_COLOR); plot.setRangeAxis(rangeAxis);/*from ww w .j a v a 2s . co m*/ NumberAxis domainAxis = new NumberAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickLabelPaint(TsCharts.CHART_TICK_LABEL_COLOR); plot.setDomainAxis(domainAxis); return result; }
From source file:playground.dgrether.analysis.charts.DgAvgDeltaUtilsModeGroupChart.java
@Override public JFreeChart createChart() { XYPlot plot = new XYPlot(); ValueAxis xAxis = this.axisBuilder.createValueAxis("Income [Chf / Year]"); ValueAxis yAxis = this.axisBuilder.createValueAxis("Delta Utils [Utils]"); plot.setDomainAxis(xAxis);/*from w ww. j av a 2s .co m*/ plot.setRangeAxis(yAxis); DgColorScheme colorScheme = new DgColorScheme(); XYItemRenderer renderer2; renderer2 = new XYLineAndShapeRenderer(true, true); plot.setDataset(0, this.dataset); for (int i = 0; i <= 3; i++) { renderer2.setSeriesStroke(i, new BasicStroke(2.0f)); renderer2.setSeriesOutlineStroke(i, new BasicStroke(3.0f)); renderer2.setSeriesPaint(i, colorScheme.getColor(i + 1, "a")); } plot.setRenderer(0, renderer2); JFreeChart chart = new JFreeChart("", plot); chart.setBackgroundPaint(ChartColor.WHITE); chart.getLegend().setItemFont(this.axisBuilder.getAxisFont()); chart.setTextAntiAlias(true); return chart; }
From source file:RLCcircuit.RLCcircuitJFrame.java
public JFreeChart getResultChart() { XYSeries series1 = new XYSeries("Resistor"); XYSeries series2 = new XYSeries("Inductor"); XYSeries series3 = new XYSeries("Capacitor"); for (double i = 0 + time; i < 100 + time; i++) { ValueCaculate(i / 1000.);// w w w . ja v a 2 s. c o m series1.add(i, Rvoltage); } for (double i = 0 + time; i < 100 + time; i++) { ValueCaculate(i / 1000.); series2.add(i, Lvoltage); } for (double i = 0 + time; i < 100 + time; i++) { ValueCaculate(-i / 1000.); series3.add(i, Cvoltage); } XYSeriesCollection data1 = new XYSeriesCollection(series1); XYSeriesCollection data2 = new XYSeriesCollection(series2); XYSeriesCollection data3 = new XYSeriesCollection(series3); final JFreeChart chart = ChartFactory.createXYLineChart("Time-Voltage Graph", "Time", "Voltage", data1, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(null); XYPlot plot = chart.getXYPlot(); plot.setDataset(1, data2); plot.setDataset(2, data3); XYLineAndShapeRenderer Renderer1 = new XYLineAndShapeRenderer(); XYLineAndShapeRenderer Renderer2 = new XYLineAndShapeRenderer(); XYLineAndShapeRenderer Renderer3 = new XYLineAndShapeRenderer(); plot.setRenderer(0, Renderer1); plot.setRenderer(1, Renderer2); plot.setRenderer(2, Renderer3); Renderer1.setSeriesShapesVisible(0, false); Renderer2.setSeriesShapesVisible(0, false); Renderer3.setSeriesShapesVisible(0, false); plot.setBackgroundPaint(Color.black); plot.getDomainAxis().setVisible(false); plot.getRangeAxis().setVisible(false); plot.getRangeAxis().setRange(-20, 20); //chart.plotChanged(new PlotChangeEvent(plot)); return chart; }
From source file:br.usp.icmc.gazetteer.SemanticSearchTest.Grafico.java
public ChartPanel interpolado(int index) { // create the chart... JFreeChart graf = ChartFactory.createXYLineChart("Interpolado", // chart title "Recall", // x axis label "Precision", // y axis label createDatasetInterpoled(index), // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );/*from w w w.j a v a 2 s .c o m*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... graf.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) graf.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(false); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(true, false); plot.setRenderer(1, renderer2); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. ChartPanel myChartPanel = new ChartPanel(graf, true); return myChartPanel; }
From source file:br.usp.icmc.gazetteer.SemanticSearchTest.Grafico.java
public ChartPanel media11() { // create the chart... JFreeChart graf = ChartFactory.createXYLineChart("Media 11 Pontos", // chart title "Recall", // x axis label "Precision", // y axis label createDatasetOnze(), // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );/* w w w . j a va 2 s.co m*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... graf.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) graf.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(false); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(true, false); plot.setRenderer(1, renderer2); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. ChartPanel myChartPanel = new ChartPanel(graf, true); return myChartPanel; }
From source file:br.usp.icmc.gazetteer.SemanticSearchTest.Grafico.java
public ChartPanel media11(int index) { // create the chart... JFreeChart graf = ChartFactory.createXYLineChart("Media 11 pontos", // chart title "Recall", // x axis label "Precision", // y axis label createDatasetOnze(index), // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );//from w ww . j ava 2 s . c o m // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... graf.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) graf.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(false); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(true, false); plot.setRenderer(1, renderer2); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. ChartPanel myChartPanel = new ChartPanel(graf, true); return myChartPanel; }
From source file:org.jfree.chart.demo.AnnotationDemo2.java
private static JFreeChart createChart() { XYDataset xydataset = createDataset1(); JFreeChart jfreechart = ChartFactory.createXYLineChart("Annotation Demo 2", "Date", "Price Per Unit", xydataset, PlotOrientation.VERTICAL, false, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setAutoRangeIncludesZero(false); NumberAxis numberaxis1 = new NumberAxis("Secondary"); numberaxis1.setAutoRangeIncludesZero(false); xyplot.setRangeAxis(1, numberaxis1); xyplot.setDataset(1, createDataset2()); xyplot.mapDatasetToRangeAxis(1, 1);/*from w w w . j av a 2 s.co m*/ XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer(); xylineandshaperenderer.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); XYPointerAnnotation xypointerannotation = new XYPointerAnnotation("Annotation 1 (2.0, 167.3)", 2D, 167.30000000000001D, -0.78539816339744828D); xypointerannotation.setTextAnchor(TextAnchor.BOTTOM_LEFT); xypointerannotation.setPaint(Color.red); xypointerannotation.setArrowPaint(Color.red); xylineandshaperenderer.addAnnotation(xypointerannotation); XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer(true, true); xylineandshaperenderer1.setSeriesPaint(0, Color.black); xylineandshaperenderer.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); XYPointerAnnotation xypointerannotation1 = new XYPointerAnnotation("Annotation 2 (15.0, 613.2)", 15D, 613.20000000000005D, 1.5707963267948966D); xypointerannotation1.setTextAnchor(TextAnchor.TOP_CENTER); xylineandshaperenderer1.addAnnotation(xypointerannotation1); xyplot.setRenderer(1, xylineandshaperenderer1); LegendTitle legendtitle = new LegendTitle(xylineandshaperenderer); LegendTitle legendtitle1 = new LegendTitle(xylineandshaperenderer1); BlockContainer blockcontainer = new BlockContainer(new BorderArrangement()); blockcontainer.add(legendtitle, RectangleEdge.LEFT); blockcontainer.add(legendtitle1, RectangleEdge.RIGHT); blockcontainer.add(new EmptyBlock(2000D, 0.0D)); CompositeTitle compositetitle = new CompositeTitle(blockcontainer); compositetitle.setPosition(RectangleEdge.BOTTOM); jfreechart.addSubtitle(compositetitle); return jfreechart; }
From source file:br.usp.icmc.gazetteer.SemanticSearchTest.Grafico.java
/***************************************** INDIVIDUAIS **************************************************/ public ChartPanel precisionrecall(int index) { // create the chart... JFreeChart graf = ChartFactory.createXYLineChart("Precision Recall", // chart title "Recall", // x axis label "Precision", // y axis label createDatasetprecision(index), // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );/*from w ww . j a v a 2 s. c o m*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... graf.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) graf.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(false); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(true, false); plot.setRenderer(1, renderer2); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. ChartPanel myChartPanel = new ChartPanel(graf, true); return myChartPanel; }
From source file:grafix.graficos.indices.Indice.java
public void plotar(final XYPlot plot, final JanelaGraficos janela, final int contador) { XYLineAndShapeRenderer indicesRenderer = new XYLineAndShapeRenderer(); indicesRenderer.setSeriesLinesVisible(0, isTracoContinuo()); indicesRenderer.setSeriesShapesVisible(0, !isTracoContinuo()); indicesRenderer.setSeriesShape(0, ShapeUtilities.createDiamond(1.5f)); indicesRenderer.setStroke(new BasicStroke(getEspessura() * 0.5f)); indicesRenderer.setToolTipGenerator(new IndiceToolTipGenerator(this)); indicesRenderer.setPaint(getCor());/*from w w w.j a v a2s . c o m*/ plot.setRenderer(contador, indicesRenderer); plot.setDataset(contador, getDataSet(janela)); }