List of usage examples for org.jfree.chart ChartPanel setName
public void setName(String name)
From source file:daylightchart.gui.LocationsTabbedPane.java
/** * Add a new tab for the location.//from w w w . j a v a 2s . co m * * @param daylightChartReport * Daylight Chart report */ public void addLocationTab(final DaylightChartReport daylightChartReport) { final Location location = daylightChartReport.getLocation(); final DaylightChart chart = daylightChartReport.getChart(); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setName(location.toString()); chartPanel.setPreferredSize(ChartConfiguration.chartDimension); addTab(location.toString(), new CloseTabIcon(), chartPanel, LocationFormatter.getToolTip(location)); setSelectedIndex(getTabCount() - 1); }
From source file:moller.javapeg.program.gui.frames.ImageRepositoryStatisticsViewer.java
private ChartPanel createChart(CategoryDataset bardataset, String label) { String title = getLang().get("imagestatisticsviewer.chart.title.prefix"); String valueAxisLabel = getLang().get("imagestatisticsviewer.chart.valueAxisLabel"); JFreeChart barChart = ChartFactory.createBarChart(title + " " + label, label, valueAxisLabel, bardataset); ChartPanel chartPanel = new ChartPanel(barChart); chartPanel.setName(label); chartPanel.setMouseWheelEnabled(true); final CategoryPlot plot = barChart.getCategoryPlot(); plot.setBackgroundPaint(new Color(204, 204, 204)); BarRenderer barRenderer = (BarRenderer) plot.getRenderer(); barRenderer.setBarPainter(new StandardBarPainter()); barRenderer.setSeriesPaint(0, new Color(102, 153, 204)); barRenderer.setDrawBarOutline(true); barRenderer.setSeriesOutlinePaint(0, Color.BLACK); return chartPanel; }
From source file:Debrief.Tools.FilterOperations.ShowTimeVariablePlot3.java
public final MWC.GUI.Tools.Action getData() { // check that some tracks are selected if (_theTracks == null) { MWC.GUI.Dialogs.DialogFactory.showMessage("Reformat Tracks", "Please select one or more tracks"); return null; }/*from w w w . j a va 2s.c om*/ // find out what the user wants to view final CalculationHolder theHolder = getChoice(); // check it worked if (theHolder != null) { // retrieve the necessary input data final toteCalculation myOperation = theHolder._theCalc; // declare the primary track (even though we may end up not using // it) WatchableList thePrimary = null; // is this a relative calculation? if (theHolder._isRelative) { // retrieve the necessary input data thePrimary = getPrimary(); } // //////////////////////////////////////////////// // sort out the title // //////////////////////////////////////////////// // get the title to use String theTitle = myOperation.getTitle() + " vs Time plot"; // is this a relative operation if (theHolder.isARelativeCalculation()) { if (thePrimary != null) { // if it's relative, we use the primary track name in the // title theTitle = thePrimary.getName() + " " + theTitle; } } // /////////////////////////////////////////////////////// // prepare the plot // /////////////////////////////////////////////////////// // the working variables we rely on later NewFormattedJFreeChart jChart = null; XYPlot plot = null; ValueAxis xAxis = null; XYToolTipGenerator tooltipGenerator = null; // the y axis is common to hi & lo res. Format it here final NumberAxis yAxis = new NumberAxis(myOperation.getTitle() + " " + myOperation.getUnits()); // hmm, see if we are in hi-res mode. If we are, don't use a // formatted // y-axis, just use the plain long microseconds // value if (HiResDate.inHiResProcessingMode()) { // final SimpleDateFormat _secFormat = new SimpleDateFormat("ss"); System.err .println("XY Plot of HiRes data support is incomplete. Tick formatter (below) is missing."); // ok, simple enough for us... final NumberAxis nAxis = new NumberAxis("time (secs.micros)"); // { // /** // * // */ // private static final long serialVersionUID = 1L; // // @SuppressWarnings("unused") // public String getTickLabel(final double currentTickValue) // { // final long time = (long) currentTickValue; // final Date dtg = new HiResDate(0, time).getDate(); // final String res = _secFormat.format(dtg) + "." // + DebriefFormatDateTime.formatMicros(new HiResDate(0, time)); // return res; // } // }; nAxis.setAutoRangeIncludesZero(false); xAxis = nAxis; // just show the raw data values tooltipGenerator = new StandardXYToolTipGenerator(); } else { // create a date-formatting axis final DateAxis dAxis = new RelativeDateAxis(); dAxis.setStandardTickUnits(DateAxisEditor.createStandardDateTickUnitsAsTickUnits()); xAxis = dAxis; // also create the date-knowledgable tooltip writer tooltipGenerator = new DatedToolTipGenerator(); } // create the special stepper plot final ColourStandardXYItemRenderer renderer = new ColourStandardXYItemRenderer(tooltipGenerator, null, null); plot = getPlot((RelativeDateAxis) xAxis, yAxis, _theStepper, renderer); renderer.setPlot(plot); // apply any formatting for this choice final formattingOperation fo = theHolder._theFormatter; if (fo != null) { fo.format(plot); } jChart = new NewFormattedJFreeChart(theTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true, _theStepper); // //////////////////////////////////////////////////// // get the data // //////////////////////////////////////////////////// final AbstractDataset theDataset = getDataSeries(thePrimary, theHolder, _theTracks, _start_time, _end_time, jChart.getTimeOffsetProvider()); // //////////////////////////////////////////////// // put the holder into one of our special items // //////////////////////////////////////////////// final ChartPanel chartInPanel = new StepperChartPanel(jChart, true, _theStepper); // format the chart chartInPanel.setName(theTitle); chartInPanel.setMouseZoomable(true, true); // and insert into the panel insertPanel(chartInPanel, jChart); // //////////////////////////////////////////////////// // put the time series into the plot // //////////////////////////////////////////////////// plot.setDataset((XYDataset) theDataset); } // whether we have a primary // return the new action return null; }