/** * Changes the chart displayed in the given panel. * * @param aPanel * Panel to be used for storing the chart. * @param aChart * Chart to be set to <code>aPanel</code>. */ public static void setChart(JPanel aPanel, JFreeChart aChart) { ((ChartPanel) aPanel).setChart(aChart); }
public void setChart(JFreeChart chart){ if (chart == null) { throw new IllegalArgumentException("Chart panel can't be null"); } chartPanel.setChart(chart); }
/** * Sets the chart that is displayed in the panel. * * @param chart The chart. */ @Override public void setChart(JFreeChart chart) { checkChart(chart); super.setChart(chart); }
/** * Sets the chart that is displayed in the panel. * * @param chart The chart. */ public void setChart(JFreeChart chart) { checkChart(chart); super.setChart(chart); }
@Override public void chartChanged(ChartChangeEvent event) { chartPanel.setChart(chart); statsPanel.add(chartPanel); statsPanel.validate(); pack(); } }
/** * Starts the applet. */ public void start() { String chartSpec = getParameter("chart"); try { Map params = Parameters.parseQueryString(chartSpec); JFreeChart chart = ChartEngine.buildChart(params, new Font("Dialog", Font.PLAIN, 12)); this.chartPanel.setChart(chart); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
/** * creates a new chart object and replaces the old one. */ private void updateChart() { chart = createChart(createDataset()); chartPanel.setChart(chart); repaint(); }
/** * Creates a new chart object and replaces the old one. */ private void updateChart() { chart = createChart(createDataset()); chartPanel.setChart(chart); repaint(); }
@Override public void doRefresh() { if (bundle.hasChanges()) { bundle.setHasChanges(false); final ChartPanel newChartPanel = makeChartPanel(bundle); final JFreeChart chart = newChartPanel.getChart(); chartPanel.setChart(chart); } } }
contentPane.add(chartPanel, BorderLayout.CENTER); final JFreeChart pieChart = createPieChart(); chartPanel.setChart(pieChart); chartPanel.addChartMouseListener(new ChartMouseListener() {
this.chartPanel.setSize(d); this.paper.validate(); this.chartPanel.setChart(chart);
public Chart(Model model, AccuracyRadioButtons accuracyRadioButtons, AutoScaleRadioButtons autoScaleRadioButtons, ProbesCheckboxes probesCheckboxes) { this.model = model; this.accuracyRadioButtons = accuracyRadioButtons; this.autoScaleRadioButtons = autoScaleRadioButtons; this.probesCheckboxes = probesCheckboxes; setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); setLayout(new BorderLayout()); initSliders(); JPanel horizontalSlidersPanel = new JPanel(); horizontalSlidersPanel.setLayout(new BoxLayout(horizontalSlidersPanel, BoxLayout.Y_AXIS)); horizontalSlidersPanel.add(mainHorizontalSlider); horizontalSlidersPanel.add(fineHorizontalSlider); JFreeChart chart = ChartFactory.createHistogram("Latency Distribution", "Latency (µs)", "Operations", null, PlotOrientation.VERTICAL, true, true, true); plot = chart.getXYPlot(); plot.setForegroundAlpha(ALPHA); ChartPanel chartPanel = new ChartPanel(null); chartPanel.setChart(chart); add(horizontalSlidersPanel, BorderLayout.SOUTH); add(verticalSlider, BorderLayout.EAST); add(chartPanel, BorderLayout.CENTER); initSliderChangeListener(); }
public Chart(Model model, AccuracyRadioButtons accuracyRadioButtons, AutoScaleRadioButtons autoScaleRadioButtons, ProbesCheckboxes probesCheckboxes) { this.model = model; this.accuracyRadioButtons = accuracyRadioButtons; this.autoScaleRadioButtons = autoScaleRadioButtons; this.probesCheckboxes = probesCheckboxes; setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); setLayout(new BorderLayout()); initSliders(); JPanel horizontalSlidersPanel = new JPanel(); horizontalSlidersPanel.setLayout(new BoxLayout(horizontalSlidersPanel, BoxLayout.Y_AXIS)); horizontalSlidersPanel.add(mainHorizontalSlider); horizontalSlidersPanel.add(fineHorizontalSlider); JFreeChart chart = ChartFactory.createHistogram("Latency Distribution", "Latency (µs)", "Operations", null, PlotOrientation.VERTICAL, true, true, true); plot = chart.getXYPlot(); plot.setForegroundAlpha(ALPHA); ChartPanel chartPanel = new ChartPanel(null); chartPanel.setChart(chart); add(horizontalSlidersPanel, BorderLayout.SOUTH); add(verticalSlider, BorderLayout.EAST); add(chartPanel, BorderLayout.CENTER); initSliderChangeListener(); }
} else { chartPanel.setChart(null); button.setEnabled(false); xMaxSlider.setEnabled(false);
public void clearChart() { if (!lock) { this.chart = chartData.makeChart(); this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
public void clearChart() { if (!lock) { this.chart = chartData.makeChart(); this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
/** * Sets the type of the chart. * * @param chartType The chart type. */ public void setChartType(int chartType) { this.chartType = chartType; // first cleanup for gc if(chart.getPlot() instanceof CategoryPlot) { GroupedCategoryDataset dataset = (GroupedCategoryDataset)chart.getCategoryPlot().getDataset(); dataset.cleanup(); // needed for circle references ((CategoryPlot)chart.getPlot()).setDataset(null); } if(chart.getPlot() instanceof MultiplePiePlot) { ((MultiplePiePlot)chart.getPlot()).setDataset(null); } chart = chartType == CHARTTYPE_PIECHART ? createPieChart() : createBarChart(); chartPanel.setChart(chart); }
public void updateDomain(String title, int seriesNum, Color background) { if (!lock) { this.chart = chartData.makeChart(); this.background = background == null ? DEFAULT_BACKGROUND : background; this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
public void updateDomain(String title, int seriesNum, Color background) { if (!lock) { this.chartData.setSeriesNum(seriesNum); this.chart = chartData.makeChart(); this.background = background == null ? DEFAULT_BACKGROUND : background; this.chart.setBackgroundPaint(this.background); this.chart.setBorderPaint(null); if (output != null) { JFreeChart newChart = new JFreeChart(chart.getPlot()); newChart.getLegend().setPosition(RectangleEdge.TOP); newChart.getLegend().setPadding(5, 5, 5, 5); newChart.setBackgroundPaint(background); output.setChart(newChart); output.invalidate(); output.repaint(); } } }
"Subscription count", "Timestamp", null, collection, PlotOrientation.VERTICAL, true, false, false); chartPanel.setChart(chart); chartPanel.setVisible(true);