List of usage examples for org.jfree.chart JFreeChart addProgressListener
public void addProgressListener(ChartProgressListener listener)
From source file:gchisto.gui.panels.gcstats.BreakdownChartPanelSingle.java
/** * It creates a chart for the given dataset and adds the chart to the panel. * * @param dataset The dataset that will provide the values for the chart. *//*w ww . j a va 2s . c o m*/ private void addChart() { JFreeChart chart = ChartFactory.createPieChart(getTitle(), dataset, false, true, false); chart.addProgressListener(locker); PiePlot plot = (PiePlot) chart.getPlot(); plot.setToolTipGenerator(dataset); mainPanel().add(BorderLayout.CENTER, new ChartPanel(chart)); }
From source file:gchisto.gui.panels.gcstats.MetricChartPanel.java
/** * It creates a chart for the given dataset and adds the chart to the panel. * * @param dataset The dataset that will provide the values for the chart. *///from ww w. j av a 2 s . c om private void addChart() { JFreeChart chart = ChartFactory.createBarChart3D(getTitle(), null, "Time" + unitSuffix(), dataset, PlotOrientation.VERTICAL, true, true, false); chart.addProgressListener(locker); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setToolTipGenerator(dataset); mainPanel().add(BorderLayout.CENTER, new ChartPanel(chart)); }
From source file:gchisto.gui.panels.gcdistribution.ChartPanelSingle.java
/** * It creates a chart for the given dataset and adds the chart to the panel. * * @param dataset The dataset that will provide the values for the chart. *//*from w w w .j ava 2 s .c o m*/ private void addChart() { JFreeChart chart = ChartFactory.createXYBarChart(getTitle(), "Buckets (sec)", false, "Count", dataset, PlotOrientation.VERTICAL, true, true, false); chart.addProgressListener(locker); XYPlot plot = (XYPlot) chart.getPlot(); XYItemRenderer renderer = plot.getRenderer(); renderer.setToolTipGenerator(dataset); groupActivatingPanel = new GroupActivatingPanel(dataset, locker); org.jfree.chart.ChartPanel chartPanel = new org.jfree.chart.ChartPanel(chart); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, groupActivatingPanel, chartPanel); splitPane.setDividerLocation(200); mainPanel().add(BorderLayout.CENTER, splitPane); }
From source file:gchisto.gui.panels.gctimeline.ChartPanel.java
/** * It creates a chart for the given dataset and adds the chart to the panel. * * @param dataset The dataset that will provide the values for the chart. *//*from w ww .java 2 s . co m*/ private void addChart() { JFreeChart chart = ChartFactory.createXYBarChart(getTitle(), "Elapsed Time (sec)", false, "Time" + unitSuffix(), dataset, PlotOrientation.VERTICAL, true, true, false); chart.addProgressListener(locker); XYPlot plot = (XYPlot) chart.getPlot(); XYItemRenderer renderer = plot.getRenderer(); renderer.setToolTipGenerator(dataset); groupActivatingTable = new GroupActivatingPanel(dataset, locker); org.jfree.chart.ChartPanel chartPanel = new org.jfree.chart.ChartPanel(chart); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, groupActivatingTable, chartPanel); splitPane.setDividerLocation(200); mainPanel().add(BorderLayout.CENTER, splitPane); }
From source file:gchisto.gui.panels.gcstats.BreakdownChartPanelMulti.java
/** * It creates a chart for the given dataset and adds the chart to the panel. * * @param dataset The dataset that will provide the values for the chart. */// w ww . j a va 2 s. c o m private void addChart() { JFreeChart chart = ChartFactory.createStackedBarChart3D(getTitle(), null, "Breakdown" + unitSuffix(), dataset, PlotOrientation.VERTICAL, true, true, false); CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); chart.addProgressListener(locker); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setToolTipGenerator(dataset); mainPanel().add(BorderLayout.CENTER, new ChartPanel(chart)); }
From source file:com.intel.stl.ui.main.view.HealthHistoryView.java
public void setDataset(final IntervalXYDataset dataset) { JFreeChart chart = ComponentFactory.createStepAreaChart(dataset, new XYItemLabelGenerator() { @Override/*from w w w .j a v a2 s .c om*/ public String generateLabel(XYDataset dataset, int series, int item) { Number val = dataset.getY(series, item); return UIConstants.INTEGER.format(val.intValue()); } }); chart.addProgressListener(new ChartProgressListener() { @Override public void chartProgress(ChartProgressEvent event) { if (event.getType() == ChartProgressEvent.DRAWING_STARTED && currentValue != null) { currentValue.setText(scoreString); currentValue.setPaint(scoreColor); currentValue.setToolTipText(scoreTip); } } }); XYPlot plot = chart.getXYPlot(); plot.getRangeAxis().setRange(0, 105); plot.getRenderer().setSeriesPaint(0, UIConstants.INTEL_BLUE); currentValue = new TextTitle(scoreString, scoreFont); currentValue.setPaint(scoreColor); currentValue.setToolTipText(scoreTip); // currentValue.setBackgroundPaint(new Color(255, 255, 255, 128)); currentValue.setPosition(RectangleEdge.BOTTOM); XYTitleAnnotation xytitleannotation = new XYTitleAnnotation(0.49999999999999998D, 0.49999999999999998D, currentValue, RectangleAnchor.CENTER); // xytitleannotation.setMaxWidth(0.47999999999999998D); plot.addAnnotation(xytitleannotation); chartPanel.setChart(chart); }
From source file:org.eumetsat.metop.visat.SounderInfoView.java
private JComponent createSpectrumChartComponent() { spectrumDataset = new XYSeriesCollection(); final JFreeChart chart = ChartFactory.createXYLineChart("Sounder IFOV Spectrum", // chart title "Channel", // x axis label "Brightness Temperature (K)", // y axis label spectrumDataset, PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls );/*from ww w. ja v a2 s . co m*/ chart.addProgressListener(new DomainCrosshairListener()); configureSpectrumChart(chart); spectrumPlot = chart.getXYPlot(); configureSpectrumPlot(spectrumPlot); configureSpectrumPlotRenderer((XYLineAndShapeRenderer) spectrumPlot.getRenderer()); configureSpectrumPlotYAxis((NumberAxis) spectrumPlot.getRangeAxis()); configureSpectrumPlotXAxis((NumberAxis) spectrumPlot.getDomainAxis()); final ChartPanel chartPanel = new ChartPanel(chart); configureSpectrumChartPanel(chartPanel); final JPanel containerPanel = new JPanel(new BorderLayout(4, 4)); containerPanel.add(chartPanel); return containerPanel; }
From source file:org.eumetsat.metop.visat.IasiInfoView.java
private JComponent createSpectrumChartComponent() { spectrumDataset = new XYSeriesCollection(); final JFreeChart chart = ChartFactory.createXYLineChart("IASI IFOV Spectrum", // chart title "Channel", // x axis label "Brightness Temperature (K)", // y axis label spectrumDataset, PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls );/* w w w . j a va 2s . c o m*/ chart.addProgressListener(new DomainCrosshairListener()); configureSpectrumChart(chart); spectrumPlot = chart.getXYPlot(); configureSpectrumPlot(spectrumPlot); configureSpectrumPlotRenderer((XYLineAndShapeRenderer) spectrumPlot.getRenderer()); configureSpectrumPlotYAxis((NumberAxis) spectrumPlot.getRangeAxis()); configureSpectrumPlotXAxis((NumberAxis) spectrumPlot.getDomainAxis()); final ChartPanel chartPanel = new ChartPanel(chart); configureSpectrumChartPanel(chartPanel); final JPanel containerPanel = new JPanel(new BorderLayout(4, 4)); containerPanel.add(chartPanel); return containerPanel; }
From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.AdvancedXY_PlotPanel.java
private void initChart(XY_PlotPanel pPanel) { this.plotPanel = pPanel; this.chartPanel = pPanel.getChartPanel(); if (pPanel instanceof SimpleXY_PlotPanel) { this.setTitle(((SimpleXY_PlotPanel) pPanel).getTitle()); }/*from w w w . j ava 2 s . co m*/ JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); // how many data sets will there be (may not exist yet, cause swing worker may still be constructing them) int numRows = 2; // enough for counts, and delta counts if ((XY_PlotType.ADV_PORT_UTIL_PLUS.equals(getType()))) numRows = 4; boolean includeExtra = numRows > MAX_DATASETS / 2 ? true : false; int rowSize = includeExtra ? MAX_DS_SIZE : MAX_DS_SIZE / 2 + 19; // extra for padding NumDataSets = numRows; // build the table model from the data sets, then build the table and slider // see "chartProgress()" method chart.addProgressListener(this); this.chartPanel.setPreferredSize(new java.awt.Dimension(750, 300)); this.chartPanel.setDomainZoomable(true); this.chartPanel.setRangeZoomable(true); Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createEtchedBorder()); this.chartPanel.setBorder(border); add(this.chartPanel); JPanel dashboard = new JPanel(new BorderLayout()); dashboard.setPreferredSize(new Dimension(400, rowSize)); dashboard.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4)); this.model = new XY_PlotTableModel(numRows); // initialize the model, and table, here // this.model.setValueAt("name", 0, 1); this.model.setValueAt(new Double("0.00"), 0, 1); this.model.setValueAt(new Double("0.00"), 0, 2); // this.model.setValueAt("units", 0, 3); JTable table = new JTable(this.model); // the columns are name, time, value, units. both name and units are strings // so need special renderers for time and value TableCellRenderer renderer1 = new DateCellRenderer(new SimpleDateFormat("HH:mm:ss")); TableCellRenderer renderer2 = new NumberCellRenderer(); table.getColumnModel().getColumn(1).setCellRenderer(renderer1); table.getColumnModel().getColumn(2).setCellRenderer(renderer2); JScrollPane scroller = new JScrollPane(table); dashboard.add(scroller); this.slider = new JSlider(0, 100, 10); this.slider.addChangeListener(this); dashboard.add(this.slider, BorderLayout.SOUTH); add(dashboard, BorderLayout.SOUTH); // XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainCrosshairLockedOnData(true); plot.setRangeCrosshairVisible(false); plot.setDomainCrosshairVisible(true); }