List of usage examples for org.jfree.chart.renderer.xy XYLineAndShapeRenderer setSeriesShapesVisible
public void setSeriesShapesVisible(int series, Boolean flag)
From source file:com.al.cellplugin.LineChart.java
/** * Creates a chart.// w w w.j a v a 2 s. c om * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("Line Chart of Product SVD [V]", // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); //rangeAxis.setTickLabelsVisible(true); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:model.LineChart.java
/** * Creates a chart.//from w w w.j av a 2 s .c o m * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset, final int variableOption, final String machine) { String title = ""; switch (variableOption) { case 0: title = "Quantity"; break; case 1: title = "Size"; break; default: title = "Type"; break; } // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart(title + " Line Chart: " + machine, // chart title title, // x axis label "Time", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:web.diva.server.model.LineChartGenerator.java
/** * Creates a chart.//from w w w . j a v a2 s. com * * @param dataset the data for the chart. * @param lcr the line chart result * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset, String[] colors, String[] columnIds, int[] selection) { final JFreeChart chart = ChartFactory.createXYLineChart("", // chart title "", // x axis label "", // y axis label dataset, // data PlotOrientation.VERTICAL, false, // include legend false, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.WHITE); plot.setRangeGridlinePaint(Color.WHITE); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); if (selection == null) { for (int x = 0; x < colors.length; x++) { renderer.setSeriesShapesVisible(x, false); renderer.setSeriesPaint(x, imgGenerator.hex2Rgb(colors[x])); } } else { for (int x = 0; x < selection.length; x++) { renderer.setSeriesShapesVisible(x, false); renderer.setSeriesPaint(x, imgGenerator.hex2Rgb(colors[selection[x]])); } } plot.setRenderer(renderer); SymbolAxis rangeAxis = new SymbolAxis("", columnIds); rangeAxis.setGridBandsVisible(false); rangeAxis.setVerticalTickLabels(true); rangeAxis.setVisible(true); // rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 1)); rangeAxis.setFixedDimension(51.0); boolean auto = rangeAxis.getAutoRangeIncludesZero(); rangeAxis.setAutoRangeIncludesZero(true ^ auto); rangeAxis.setTickUnit(new NumberTickUnit(1)); rangeAxis.setRange(0, columnIds.length); plot.setDomainAxis(rangeAxis); return chart; }
From source file:org.jtotus.gui.graph.GraphPrinter.java
private XYItemRenderer getDefaultLine() { XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(1, true); renderer.setSeriesShapesVisible(1, true); return renderer; }
From source file:eremeykin.pete.plotter.CartesianPlotterTopComponent.java
JFreeChart createChart(XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart(" ?", // chart title "???", // x axis label "", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );// w w w. j a v a 2 s .co m chart.setTitle(new org.jfree.chart.title.TextTitle(" ?", new java.awt.Font("Arial", java.awt.Font.PLAIN, 16))); chart.setBackgroundPaint(Color.white); plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.DARK_GRAY); plot.setRangeGridlinePaint(Color.DARK_GRAY); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesShapesVisible(1, false); renderer.setSeriesShapesVisible(2, false); renderer.setSeriesShapesVisible(3, false); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.BLUE); renderer.setSeriesPaint(2, Color.BLUE); renderer.setSeriesPaint(3, Color.BLACK); // renderer.setSeriesStroke(1, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] {6.0f, 6.0f}, 0.0f )); plot.setRenderer(renderer); return chart; }
From source file:org.jgrasstools.gears.utils.chart.Scatter.java
private void setShapeLinesVisibility(XYPlot plot) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); int seriesCount = plot.getSeriesCount(); for (int i = 0; i < seriesCount; i++) { renderer.setSeriesShapesVisible(i, showShapes); renderer.setSeriesLinesVisible(i, showLines); }/*from w ww .ja va2 s.com*/ }
From source file:ui.FitnessGraph.java
/** * Creates a chart./*w ww . j a v a2s . co m*/ * * @param dataset * the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createScatterPlot("Fitness v generation", // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // renderer.setSeriesShape(0, new Ellipse2D.Float(1.0f, 1.0f, 1.0f, // 1.0f)); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, false); // renderer.setSeriesStroke(1, new BasicStroke(0.01f)); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRange(true); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:no.ntnu.mmfplanner.ui.graph.SaNpvChart.java
/** * Creates the chart/*from w w w . j a va2s . c o m*/ */ private void createChart() { JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title "Period", // x axis label "Discounted Cash", // y axis label null, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); XYPlot plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setLowerMargin(0.0); plot.getDomainAxis().setUpperMargin(0.0); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getDomainAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); setChart(chart); setMouseZoomable(false); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setLegendLine(new Rectangle2D.Double(0.0, 0.0, 6.0, 0.0)); renderer.setUseFillPaint(true); // the x=0 line renderer.setSeriesPaint(0, Color.GRAY); renderer.setSeriesShapesVisible(0, false); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesVisibleInLegend(0, new Boolean(false)); plot.setRenderer(renderer); }
From source file:br.prof.salesfilho.oci.image.GraphicBuilder.java
public void createChart() { chart = ChartFactory.createXYLineChart(this.title, this.xLabel, this.yLabel, this.collectionDataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); List<XYSeries> listSeries = collectionDataset.getSeries(); for (int i = 0; i < listSeries.size(); i++) { renderer.setSeriesLinesVisible(i, true); renderer.setSeriesShapesVisible(i, true); renderer.setSeriesShapesFilled(i, false); }//from w w w . jav a 2s . co m plot.setRenderer(renderer); plot.setRangePannable(true); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); chartPanel.setChart(chart); }
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 ww.j a v a 2s . com plot.setRenderer(contador, indicesRenderer); plot.setDataset(contador, getDataSet(janela)); }