List of usage examples for org.jfree.chart.plot XYPlot XYPlot
public XYPlot()
XYPlot
instance with no dataset, no axes and no renderer. From source file:org.sonar.server.charts.jruby.TrendsChart.java
public TrendsChart(int width, int height, String localeKey, boolean displayLegend) { super(width, height); this.displayLegend = displayLegend; seriesById = new TreeMap<Long, TimeSeries>(); plot = new XYPlot(); DateAxis dateAxis = new DateAxis(); dateAxis.setDateFormatOverride(/*from www . jav a2s.c o m*/ DateFormat.getDateInstance(DateFormat.SHORT, LocaleUtils.toLocale(localeKey))); plot.setDomainAxis(dateAxis); }
From source file:playground.dgrether.analysis.charts.DgMixedDeltaUtilsModeGroupChart.java
public JFreeChart createChart() { XYPlot plot = new XYPlot(); ValueAxis xAxis = this.axisBuilder.createValueAxis("% of Population Sorted by Income"); ValueAxis yAxis = this.axisBuilder.createValueAxis("Delta Utils [Utils]"); plot.setDomainAxis(xAxis);//from w ww .jav a 2 s . com plot.setRangeAxis(yAxis); //RANGE xAxis.setRange(0.0, 102.0); yAxis.setRange(-0.31, 0.61); DgColorScheme colorScheme = new DgColorScheme(); XYItemRenderer renderer1 = new XYLineAndShapeRenderer(false, true); renderer1.setSeriesPaint(0, colorScheme.COLOR1B); renderer1.setSeriesPaint(1, colorScheme.COLOR2B); renderer1.setSeriesPaint(2, colorScheme.COLOR3B); renderer1.setSeriesPaint(3, colorScheme.COLOR4B); plot.setDataset(0, this.inomeModeChoiceDs); plot.setRenderer(0, renderer1); XYItemRenderer renderer2; renderer2 = new XYLineAndShapeRenderer(true, true); plot.setDataset(1, this.avgDeltaScoreIncomeDs); 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(1, renderer2); JFreeChart chart = new JFreeChart("", plot); chart.setBackgroundPaint(ChartColor.WHITE); chart.getLegend().setItemFont(this.axisBuilder.getAxisFont()); chart.setTextAntiAlias(true); return chart; }
From source file:playground.dgrether.analysis.charts.DgMixedModeSwitcherOnlyDeltaScoreIncomeModeChoiceChart.java
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 ww w. j a va2 s . c om*/ plot.setRangeAxis(yAxis); DgColorScheme colorScheme = new DgColorScheme(); XYItemRenderer renderer1 = new XYLineAndShapeRenderer(false, true); renderer1.setSeriesPaint(0, colorScheme.COLOR3B); renderer1.setSeriesPaint(1, colorScheme.COLOR4B); plot.setDataset(0, this.inomeModeChoiceDs); plot.setRenderer(0, renderer1); XYItemRenderer renderer2; renderer2 = new XYLineAndShapeRenderer(true, true); plot.setDataset(1, this.avgDeltaScoreIncomeDs); for (int i = 2; i <= 3; i++) { renderer2.setSeriesStroke(i - 2, new BasicStroke(2.0f)); renderer2.setSeriesOutlineStroke(i - 2, new BasicStroke(3.0f)); renderer2.setSeriesPaint(i - 2, colorScheme.getColor(i + 1, "a")); } plot.setRenderer(1, renderer2); JFreeChart chart = new JFreeChart("", plot); chart.setBackgroundPaint(ChartColor.WHITE); chart.getLegend().setItemFont(this.axisBuilder.getAxisFont()); chart.setTextAntiAlias(true); return chart; }
From source file:maltcms.ui.fileHandles.serialized.JFCPanel.java
/** * *//*from w w w .j a v a 2s . c o m*/ public JFCPanel() { this.chartPanel = new ChartPanel(new JFreeChart(new XYPlot())); initComponents(); jToggleButton1ActionPerformed(new ActionEvent(this, 0, "")); toggleYAxisFix = new JToggleButton(new AbstractAction("Fix y") { @Override public void actionPerformed(ActionEvent ae) { chartPanel.getChart().getXYPlot().getRangeAxis() .setAutoRange(!chartPanel.getChart().getXYPlot().getRangeAxis().isAutoRange()); } }); this.jToolBar2.add(toggleYAxisFix); toggleXAxisFix = new JToggleButton(new AbstractAction("Fix x") { @Override public void actionPerformed(ActionEvent ae) { chartPanel.getChart().getXYPlot().getDomainAxis() .setAutoRange(!chartPanel.getChart().getXYPlot().getDomainAxis().isAutoRange()); } }); this.jToolBar2.add(toggleXAxisFix); toggleAnnotations = new JToggleButton(new AbstractAction("Annotations") { @Override public void actionPerformed(ActionEvent ae) { if (chartPanel.getChart().getXYPlot().getAnnotations().isEmpty()) { Logger.getLogger(getClass().getName()).info("Adding annotations"); for (XYAnnotation xya : annotations) { chartPanel.getChart().getXYPlot().addAnnotation(xya); } chartPanel.getChart().fireChartChanged(); toggleAnnotations.setSelected(true); } else { Logger.getLogger(getClass().getName()).info("Removing annotations"); List<?> l = chartPanel.getChart().getXYPlot().getAnnotations(); if (!l.isEmpty()) { annotations.clear(); for (Object o : l) { annotations.add((XYAnnotation) o); } } chartPanel.getChart().getXYPlot().clearAnnotations(); } } }); this.jToolBar2.add(toggleAnnotations); toggleAnnotations.setSelected(true); }
From source file:daylightchart.sunchart.chart.SunChart.java
/** * Instantiate the chart for a given location, and given year. * * @param sunChartData//ww w .j a v a 2s . com * Data for the chart, for the entire year */ public SunChart(final SunChartYearData sunChartData) { super(new XYPlot()); this.sunChartData = sunChartData; createChart(); }
From source file:AsymptoticFreedom.AppletAF.java
@Override public void init() { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html *//*from w w w. jav a 2s . co m*/ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(AppletAF.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(AppletAF.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(AppletAF.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(AppletAF.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the applet */ try { java.awt.EventQueue.invokeAndWait(new Runnable() { public void run() { chart = new JFreeChart(new XYPlot()); initComponents(); } }); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:no.met.jtimeseries.netcdf.plot.SimplePlotProvider.java
@Override public XYPlot getPlot(List<NumberPhenomenon> dataList) { XYPlot plot = new XYPlot(); plot.setDomainAxis(getDomainAxis(dataList)); Map<String, Integer> axes = createRangeAxes(dataList, plot); for (int i = 0; i < dataList.size(); i++) { NumberPhenomenon phenomenon = dataList.get(i); //addTimeSeries(plot, phenomenon, i, colors[i % colors.length]); plot.setDataset(i, getTimeSeries(phenomenon)); plot.setRenderer(i, new XYSplineRenderer()); plot.getRenderer(i).setSeriesPaint(0, colors[i % colors.length]); plot.mapDatasetToRangeAxis(i, axes.get(phenomenon.getPhenomenonUnit())); }//from w w w. j av a 2 s .c o m return plot; }
From source file:RutherfordScattering.RutherfordScattering.java
/** * Initializes the applet RutherfordScattering *//*from w ww . ja v a2 s . co m*/ @Override public void init() { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(RutherfordScattering.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(RutherfordScattering.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(RutherfordScattering.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(RutherfordScattering.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the applet */ try { java.awt.EventQueue.invokeAndWait(new Runnable() { public void run() { initComponents(); chart = new JFreeChart(new XYPlot()); } }); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:playground.dgrether.linkanalysis.DgCountPerIterationGraph.java
public JFreeChart createChart() { XYPlot plot = new XYPlot(); ValueAxis xAxis = this.axisBuilder.createValueAxis("Iteration"); xAxis.setRange(this.controllerConfig.getFirstIteration(), this.controllerConfig.getLastIteration() + 2); ValueAxis yAxis = this.axisBuilder.createValueAxis("Trips"); // yAxis.setRange(-0.05, 0.3); // xAxis.setVisible(false); // xAxis.setFixedAutoRange(1.0); plot.setDomainAxis(xAxis);// w w w. j a v a2s. co m plot.setRangeAxis(yAxis); plot.setDataset(0, this.dataset); DgColorScheme colorScheme = new DgColorScheme(); XYItemRenderer renderer2; renderer2 = new XYLineAndShapeRenderer(true, true); for (int i = 0; i < this.dataset.getSeriesCount(); i++) { renderer2.setSeriesItemLabelsVisible(i, true); renderer2.setSeriesOutlineStroke(i, new BasicStroke(3.0f)); renderer2.setSeriesStroke(i, new BasicStroke(2.0f)); renderer2.setSeriesPaint(i, colorScheme.getColor(i + 1, "a")); } // renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator); // renderer2.setSeriesStroke(1, new BasicStroke(2.0f)); // renderer2.setSeriesOutlineStroke(1, new BasicStroke(3.0f)); // renderer2.setSeriesPaint(1, colorScheme.getColor(2, "a")); plot.setRenderer(0, renderer2); JFreeChart chart = new JFreeChart("", plot); chart.setBackgroundPaint(ChartColor.WHITE); chart.getLegend().setItemFont(this.axisBuilder.getAxisFont()); chart.setTextAntiAlias(true); // chart.removeLegend(); return chart; }
From source file:com.ivli.roim.controls.VOILUTPanel.java
public VOILUTPanel(LUTControl aP) { iCurveName = java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle").getString("VOILUTPANEL.VOI_LUT"); iLUT = LUTControl.create(aP);/*from ww w . j a va 2 s . co m*/ aP.addWindowChangeListener(this); initComponents(); XYPlot plot = new XYPlot(); plot.setDataset(0, makeLUTCurve()); plot.setRenderer(0, new XYSplineRenderer()); ((XYSplineRenderer) plot.getRenderer()).setShapesVisible(false); plot.setRangeAxis(0, new NumberAxis(java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle") .getString("VOILUTPANEL.AXIS_LABEL_VOI_CURVE"))); XYSeriesCollection col2 = new XYSeriesCollection(); col2.addSeries(makeHistogram()); plot.setDataset(1, col2); plot.setRenderer(1, new XYBarRenderer()); plot.setRangeAxis(1, new NumberAxis(java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle") .getString("VOILUTPANEL.AXIS_LABEL_IMAGE_SPACE"))); plot.mapDatasetToRangeAxis(1, 1); plot.setDomainAxis(new NumberAxis(java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle") .getString("VOILUTPANEL.AXIS_LABEL_IMAGE_HISTOGRAM"))); plot.setRangeGridlinesVisible(true); plot.setDomainGridlinesVisible(true); // change the rendering order so the primary dataset appears "behind" the // other datasets... plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); JFreeChart jfc = new JFreeChart(plot); jfc.setBorderVisible(true); jfc.removeLegend(); iPanel = new ChartPanel(jfc); iPanel.setSize(jPanel1.getPreferredSize()); jPanel1.add(iPanel);//, java.awt.BorderLayout.CENTER); iLUT.setSize(jPanel2.getPreferredSize()); jPanel2.add(iLUT); iLabelMin.setText(String.format("%.0f", iLUT.getView().getMin())); iLabelMax.setText(String.format("%.0f", iLUT.getView().getMax())); validate(); }