List of usage examples for org.jfree.chart ChartPanel setFillZoomRectangle
public void setFillZoomRectangle(boolean flag)
From source file:Graphic.Employee.java
public Employee(List<Float> valeurs, List<String> nom) { dataset = new DefaultCategoryDataset(); for (int i = 0; i < valeurs.size(); i++) { dataset.addValue(valeurs.get(i), "heure travaille", nom.get(i)); }// ww w. ja va2 s . c om diagramme = ChartFactory.createBarChart("Temps travaill par les chauffeurs", "Chauffeur", "Heure travaille", dataset, PlotOrientation.HORIZONTAL, true, true, false); ChartPanel chartPanel = new ChartPanel(diagramme); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseWheelEnabled(true); chartPanel.setPreferredSize(new Dimension(1200, 600)); add(chartPanel); }
From source file:Graphic.Poids.java
public Poids(List<Float> valeurs, List<String> date) { dataset = new XYSeriesCollection(); XYSeries serie = new XYSeries("Courbe"); for (int i = 0; i < valeurs.size(); i++) { serie.add(i, valeurs.get(i));/*w w w .ja v a2 s . c o m*/ } dataset.addSeries(serie); diagramme = ChartFactory.createXYLineChart("Graphe de Poids", "Date", "Poids", dataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(diagramme); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseWheelEnabled(true); chartPanel.setPreferredSize(new Dimension(1200, 600)); add(chartPanel); }
From source file:uom.research.thalassemia.util.BarChartCreator.java
/** * Creates a panel for the demo (used by SuperDemo.java). * * @param pCategoryDataset dataset/*from ww w . j a v a2 s .com*/ * @param pTitle main title * @param psubTitle sub title * @param pxTitle x Axis Title * @param pyTitle y axis title * @return A panel. */ public JPanel createPanel(final CategoryDataset pCategoryDataset, final String pTitle, final String psubTitle, final String pxTitle, final String pyTitle) { mainTitle = pTitle; subTitle = psubTitle; xTitle = pxTitle; yTitle = pyTitle; categoryDataset = pCategoryDataset; JFreeChart chart = createChart(categoryDataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseWheelEnabled(true); return chartPanel; }
From source file:diplomawork.model.ViewForDiagram.java
/** * Creates a panel.// ww w .j a va2s .co m * * @return A panel. */ private ChartPanel createChartPanel() { JFreeChart chart = createChart(createDataset()); ChartPanel panel = new ChartPanel(chart); panel.setFillZoomRectangle(true); panel.setMouseWheelEnabled(true); return panel; }
From source file:pfg.graphic.Chart.java
/** * L'initialisation se fait part afin de ne pas ouvrir une fentre ds qu'on cre un objet *///from ww w. j a v a 2 s . c om private void init() { init = true; JFreeChart chart = ChartFactory.createTimeSeriesChart(title, // title xAxisLabel, // x-axis label yAxisLabel, // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); 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.setRangeCrosshairVisible(true); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); } ChartPanel panel = new ChartPanel(chart); panel.setFillZoomRectangle(true); panel.setMouseWheelEnabled(true); panel.setPreferredSize(new java.awt.Dimension(1024, 600)); setContentPane(panel); pack(); RefineryUtilities.centerFrameOnScreen(this); setVisible(true); }
From source file:NewChart.java
/** * Creates a new demo instance.//from w w w. ja v a 2s . c o m * * @param title the frame title. */ public NewChart(String title) { super(title); CategoryDataset dataset = createDataset(); JFreeChart chart = createChart(dataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseWheelEnabled(true); chartPanel.setPreferredSize(new Dimension(500, 270)); setContentPane(chartPanel); }
From source file:org.hxzon.demo.jfreechart.PieDatasetDemo.java
public PieDatasetDemo(String title) { super(title); ChartPanel chartPanel = new ChartPanel(pieChart); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseWheelEnabled(true); chartPanel.setPreferredSize(new Dimension(500, 270)); getContentPane().add(chartPanel);//from w w w . j a v a 2 s . c om getContentPane().add(new ChartComboBox(chartPanel), BorderLayout.SOUTH); }
From source file:peakml.util.swt.widget.TimePlot.java
public TimePlot(Composite parent, int style) { super(parent, SWT.EMBEDDED | style); // layout/* www . j a va 2 s . c o m*/ setLayout(new FillLayout()); // create the components timeplot = new peakml.util.jfreechart.FastTimePlot("", ""); timeplot.setBackgroundPaint(Color.WHITE); linechart = new JFreeChart("", timeplot); linechart.setBackgroundPaint(Color.WHITE); // add the components // -------------------------------------------------------------------------------- // This uses the SWT-trick for embedding AWT-controls in an SWT-Composite. // 2009-10-17: Tested the SWT setup in jfreechart.experimental - this is still better. try { System.setProperty("sun.awt.noerasebackground", "true"); } catch (NoSuchMethodError error) { ; } java.awt.Frame frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(this); ChartPanel panel = new ChartPanel(linechart, false, false, false, false, false); panel.setFillZoomRectangle(true); panel.setMouseZoomable(true, true); // create a new ChartPanel, without the popup-menu (5x false) frame.add(panel); // -------------------------------------------------------------------------------- }
From source file:Graphic.camion.java
private void initialiser() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); int k = 0;//from w w w . jav a 2 s . c om for (int j = 0; j < categories.size(); j++) { for (int i = 0; i < series.size(); i++) { dataset.addValue(valeurs.get(k), series.get(i), categories.get(j)); k++; } } JFreeChart chart = ChartFactory.createBarChart(titre, // chart title abscisse, // domain axis label ordonnee, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation legende, // include legend true, // tooltips false // URL ); // definition de la couleur de fond //chart.setBackgroundPaint(couleurFond); CategoryPlot plot = (CategoryPlot) chart.getPlot(); //valeur comprise entre 0 et 1 transparence de la zone graphique plot.setBackgroundAlpha(0.9f); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); // pour la couleur des barres pour chaque serie for (int s = 0; s < series.size(); s++) { GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, couleursBarres[s], 0.0f, 0.0f, new Color(0, 40, 70)); renderer.setSeriesPaint(s, gp0); } ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseWheelEnabled(true); add(chartPanel); }
From source file:com.experiments.DynamicDataDemo.java
/** * Constructs a new demonstration application. * // ww w . ja va 2 s . c o m * @param title * the frame title. */ public DynamicDataDemo(final String title) { super(title); this.series = new TimeSeries("Random Data", Millisecond.class); final TimeSeriesCollection dataset = new TimeSeriesCollection(this.series); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(false); final JButton button = new JButton("Add New Data Item"); button.setActionCommand("ADD_DATA"); button.addActionListener(this); final JButton start_button = new JButton("Start adding"); start_button.setActionCommand("START_ADDING"); start_button.addActionListener(this); final JButton stop_button = new JButton("Stop adding"); stop_button.setActionCommand("STOP_ADDING"); stop_button.addActionListener(this); final JPanel button_panel = new JPanel(); button_panel.add(button); button_panel.add(start_button); button_panel.add(stop_button); final JPanel content = new JPanel(new BorderLayout()); content.add(chartPanel); content.add(button_panel, BorderLayout.SOUTH); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(content); }