public synchronized void addChartPanel(String currency, boolean byMonth) { TimeSeriesCollection dataset = LineGraphMaker.makeDataset(); datasets.add(dataset); String currencyName = currency; if (currency.isEmpty()) { currencyName = "Unknown Currency"; } String timePeriod = "Day"; if (byMonth) { timePeriod = "Month"; } JFreeChart chart = LineGraphMaker.makeChart("Prices by " + timePeriod, currencyName, dataset, byMonth); chart.setBackgroundPaint(chartColor); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(plotColor); ChartPanel panel = new ChartPanel(chart); chartPanels.add(panel); ChartEditorManager.setChartEditorFactory(new NewDefaultChartEditorFactory()); panel.setFillZoomRectangle(true); panel.setMouseWheelEnabled(true); currencies.add(currency); }
/** * Displays a dialog that allows the user to edit the properties for the current chart. * * @since 1.0.3 */ @Override public void doEditChartProperties() { ChartEditor editor = ChartEditorManager.getChartEditor(this.chart); int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { editor.updateChart(this.chart); } }
/** * Displays a dialog that allows the user to edit the properties for the * current chart. * * @since 1.0.3 */ public void doEditChartProperties() { ChartEditor editor = ChartEditorManager.getChartEditor(this.chart); int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { editor.updateChart(this.chart); } }