List of usage examples for org.jfree.chart.renderer.xy XYLineAndShapeRenderer setSeriesLinesVisible
public void setSeriesLinesVisible(int series, boolean visible)
From source file:com.al.cellplugin.LineChart.java
/** * Creates a chart./*from w w w .j ava 2s . 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.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 a v a2 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:syg_Wykresy.PanelRysunek_Wykres.java
private void initGUI() { try {//from w w w. j ava 2 s . c om GridLayout thisLayout = new GridLayout(1, 1); thisLayout.setHgap(5); thisLayout.setVgap(5); thisLayout.setColumns(1); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); if (this.wykres) { XYSeries series = new XYSeries("Sygna " + (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY ? "cigy" : "dyskretny")); double punkt; double ta = this.sygnalWyswietlany.gett1(); if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY || sygnalWyswietlany.getPunktyY_wykres().size() <= 0) { punkt = this.sygnalWyswietlany.gett1(); while (ta <= this.sygnalWyswietlany.gett1() + this.sygnalWyswietlany.getd()) { punkt = this.sygnalWyswietlany.wykres_punkty(punkt, ta); this.sygnalWyswietlany.setPunktyY_wykres(punkt); series.add(ta, punkt); if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY) { if (this.sygnalWyswietlany.gettyp() != 9 && this.sygnalWyswietlany.gettyp() != 10) ta = ta + this.sygnalWyswietlany.getkroczek(); else ta = ta + this.sygnalWyswietlany.getkroczek() * 10; } else { if (this.sygnalWyswietlany.gettyp() != 9 && this.sygnalWyswietlany.gettyp() != 10) ta = ta + this.sygnalWyswietlany.getkrok(); else ta = ta + this.sygnalWyswietlany.getkrok() * 10; } } } else if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.DYSKRETNY && sygnalWyswietlany.getPunktyY_wykres().size() > 0) { int iloscProbek = (int) (this.sygnalWyswietlany.getPunktyY_wykres().size()); for (int i = 0; i < iloscProbek; i++) { punkt = this.sygnalWyswietlany.getPunktzindexu(i); series.add(ta, punkt); ta = ta + this.sygnalWyswietlany.getkrok(); } } XYSeriesCollection dataset = new XYSeriesCollection(series); JFreeChart chart; if ((this.sygnalWyswietlany.gettyp() != 9 && this.sygnalWyswietlany.gettyp() != 10) && (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY)) { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); } else { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYPlot plot = chart.getXYPlot(); final XYDotRenderer renderer = new XYDotRenderer(); renderer.setDotHeight(3); renderer.setDotWidth(3); plot.setRenderer(renderer); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } // JOptionPane.showMessageDialog(null, "Rysowanie wykresu...", // "PanelRysunek_Wykres", JOptionPane.INFORMATION_MESSAGE); ChartPanel chartpanel = new ChartPanel(chart); chartpanel.setDomainZoomable(true); this.add(chartpanel); } Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this); } catch (Exception e) { e.printStackTrace(); } }
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:com.marvelution.jira.plugins.hudson.charts.BuildTestResultsRatioChartGenerator.java
/** * {@inheritDoc}// w w w. j ava 2 s .c o m */ @Override public ChartHelper generateChart() { buildMap = new HashMap<Integer, Build>(); final CategoryTableXYDataset dataset = new CategoryTableXYDataset(); for (Build build : builds) { final TestResult results = build.getTestResult(); double percentagePass = 0.0D, percentageFail = 0.0D, percentageSkipped = 0.0D; if (results != null && results.getTotal() > 0) { percentagePass = Double.valueOf(results.getPassed()) / Double.valueOf(results.getTotal()) * 100.0D; percentageFail = Double.valueOf(results.getFailed()) / Double.valueOf(results.getTotal()) * 100.0D; percentageSkipped = Double.valueOf(results.getSkipped()) / Double.valueOf(results.getTotal()) * 100.0D; } dataset.add(Double.valueOf(build.getBuildNumber()), percentagePass, seriesNames[0]); dataset.add(Double.valueOf(build.getBuildNumber()), percentageFail, seriesNames[1]); dataset.add(Double.valueOf(build.getBuildNumber()), percentageSkipped, seriesNames[2]); buildMap.put(Integer.valueOf(build.getBuildNumber()), build); } final JFreeChart chart = ChartFactory.createStackedXYAreaChart("", "", getI18n().getText("hudson.charts.tests"), dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.WHITE); chart.setBorderVisible(false); XYPlot xyPlot = chart.getXYPlot(); xyPlot.setDataset(1, dataset); if (dataset.getItemCount() > 0) { XYLineAndShapeRenderer shapeRenderer = new XYLineAndShapeRenderer(false, true); shapeRenderer.setSeriesShapesVisible(1, false); shapeRenderer.setSeriesLinesVisible(1, false); shapeRenderer.setSeriesShapesVisible(2, false); shapeRenderer.setSeriesLinesVisible(2, false); shapeRenderer.setSeriesShape(0, new Ellipse2D.Double(-3.0D, -3.0D, 6.0D, 6.0D)); shapeRenderer.setSeriesPaint(0, GREEN_PAINT); shapeRenderer.setSeriesShapesFilled(0, true); shapeRenderer.setBaseToolTipGenerator(this); shapeRenderer.setBaseItemLabelFont(ChartDefaults.defaultFont); shapeRenderer.setBaseItemLabelsVisible(false); xyPlot.setRenderer(0, shapeRenderer); StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(); renderer.setSeriesPaint(0, GREEN_PAINT); renderer.setSeriesPaint(1, RED_PAINT); renderer.setSeriesPaint(2, YELLOW_PAINT); renderer.setBaseItemLabelFont(ChartDefaults.defaultFont); renderer.setBaseItemLabelsVisible(false); xyPlot.setRenderer(1, renderer); renderer.setBaseToolTipGenerator(this); } ValueAxis rangeAxis = xyPlot.getRangeAxis(); rangeAxis.setLowerBound(0.0D); rangeAxis.setUpperBound(100.0D); final NumberAxis domainAxis = new NumberAxis(); domainAxis.setLowerBound(Collections.min(buildMap.keySet())); domainAxis.setUpperBound(Collections.max(buildMap.keySet())); final TickUnitSource ticks = NumberAxis.createIntegerTickUnits(); domainAxis.setStandardTickUnits(ticks); xyPlot.setDomainAxis(domainAxis); ChartUtil.setupPlot(xyPlot); return new ChartHelper(chart); }
From source file:ui.FitnessGraph.java
/** * Creates a chart.//w ww . ja v a 2s . 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:org.jcryptool.visual.verifiablesecretsharing.views.ReconstructionChartComposite.java
/** * Creates a chart./*from w ww . j av 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("", // chart // title "", // x axis label "", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend false, // tooltips false // urls ); // XYSplineRenderer -- show data points XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // show no line renderer.setSeriesLinesVisible(0, false); renderer.setSeriesLinesVisible(3, false); // show no points renderer.setSeriesShapesVisible(1, false); // set range of axis NumberAxis domain = (NumberAxis) plot.getDomainAxis(); domain.setRange(-0.1, playerID[playerID.length - 1] + 0.1); domain.setTickUnit(new NumberTickUnit(1)); domain.setVerticalTickLabels(false); // display value NumberFormat format = NumberFormat.getNumberInstance(); format.setMaximumFractionDigits(0); XYItemLabelGenerator generator = new StandardXYItemLabelGenerator( StandardXYItemLabelGenerator.DEFAULT_ITEM_LABEL_FORMAT, format, format); renderer.setBaseItemLabelGenerator(generator); renderer.setBaseItemLabelsVisible(true); plot.setRenderer(renderer); return 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 w w . ja v a2 s . c om*/ plot.setRenderer(contador, indicesRenderer); plot.setDataset(contador, getDataSet(janela)); }
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); }/* w w w .j a v a 2 s . c om*/ 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:syg_package01.PanelRysunek.java
private void initGUI() { try {// w w w .j a va 2 s. c o m GridLayout thisLayout = new GridLayout(1, 1); thisLayout.setHgap(5); thisLayout.setVgap(5); thisLayout.setColumns(1); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); if (this.wykres) { double punkt = this.sygnalWyswietlany.gett1(); double punktZapisu = this.sygnalWyswietlany.gett1(); XYSeries series = new XYSeries("Wykres"); double krok; int typ = this.sygnalWyswietlany.gettyp(); double f = 1.0 / this.sygnalWyswietlany.getT(); double t = this.sygnalWyswietlany.gett1(); // if (this.sygnalWyswietlany.gettyp()==1){ /* * for (double i = this.sygnalWyswietlany.gett1(); i < * this.sygnalWyswietlany.t1+this.sygnalWyswietlany.getts(); * i++){ punkt= this.sygnalWyswietlany.wykres_punkty(punkt, i); * series.add(i, punkt)} ; */ double ta = this.sygnalWyswietlany.gett1(); if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY || sygnalWyswietlany.getPunktyY().size() <= 0) { while (ta <= this.sygnalWyswietlany.gett1() + this.sygnalWyswietlany.getd()) { // punkt=this.sygnalWyswietlany.sygnalS1(); punkt = this.sygnalWyswietlany.wykres_punkty(punkt, ta); this.sygnalWyswietlany.setPunktyY(punkt); // punkt=this.sygnalWyswietlany.sygnalS3(ta); series.add(ta, punkt); if (this.sygnalWyswietlany.gettyp() < 10) ta = ta + this.sygnalWyswietlany.getkroczek(); else ta = ta + this.sygnalWyswietlany.getkroczek() * 10; } } else if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.DYSKRETNY && sygnalWyswietlany.getPunktyY().size() > 0) { int iloscProbek = (int) (this.sygnalWyswietlany.getPunktyY().size()); for (int i = 0; i < iloscProbek; i++) { // punkt=this.sygnalWyswietlany.sygnalS1(); punkt = this.sygnalWyswietlany.getPunktzindexu(i); // punkt=this.sygnalWyswietlany.sygnalS3(ta); series.add(ta, punkt); if (this.sygnalWyswietlany.gettyp() < 10) ta = ta + this.sygnalWyswietlany.getkroczek(); else ta = ta + this.sygnalWyswietlany.getkroczek() * 10; } } // this.sygnalWyswietlany.ustawPunkty(); /* * int liczba= this.sygnalWyswietlany.punktyY.size(); int * liczba2= 0; * * while (liczba2<liczba) { ta= ta+ * this.sygnalWyswietlany.getkroczek(); * series.add(ta,this.sygnalWyswietlany * .getPunktzindexu(liczba2)); * * } */ XYSeriesCollection dataset = new XYSeriesCollection(series); // JFreeChart chart = ChartFactory.createHistogram("Histogram", // "x", "y", dataset, PlotOrientation.VERTICAL, false, false, // false); JFreeChart chart; /* * JFreeChart chart = ChartFactory.createScatterPlot("Wykres", * "t[s]", "Warto", dataset, PlotOrientation.VERTICAL, false, * false, false); */ if ((this.sygnalWyswietlany.gettyp() < 10) || (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY)) { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); } else { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYPlot plot = chart.getXYPlot(); // plot.setBackgroundPaint(Color.lightGray); // plot.setDomainGridlinePaint(Color.white); // plot.setRangeGridlinePaint(Color.white); // final XYLineAndShapeRenderer renderer = new // XYLineAndShapeRenderer(); final XYDotRenderer renderer = new XYDotRenderer(); renderer.setDotHeight(3); renderer.setDotWidth(3); plot.setRenderer(renderer); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } // ChartPanel chartpanel = new ChartPanel(wykres2); ChartPanel chartpanel = new ChartPanel(chart); chartpanel.setDomainZoomable(true); this.add(chartpanel); } Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this); } catch (Exception e) { e.printStackTrace(); } }