List of usage examples for org.jfree.chart.renderer.xy XYItemRenderer setLegendItemLabelGenerator
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator);
From source file:net.sourceforge.processdash.ev.ui.chart.AbstractEVXYChart.java
protected XYItemRenderer createXYLineAndShapeRenderer(boolean lines, boolean shapes) { XYItemRenderer renderer = new XYLineAndShapeRenderer(lines, shapes); renderer.setLegendItemLabelGenerator(new SeriesNameGenerator()); renderer.setBaseToolTipGenerator(getTooltipGenerator()); return renderer; }
From source file:edu.ucla.stat.SOCR.chart.demo.BubbleChartDemo1.java
/** * Creates a chart.//from w w w . ja v a2 s .com * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(XYZDataset dataset) { JFreeChart chart = ChartFactory.createBubbleChart(chartTitle, domainLabel, rangeLabel, dataset, PlotOrientation.VERTICAL, !legendPanelOn, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setForegroundAlpha(0.65f); // SOCRBubbleRenderer renderer = new SOCRBubbleRenderer(dataset); // plot.setRenderer((XYItemRenderer)renderer); XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setLegendItemLabelGenerator(new SOCRScaledBubbleSeriesLabelGenerator(zScale)); // increase the margins to account for the fact that the auto-range // doesn't take into account the bubble size... NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setLowerMargin(0.15); domainAxis.setUpperMargin(0.15); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.XYAreaChartDemo1.java
protected JFreeChart createLegend(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYAreaChart(chartTitle, // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // url );/*from ww w. j a va2 s . com*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); XYItemRenderer renderer = plot.getRenderer(); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.XYAreaChartDemo1.java
/** * Creates a chart./*from w ww . ja va2 s. co m*/ * * @param dataset the dataset. * * @return A chart. */ protected JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYAreaChart(chartTitle, "Domain (X)", "Range (Y)", dataset, PlotOrientation.VERTICAL, !legendPanelOn, // legend true, // tool tips false // URLs ); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setForegroundAlpha(0.65f); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickMarkPaint(Color.black); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickMarkPaint(Color.black); /* XYPointerAnnotation pointer = new XYPointerAnnotation( "Test", 5.0, -500.0, 3.0 * Math.PI / 4.0 ); pointer.setTipRadius(0.0); pointer.setBaseRadius(35.0); pointer.setFont(new Font("SansSerif", Font.PLAIN, 9)); pointer.setPaint(Color.blue); pointer.setTextAnchor(TextAnchor.HALF_ASCENT_RIGHT); plot.addAnnotation(pointer);*/ XYItemRenderer renderer = plot.getRenderer(); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); setXSummary(dataset); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.DifferenceChartDemo1.java
protected JFreeChart createLegend(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, domainLabel, rangeLabel, dataset, !legendPanelOn, // legend true, // tool tips false // URLs );// w w w. jav a 2 s. c om // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); XYItemRenderer renderer = plot.getRenderer(); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.DifferenceChartDemo1.java
/** * Creates a chart./*from w w w. j av a 2 s.c o m*/ * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, domainLabel, rangeLabel, dataset, !legendPanelOn, // legend true, // tool tips false // URLs ); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setRenderer(new XYDifferenceRenderer(Color.green, Color.red, false)); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); XYItemRenderer renderer = plot.getRenderer(); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); ValueAxis domainAxis = new DateAxis("Time"); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot.setDomainAxis(domainAxis); plot.setForegroundAlpha(0.5f); //setXSummary(dataset) X is time; return chart; }
From source file:edu.ucla.stat.SOCR.chart.SuperBubbleChart.java
/** * Creates a chart./* www . j a v a2 s. co m*/ * * @param dataset the dataset. * * @return a chart. */ protected JFreeChart createChart(XYZDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createBubbleChart(chartTitle, // chart titl rangeLabel, // y axis label domainLabel, // x axis label dataset, // data PlotOrientation.VERTICAL, !legendPanelOn, // include legend true, // tooltips false // urls ); XYPlot plot = (XYPlot) chart.getPlot(); plot.setForegroundAlpha(0.65f); XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setLegendItemLabelGenerator(new SOCRXYZSeriesLabelGenerator()); // increase the margins to account for the fact that the auto-range // doesn't take into account the bubble size... NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setLowerMargin(0.15); domainAxis.setUpperMargin(0.15); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.CrosshairDemo1.java
protected JFreeChart createLegend(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, domainLabel, //"Time of Day", rangeLabel, //"Value", dataset, !legendPanelOn, true, false); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); XYItemRenderer renderer = plot.getRenderer(); renderer.setBasePaint(Color.black); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.CrosshairDemo1.java
/** * Creates the demo chart./*from ww w. j a v a 2 s . co m*/ * * @return The chart. */ protected JFreeChart createChart(XYDataset dataset) { JFreeChart chart1 = ChartFactory.createTimeSeriesChart(chartTitle, domainLabel, //"Time of Day", rangeLabel, //"Value", dataset, !legendPanelOn, true, false); chart1.setBackgroundPaint(Color.white); XYPlot plot = chart1.getXYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setDomainCrosshairLockedOnData(false); plot.setRangeCrosshairVisible(false); XYItemRenderer renderer = plot.getRenderer(); renderer.setBasePaint(Color.black); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); // setXSummary(dataset); X is time return chart1; }
From source file:edu.ucla.stat.SOCR.chart.demo.XYBarChartDemo1.java
protected JFreeChart createChart(IntervalXYDataset dataset) { JFreeChart chart = ChartFactory.createXYBarChart(chartTitle, domainLabel, true, rangeLabel, dataset, PlotOrientation.VERTICAL, !legendPanelOn, true, false); // then customise it a little... // chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do")); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot();/* ww w . j ava2s. c om*/ plot.setRenderer(new ClusteredXYBarRenderer()); XYItemRenderer renderer = plot.getRenderer(); StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator("{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0")); renderer.setBaseToolTipGenerator(generator); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); axis.setLowerMargin(0.01); axis.setUpperMargin(0.01); // setXSummary(dataset); X is time return chart; }