List of usage examples for org.jfree.chart.plot XYPlot setDomainCrosshairVisible
public void setDomainCrosshairVisible(boolean flag)
From source file:speedbagalg.OscopeView.java
/** * Creates new form OscopeView/*from ww w . j av a2s .c o m*/ */ /* public OscopeView(String fileName) { this.fileName = fileName; initComponents(); updateThread = new RunnableMember2(this, "updateGUI"); ChartFactory.setChartTheme(new StandardChartTheme("JFree/Shadow", true)); // create a dataset... int maxAge = 2400; this.xData = new TimeSeries("X axis"); this.xData.setMaximumItemAge(maxAge); this.yData = new TimeSeries("Y axis"); this.yData.setMaximumItemAge(maxAge); this.zData = new TimeSeries("Z axis"); this.zData.setMaximumItemAge(maxAge); this.averageData = new TimeSeries("Avg. Data"); this.averageData.setMaximumItemAge(maxAge); //this.windSpeedSeries = new TimeSeries("Wind Speed"); //this.windSpeedSeries.setMaximumItemAge(maxAge); //this.rainSeries = new TimeSeries("Rain 24hrs"); //this.rainSeries.setMaximumItemAge(maxAge); final TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(xData); dataset.addSeries(yData); dataset.addSeries(zData); dataset.addSeries(averageData); //dataset.addSeries(windSpeedSeries); //dataset.addSeries(rainSeries); final JFreeChart chart = ChartFactory.createTimeSeriesChart( "Accel Data", "Time", "Value", dataset, true, true, false); final XYPlot plot = chart.getXYPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis = plot.getRangeAxis(); axis.setRange(-1000.0, 10000.0); 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); // create and display a frame... thePanel = new ChartPanel(chart); Dimension d = new Dimension(200, 100); thePanel.setSize(d); thePanel.setPreferredSize(d); BorderLayout layout = new BorderLayout(); jPanelOscope.setLayout(layout); jPanelOscope.add(thePanel, BorderLayout.CENTER); plotXCheckBox.setSelected(plotX); plotYCheckBox.setSelected(plotY); plotZCheckBox.setSelected(plotZ); } */ public OscopeView(String fileName) { this.fileName = fileName; initComponents(); updateThread = new RunnableMember2(this, "updateGUI"); ChartFactory.setChartTheme(new StandardChartTheme("JFree/Shadow", true)); // create a dataset... this.xData = new XYSeries("Min"); //this.xData.setMaximumItemAge(maxAge); this.yData = new XYSeries("Peak"); //this.yData.setMaximumItemAge(maxAge); this.zData = new XYSeries("Z axis"); //this.zData.setMaximumItemAge(maxAge); this.averageData = new XYSeries("Avg. Data"); //this.averageData.setMaximumItemAge(maxAge); //this.windSpeedSeries = new TimeSeries("Wind Speed"); //this.windSpeedSeries.setMaximumItemAge(maxAge); //this.rainSeries = new TimeSeries("Rain 24hrs"); //this.rainSeries.setMaximumItemAge(maxAge); final XYSeriesCollection dataset = new XYSeriesCollection(); //SlidingCategoryDataset dataset = new SlidingCategoryDataset(0, 10); dataset.addSeries(xData); dataset.addSeries(yData); dataset.addSeries(zData); dataset.addSeries(averageData); //dataset.addSeries(windSpeedSeries); //dataset.addSeries(rainSeries); chart = ChartFactory.createXYLineChart("Accel Data", "Time", "Value", dataset, PlotOrientation.VERTICAL, true, true, false); final XYPlot plot = chart.getXYPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(false); axis.setRange(minStart, maxDomain); axis = plot.getRangeAxis(); axis.setRange(vMin, vMax); 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); // create and display a frame... thePanel = new ChartPanel(chart); Dimension d = new Dimension(200, 100); thePanel.setSize(d); thePanel.setPreferredSize(d); BorderLayout layout = new BorderLayout(); jPanelOscope.setLayout(layout); jPanelOscope.add(thePanel, BorderLayout.CENTER); plotXCheckBox.setSelected(plotX); plotYCheckBox.setSelected(plotY); plotZCheckBox.setSelected(plotZ); vMaxSpinner.setValue(vMax); }
From source file:io.github.mzmine.modules.plots.chromatogram.ChromatogramPlotWindowController.java
@FXML public void initialize() { final JFreeChart chart = chartNode.getChart(); final XYPlot plot = chart.getXYPlot(); // Do not set colors and strokes dynamically. They are instead provided // by the dataset and configured in configureRenderer() plot.setDrawingSupplier(null);//from w w w . j a v a2 s . co m plot.setDomainGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setRangeGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setDomainCrosshairPaint(JavaFXUtil.convertColorToAWT(crossHairColor)); plot.setRangeCrosshairPaint(JavaFXUtil.convertColorToAWT(crossHairColor)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); // chart properties chart.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); // legend properties LegendTitle legend = chart.getLegend(); // legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setLabel("Retention time (min)"); xAxis.setUpperMargin(0.03); xAxis.setLowerMargin(0.03); xAxis.setRangeType(RangeType.POSITIVE); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setLabel("Intensity"); yAxis.setRangeType(RangeType.POSITIVE); yAxis.setAutoRangeIncludesZero(true); // set the fixed number formats, because otherwise JFreeChart sometimes // shows exponent, sometimes it doesn't DecimalFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); xAxis.setNumberFormatOverride(mzFormat); DecimalFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); yAxis.setNumberFormatOverride(intensityFormat); chartTitle = chartNode.getChart().getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartTitle.setText("Chromatogram"); chartNode.setCursor(Cursor.CROSSHAIR); // Remove the dataset if it is removed from the list datasets.addListener((Change<? extends ChromatogramPlotDataSet> c) -> { while (c.next()) { if (c.wasRemoved()) { for (ChromatogramPlotDataSet ds : c.getRemoved()) { int index = plot.indexOf(ds); plot.setDataset(index, null); } } } }); itemLabelsVisible.addListener((prop, oldVal, newVal) -> { for (ChromatogramPlotDataSet dataset : datasets) { int datasetIndex = plot.indexOf(dataset); XYItemRenderer renderer = plot.getRenderer(datasetIndex); renderer.setBaseItemLabelsVisible(newVal); } }); legendVisible.addListener((prop, oldVal, newVal) -> { legend.setVisible(newVal); }); }
From source file:gov.nih.nci.ispy.ui.graphing.chart.plot.ISPYCorrelationScatterPlot.java
private void createChart() { String title = "Correlation Scatter Plot correlationCoefficient=" + nf.format(corrValue) + " N=" + dataPoints.size();// ww w. ja va 2s.co m corrChart = ChartFactory.createScatterPlot(title, xLabel, yLabel, null, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) corrChart.getPlot(); plot.setNoDataMessage(null); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setToolTipGenerator(new StandardXYToolTipGenerator()); renderer.setUseOutlinePaint(true); plot.setRangeCrosshairVisible(false); plot.setDomainCrosshairVisible(false); // XYShapeAnnotation annotation = new XYShapeAnnotation(new Rectangle2D.Double(25.0, 25.0, 5, 5)); // // plot.addAnnotation(annotation); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); //should determine axis range using datapoints. List<PlotPoint> plotPoints = new ArrayList<PlotPoint>(dataPoints); DataRange Xrange = PlotPoint.getDataRange(plotPoints, AxisType.X_AXIS); DataRange Yrange = PlotPoint.getDataRange(plotPoints, AxisType.Y_AXIS); // Double xAbsMax = Math.max(Math.abs(Xrange.getMaxRange()), Math.abs(Xrange.getMinRange())); // Double yAbsMax = Math.max(Math.abs(Yrange.getMaxRange()), Math.abs(Yrange.getMinRange())); // // Double maxAbsVal = Math.max(xAbsMax, yAbsMax); domainAxis.setAutoRangeIncludesZero(false); double xTick = 10.0; double yTick = 10.0; double xdist = Math.abs(Xrange.getMaxRange() - Xrange.getMinRange()); double ydist = Math.abs(Yrange.getMaxRange() - Yrange.getMinRange()); if (xdist < 10.0) { xTick = 1.0; } if (ydist < 10.0) { yTick = 1.0; } // if (maxAbsVal <= 25.0) { // tickUnit =5.0; // } // else if (maxAbsVal <= 50.0) { // tickUnit = 10.0; // } domainAxis.setTickUnit(new NumberTickUnit(xTick)); rangeAxis.setTickUnit(new NumberTickUnit(yTick)); //double glyphScaleFactor = (maxAbsVal*2.0)/600.0; //assuming 600 pixels for the graph double xScale = xdist / 600.0; //double glyphScaleFactor = 1.0; double yScale = ydist / 600.0; //double adjAbsVal = Math.ceil(maxAbsVal + (glyphScaleFactor*8.0)); //domainAxis.setRange(-maxAbsVal, maxAbsVal); double xMin = Xrange.getMinRange() - xScale * glyphSize; double xMax = Xrange.getMaxRange() + xScale * glyphSize; double yMin = Yrange.getMinRange() - yScale * glyphSize; double yMax = Yrange.getMaxRange() + yScale * glyphSize; domainAxis.setRange(xMin, xMax); //rangeAxis.setRange(-maxAbsVal, maxAbsVal); rangeAxis.setRange(yMin, yMax); Set<SampleInfo> infoSet = new HashSet<SampleInfo>(); if ((colorBy == ColorByType.IHC_EXPRESSION_X) || (colorBy == ColorByType.IHC_EXPRESSION_Y)) { String geneName = null; if ((colorBy == ColorByType.IHC_EXPRESSION_X) && (ct1 != ContinuousType.GENE)) { logger.info("User attempted to color by ihc x on non gene continuous type."); //need to show validation error return; } else if ((colorBy == ColorByType.IHC_EXPRESSION_Y) && (ct2 != ContinuousType.GENE)) { logger.info("User attempted to color by ihc y on non gene continuous type."); //need to show validation error return; } else { if (colorBy == ColorByType.IHC_EXPRESSION_X) { //parse the gene name from the xLabel geneName = xLabel.substring(0, xLabel.indexOf('_')); } else if (colorBy == ColorByType.IHC_EXPRESSION_Y) { //parse the gene name from the yLabel geneName = yLabel.substring(0, yLabel.indexOf('_')); } } //Get the IHC data for the samples to be graphed LevelOfExpressionIHCService loeService = LevelOfExpressionIHCService.getInstance(); LossOfExpressionIHCService lossService = LossOfExpressionIHCService.getInstance(); Set<String> sampleIds = new HashSet<String>(); String labtrackId; SampleInfo info; for (ISPYPlotPoint corrPoint : dataPoints) { info = corrPoint.getSampleInfo(); if (info != null) { labtrackId = corrPoint.getSampleInfo().getLabtrackId(); sampleIds.add(labtrackId); infoSet.add(info); } else { logger.warn("Point id=" + corrPoint.getId() + " has no sample info. Skipping point"); } } Collection<? extends Finding> loeFindings = loeService.getFindingsFromSampleInfo(infoSet); Collection<? extends Finding> lossFindings = lossService.getFindingsFromSampleInfo(infoSet); List<IHCFinding> findings = new ArrayList<IHCFinding>(); for (Finding f : loeFindings) { findings.add((IHCFinding) f); } for (Finding f : lossFindings) { findings.add((IHCFinding) f); } // Need to handle mapping names to IHC biomarker names. //EGFR (ok), FAK (PTK2), HER2 (ERBB2), Ki-67, P53, bcl2 (ok), p27, CYCLIN_D1 (CCND1) //Translate the gene names into the biomarker names //used by ihc. This code should be removed once protein biomarker //alias is implmented. String ihcBiomarker = geneName; if (geneName.equalsIgnoreCase("PTK2")) { ihcBiomarker = "FAK"; ihcBiomarkerType = IHCBiomarkerType.FAK; } else if (geneName.equalsIgnoreCase("ERBB2")) { ihcBiomarker = "HER2"; ihcBiomarkerType = IHCBiomarkerType.HER2; } else if (geneName.equalsIgnoreCase("MKI67")) { //need to check this one ihcBiomarker = "Ki-67"; ihcBiomarkerType = IHCBiomarkerType.KI67; } else if (geneName.equalsIgnoreCase("TP53")) { ihcBiomarker = "P53"; ihcBiomarkerType = IHCBiomarkerType.P53; } else if (geneName.equalsIgnoreCase("Cdkn1b")) { ihcBiomarker = "P27"; ihcBiomarkerType = IHCBiomarkerType.P27; } else if (geneName.equalsIgnoreCase("BCL2")) { ihcBiomarker = "BCL2"; ihcBiomarkerType = IHCBiomarkerType.BCL2; } else if (geneName.equalsIgnoreCase("EGFR")) { ihcBiomarker = "EGFR"; ihcBiomarkerType = IHCBiomarkerType.EGFR; } else if (geneName.equalsIgnoreCase("CCND1")) { ihcBiomarker = "CYCLIN_D1"; ihcBiomarkerType = IHCBiomarkerType.CYCLIN_D1; } List<IHCFinding> filteredList = getIHCFindingsForBiomarker(findings, ihcBiomarker); //TEST Case // Set<String> testIds = new HashSet<String>(); // testIds.add("212833"); // testIds.add("213152"); //Collection<? extends Finding> loeFindings = loeService.getFindingsFromSampleIds(testIds); //Collection<? extends Finding> lossFindings = lossService.getFindingsFromSampleIds(sampleIds); ihcData = new HashMap<String, List<IHCFinding>>(); IHCFinding loeFinding; List<IHCFinding> findingList; Specimen specimen = null; String patientDID = null; for (Finding finding : filteredList) { loeFinding = (IHCFinding) finding; specimen = loeFinding.getSpecimen(); if ((specimen != null) && (specimen.getPatientDID() != null)) { patientDID = specimen.getPatientDID(); findingList = ihcData.get(patientDID); if (findingList == null) { findingList = new ArrayList<IHCFinding>(); ihcData.put(patientDID, findingList); } findingList.add(loeFinding); } else { logger.warn( "loeFinding id=" + loeFinding.getId() + " has null specimen or patientDID. Skipping.."); } } // IHCFinding lossFinding; // for (Finding finding : lossFindings) { // lossFinding = (IHCFinding) finding; // ihcData.put(lossFinding.getId(), lossFinding); // } } createGlyphsAndAddToPlot(plot, xScale, yScale); // Paint p = new GradientPaint(0, 0, Color.white, 1000, 0, Color.green); //try and match the UI e9e9e9 Paint p = new Color(233, 233, 233); corrChart.setBackgroundPaint(p); buildLegend(); }
From source file:net.liuxuan.device.w3330.JIF_DrawChart_w3330.java
/** * ?jfreechart// w ww .j av a 2 s . co m */ public void initChart() { ts_wppm = new TimeSeries("PPM", Millisecond.class); ts_wppm_zero = new TimeSeries("PPM-Zero", Millisecond.class); ts_flux = new TimeSeries("Flux", Millisecond.class); ts_wvtr = new TimeSeries("WVTR", Millisecond.class); ts_tempcell = new TimeSeries(" Cell Temperature", Millisecond.class); ts_tempambi = new TimeSeries("Ambient Temperature", Millisecond.class); ts_status = new TimeSeries("Status", Millisecond.class); ts_fitting = new TimeSeries("fitting curve1", Millisecond.class); ts_fitting2 = new TimeSeries("fitting curve2", Millisecond.class); trcollection = new TimeSeriesCollection(ts_wppm); trcollection.addSeries(ts_wppm_zero); trcollection.addSeries(ts_wvtr); trcollection.addSeries(ts_fitting2);//ppm trcollection2 = new TimeSeriesCollection(ts_flux); trcollection2.addSeries(ts_fitting);//temp3 trcollection2.addSeries(ts_tempcell); trcollection2.addSeries(ts_tempambi); trcollection2.addSeries(ts_status); // timeseriescopylist.add(getTimeSeries(3).createCopy(0, getTimeSeries(3).getItemCount() - 1)); JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("", "Time(s)", "PPM", trcollection, true, true, false); XYPlot xyplot = jfreechart.getXYPlot(); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); Font fs = new Font("", Font.BOLD, 14); Font fs2 = new Font("", Font.BOLD, 12); XYLineAndShapeRenderer line0render = (XYLineAndShapeRenderer) xyplot.getRenderer(0); Color purple = new Color(139, 0, 255); line0render.setSeriesPaint(0, Color.blue); line0render.setSeriesPaint(1, Color.green); line0render.setSeriesPaint(2, Color.red); line0render.setSeriesPaint(3, purple); // line0render.setSeriesPaint(3, Color.ORANGE); XYLineAndShapeRenderer line1render = new XYLineAndShapeRenderer(); Color Rosered = new Color(230, 28, 100); line1render.setSeriesPaint(0, Color.orange); line1render.setSeriesPaint(1, Color.yellow); line1render.setSeriesPaint(2, Color.cyan); line1render.setSeriesPaint(3, Rosered); line1render.setBaseShapesVisible(false); xyplot.setRenderer(1, line1render); //?? ValueAxis valueaxis = xyplot.getDomainAxis(); // valueaxis.setLabelFont(fs); // valueaxis.setTickLabelFont(fs2); ValueAxis valueaxis2 = new NumberAxis(""); valueaxis2.setLabelFont(fs); valueaxis2.setTickLabelFont(fs2); xyplot.setRangeAxis(1, valueaxis2); xyplot.setDataset(1, trcollection2); xyplot.mapDatasetToRangeAxis(1, 1); //?? valueaxis.setAutoRange(true); //?? 7days // valueaxis.setFixedAutoRange(604800000D); valueaxis = xyplot.getRangeAxis(); valueaxis.setLabelFont(new Font("", Font.BOLD, 14)); valueaxis.setLabelPaint(line0render.getSeriesPaint(0)); valueaxis2.setLabelPaint(line1render.getSeriesPaint(0)); jfreechart.getTitle().setFont(new Font("", Font.BOLD, 20));// jfreechart.getLegend().setItemFont(new Font("", Font.ITALIC, 15)); xyplot.getRenderer(0).setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator("{1}, {2}", new SimpleDateFormat("MM-dd HH:mm:ss"), new DecimalFormat("0.0000"))); xyplot.getRenderer(1).setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator("{1}, {2}", new SimpleDateFormat("MM-dd HH:mm:ss"), new DecimalFormat("0.0000"))); chartPanel = new ChartPanel(jfreechart); initChartMenu(); // chartPanel.getPopupMenu().add(jmenuitem2); // chartPanel.getPopupMenu().getPopupMenuListeners(); chartPanel.setSize(950, 620); chartPanel.setPreferredSize(new Dimension(950, 620)); jPanel_Show.add(chartPanel, BorderLayout.CENTER); }
From source file:fi.smaa.jsmaa.gui.views.CriterionView.java
private JPanel buildValueFunctionChartPanel(ScaleCriterion criterion) { UtilityFunctionDataset dataset = new UtilityFunctionDataset(criterion); JFreeChart chart = ChartFactory.createXYLineChart("", "x", "v(x)", dataset, PlotOrientation.VERTICAL, false, true, true);//w w w .ja va2s.com final XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); plot.setRenderer(0, renderer); renderer.setSeriesPaint(0, Color.black); renderer.setSeriesShape(0, ShapeUtilities.createDiamond(3.0f)); renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); ValueAxis rAxis = plot.getRangeAxis(); rAxis.setAutoRange(false); rAxis.setRange(new Range(-0.03, 1.03)); ValueAxis dAxis = plot.getDomainAxis(); dAxis.setLowerMargin(0.03); dAxis.setUpperMargin(0.03); ChartPanel chartPanel = new ChartPanel(chart, false, true, true, false, true); chartPanel.addChartMouseListener(new ValueFunctionMouseListener(chartPanel, criterion, parent)); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); chartPanel.setDisplayToolTips(true); chartPanel.setToolTipText("Click to add/remove partial value function points"); chartPanel.setMouseWheelEnabled(false); chartPanel.setMouseZoomable(false); plot.setDomainCrosshairLockedOnData(false); plot.setRangeCrosshairLockedOnData(false); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); FormLayout layout = new FormLayout("left:pref", "p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.add(chartPanel, cc.xy(1, 1)); builder.add(new ValueFunctionPointsPanel(criterion), cc.xy(1, 3)); return builder.getPanel(); }
From source file:ch.algotrader.client.chart.ChartTab.java
public void init(ChartDefinitionVO chartDefinition) { // remove all components first this.removeAll(); resetPopupMenu();//from w w w . ja v a 2 s . com this.chartDefinition = chartDefinition; // create the plot XYPlot plot = new XYPlot(); // add gridlines plot.setDomainGridlinesVisible(true); plot.setRangeGridlinesVisible(true); // create the JFreeChart JFreeChart chart = new JFreeChart(plot); this.setChart(chart); // init the maps this.bars = new HashMap<>(); this.indicators = new HashMap<>(); this.markers = new HashMap<>(); this.markersSelectionStatus = new HashMap<>(); // init domain axis initDomainAxis(chartDefinition); // init range axis initRangeAxis(chartDefinition); // create a subtitle TextTitle title = new TextTitle(); title.setFont(new Font("SansSerif", 0, 9)); chart.addSubtitle(title); // crosshair plot.setDomainCrosshairVisible(true); plot.setDomainCrosshairLockedOnData(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairLockedOnData(true); }
From source file:v800_trainer.JUebersicht.java
public JPanel Update_Uebersicht(JCicloTronic JTronicHandle) { int i;/*from w ww .j a va2 s . co m*/ Day xTime[]; Today = new GregorianCalendar(); double y1Werte[]; double y2Werte[]; double y3Werte[]; double y4Werte[]; double y5Werte[]; double y6Werte[]; double y7Werte[]; double y8Werte[]; double y9Werte[]; double y10Werte[]; double SummeZeit = 0; double Summekm = 0; double Summehm = 0; double SummeZeit12Mon = 0; double Summekm12Mon = 0; double Summehm12Mon = 0; int AnzahlJahre = 0; int Selektiert = 0; int SelektiertVergl = 0; int Jahr; int Linecount = 0; boolean Vergleich = false; XYItemRenderer renderer; XYBarRenderer rendererb; JFreeChart chart; AnzahlJahre = JTronicHandle.Auswahl_bersicht.getItemCount(); Selektiert = JTronicHandle.Auswahl_bersicht.getSelectedIndex(); SelektiertVergl = JTronicHandle.JahrVergleich.getSelectedIndex(); if (SelektiertVergl == 0 || Selektiert == SelektiertVergl - 1) Vergleich = false; else Vergleich = true; xTime = new Day[366]; y1Werte = new double[366]; y2Werte = new double[366]; y3Werte = new double[366]; y4Werte = new double[366]; y5Werte = new double[366]; y6Werte = new double[366]; y7Werte = new double[366]; y8Werte = new double[366]; y9Werte = new double[366]; y10Werte = new double[366]; TimeSeries dataset; dataset = new TimeSeries("dummy"); dataset.add(new Day(1, 1, 1900), 1); TimeSeriesCollection dataset1 = new TimeSeriesCollection(dataset); chart = ChartFactory.createTimeSeriesChart( "Jahresbersicht " + JTronicHandle.Auswahl_bersicht.getSelectedItem().toString(), "Zeit", "", dataset1, true, true, true); XYToolTipGenerator ToolTip = new StandardXYToolTipGenerator("{0}: ({1}, {2})", (DateFormat) new SimpleDateFormat("dd.MM"), NumberFormat.getInstance()); if (SelektiertVergl != 0) chart.addSubtitle(new TextTitle( "Vergleich mit Jahr " + JTronicHandle.JahrVergleich.getSelectedItem().toString())); chart.setBackgroundPaint(Color.white); JTronicHandle.applyChartTheme(chart); XYPlot plot = chart.getXYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setRangeCrosshairLockedOnData(false); plot.setDomainCrosshairLockedOnData(false); if (!JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { DateAxis MyAxis = new DateAxis(); MyAxis = (DateAxis) plot.getDomainAxis(); MyAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); MyAxis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); plot.setDomainGridlinesVisible(false); } plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.getRangeAxis().setFixedDimension(15.0); plot.getDomainAxis().setTickLabelInsets(new RectangleInsets(2.0, 1.0, 2.0, 1.0)); Jahr = Integer.parseInt(JTronicHandle.Auswahl_bersicht.getSelectedItem().toString()); for (i = 0; i < 366; i++) { SummeZeit12Mon += (double) Zeit[Selektiert + 1][i]; Summekm12Mon += (double) kmJahr[Selektiert + 1][i]; Summehm12Mon += (double) HmJahr[Selektiert + 1][i]; } y4Werte[0] = SummeZeit12Mon; y5Werte[0] = Summekm12Mon; y6Werte[0] = Summehm12Mon; xTime[0] = new Day(31, 12, Jahr - 1); for (i = 1; i < 366; i++) { try { xTime[i] = new Day(xTime[i - 1].next().getStart()); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Exception GregorianCalender " + e, "Achtung!", JOptionPane.ERROR_MESSAGE); } if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { SummeZeit += (double) Zeit[Selektiert][i]; Summekm += (double) kmJahr[Selektiert][i]; Summehm += (double) HmJahr[Selektiert][i]; y1Werte[i] = SummeZeit; y2Werte[i] = Summekm; y3Werte[i] = Summehm; y4Werte[i] = y4Werte[i - 1] - (double) Zeit[Selektiert + 1][i] + (double) Zeit[Selektiert][i]; y5Werte[i] = y5Werte[i - 1] - (double) kmJahr[Selektiert + 1][i] + (double) kmJahr[Selektiert][i]; y6Werte[i] = y6Werte[i - 1] - (double) HmJahr[Selektiert + 1][i] + (double) HmJahr[Selektiert][i]; } else { Day n = new Day(1, xTime[i].getMonth(), xTime[i].getYear()); try { Kalender = new GregorianCalendar(xTime[i].getYear(), xTime[i].getMonth() - 1, 1); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Exception GregorianCalender " + e, "Achtung!", JOptionPane.ERROR_MESSAGE); } int j = (int) Kalender.get(Kalender.DAY_OF_YEAR); for (int m = 0; m < 6; m++) { y1Werte[j + m + 1] += (double) Zeit[Selektiert][i]; y2Werte[j + m + 11] += (double) kmJahr[Selektiert][i]; y3Werte[j + m + 21] += (double) HmJahr[Selektiert][i]; } } } dataset = new TimeSeries("Trainingszeit " + JTronicHandle.Auswahl_bersicht.getSelectedItem().toString()); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y1Werte[i]); } dataset1 = new TimeSeriesCollection(dataset); NumberAxis axis = new NumberAxis(); try { axis = (NumberAxis) plot.getRangeAxis().clone(); } catch (Exception e) { } axis.setLabel("Stunden"); axis.setAutoRangeIncludesZero(true); axis.setLabelPaint(Color.BLACK); axis.setTickLabelPaint(Color.BLACK); plot.setRangeAxis(0, axis); plot.setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_LEFT); plot.setDataset(Linecount, dataset1); plot.mapDatasetToRangeAxis(Linecount, 0); if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount, 255)); plot.setRenderer(Linecount, renderer); } else { rendererb = new XYBarRenderer(); rendererb.setSeriesPaint(0, getColour(Linecount, 150)); rendererb.setShadowVisible(false); rendererb.setDrawBarOutline(false); rendererb.setBarPainter(new StandardXYBarPainter()); plot.setRenderer(Linecount, rendererb); } Linecount++; dataset = new TimeSeries( "Trainingskilometer " + JTronicHandle.Auswahl_bersicht.getSelectedItem().toString()); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y2Werte[i]); } TimeSeriesCollection dataset2 = new TimeSeriesCollection(dataset); NumberAxis axis2 = new NumberAxis(); try { axis2 = (NumberAxis) plot.getRangeAxis().clone(); } catch (Exception e) { } ; axis2.setLabel("Kilometer"); axis2.setAutoRangeIncludesZero(true); axis2.setLabelPaint(Color.BLACK); axis2.setTickLabelPaint(Color.BLACK); plot.setRangeAxis(1, axis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT); plot.setDataset(Linecount, dataset2); plot.mapDatasetToRangeAxis(Linecount, 1); if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount, 255)); plot.setRenderer(Linecount, renderer); } else { rendererb = new XYBarRenderer(); rendererb.setSeriesPaint(0, getColour(Linecount, 150)); rendererb.setShadowVisible(false); rendererb.setDrawBarOutline(false); rendererb.setBarPainter(new StandardXYBarPainter()); plot.setRenderer(Linecount, rendererb); } Linecount++; dataset = new TimeSeries( "Trainingshhenmeter " + JTronicHandle.Auswahl_bersicht.getSelectedItem().toString()); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y3Werte[i]); } TimeSeriesCollection dataset3 = new TimeSeriesCollection(dataset); NumberAxis axis3 = new NumberAxis("Hhenmeter"); try { axis3 = (NumberAxis) plot.getRangeAxis().clone(); } catch (Exception e) { } ; axis3.setLabel("Hhenmeter"); axis3.setAutoRangeIncludesZero(true); axis3.setLabelPaint(Color.BLACK); axis3.setTickLabelPaint(Color.BLACK); plot.setRangeAxis(2, axis3); plot.setRangeAxisLocation(2, AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(Linecount, dataset3); plot.mapDatasetToRangeAxis(Linecount, 2); if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount, 255)); plot.setRenderer(Linecount, renderer); } else { rendererb = new XYBarRenderer(); rendererb.setSeriesPaint(0, getColour(Linecount, 150)); rendererb.setShadowVisible(false); rendererb.setDrawBarOutline(false); rendererb.setBarPainter(new StandardXYBarPainter()); plot.setRenderer(Linecount, rendererb); } Linecount++; if (Vergleich == true) { SummeZeit = 0; Summekm = 0; Summehm = 0; SummeZeit12Mon = 0; Summekm12Mon = 0; Summehm12Mon = 0; for (i = 0; i < 366; i++) { SummeZeit12Mon += (double) Zeit[SelektiertVergl - 1][i]; Summekm12Mon += (double) kmJahr[SelektiertVergl - 1][i]; Summehm12Mon += (double) HmJahr[SelektiertVergl - 1][i]; } y4Werte[0] = SummeZeit12Mon; y5Werte[0] = Summekm12Mon; y6Werte[0] = Summehm12Mon; for (i = 1; i < 366; i++) { try { } catch (Exception e) { JOptionPane.showMessageDialog(null, "Exception GregorianCalender " + e, "Achtung!", JOptionPane.ERROR_MESSAGE); } ; if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { SummeZeit += (double) Zeit[SelektiertVergl - 1][i]; Summekm += (double) kmJahr[SelektiertVergl - 1][i]; Summehm += (double) HmJahr[SelektiertVergl - 1][i]; y7Werte[i] = SummeZeit; y8Werte[i] = Summekm; y9Werte[i] = Summehm; y4Werte[i] = y4Werte[i - 1] - (double) Zeit[SelektiertVergl - 1][i] + (double) Zeit[Selektiert][i]; y5Werte[i] = y5Werte[i - 1] - (double) kmJahr[SelektiertVergl - 1][i] + (double) kmJahr[Selektiert][i]; y6Werte[i] = y6Werte[i - 1] - (double) HmJahr[SelektiertVergl - 1][i] + (double) HmJahr[Selektiert][i]; } else { Day n = new Day(1, xTime[i].getMonth(), xTime[i].getYear()); try { Kalender = new GregorianCalendar(xTime[i].getYear(), xTime[i].getMonth() - 1, 1); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Exception GregorianCalender " + e, "Achtung!", JOptionPane.ERROR_MESSAGE); } int j = (int) Kalender.get(Kalender.DAY_OF_YEAR); for (int m = 0; m < 5; m++) { y7Werte[j + m + 4] += (double) Zeit[SelektiertVergl - 1][i]; y8Werte[j + m + 14] += (double) kmJahr[SelektiertVergl - 1][i]; y9Werte[j + m + 24] += (double) HmJahr[SelektiertVergl - 1][i]; } } } if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { dataset = new TimeSeries("Trainingszeit ber 12 Monate "); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y4Werte[i]); } TimeSeriesCollection dataset4 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset4); plot.mapDatasetToRangeAxis(Linecount, 0); if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount, 255)); plot.setRenderer(Linecount, renderer); } else { rendererb = new XYBarRenderer(); rendererb.setSeriesPaint(0, getColour(Linecount, 150)); rendererb.setShadowVisible(false); rendererb.setBarPainter(new StandardXYBarPainter()); plot.setRenderer(Linecount, rendererb); } Linecount++; dataset = new TimeSeries("Trainingskilometer ber 12 Monate "); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y5Werte[i]); } TimeSeriesCollection dataset5 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset5); plot.mapDatasetToRangeAxis(Linecount, 1); if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount, 255)); plot.setRenderer(Linecount, renderer); } else { rendererb = new XYBarRenderer(); rendererb.setSeriesPaint(0, getColour(Linecount, 150)); rendererb.setShadowVisible(false); rendererb.setGradientPaintTransformer(null); rendererb.setBarPainter(new StandardXYBarPainter()); plot.setRenderer(Linecount, rendererb); } Linecount++; dataset = new TimeSeries("Trainingshhenmeter ber 12 Monate "); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y6Werte[i]); } TimeSeriesCollection dataset6 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset6); plot.mapDatasetToRangeAxis(Linecount, 2); if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount, 255)); plot.setRenderer(Linecount, renderer); } else { rendererb = new XYBarRenderer(); rendererb.setSeriesPaint(0, getColour(Linecount, 150)); rendererb.setShadowVisible(false); rendererb.setGradientPaintTransformer(null); rendererb.setBarPainter(new StandardXYBarPainter()); plot.setRenderer(Linecount, rendererb); } } Linecount++; dataset = new TimeSeries("Trainingszeit " + JTronicHandle.JahrVergleich.getSelectedItem().toString()); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y7Werte[i]); } TimeSeriesCollection dataset7 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset7); plot.mapDatasetToRangeAxis(Linecount, 0); if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount, 255)); plot.setRenderer(Linecount, renderer); } else { rendererb = new XYBarRenderer(); rendererb.setSeriesPaint(0, getColour(Linecount, 150)); rendererb.setShadowVisible(false); rendererb.setGradientPaintTransformer(null); rendererb.setBarPainter(new StandardXYBarPainter()); plot.setRenderer(Linecount, rendererb); } Linecount++; dataset = new TimeSeries( "Trainingskilometer " + JTronicHandle.JahrVergleich.getSelectedItem().toString()); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y8Werte[i]); } TimeSeriesCollection dataset8 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset8); plot.mapDatasetToRangeAxis(Linecount, 1); if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount, 255)); plot.setRenderer(Linecount, renderer); } else { rendererb = new XYBarRenderer(); rendererb.setSeriesPaint(0, getColour(Linecount, 150)); rendererb.setShadowVisible(false); rendererb.setGradientPaintTransformer(null); rendererb.setBarPainter(new StandardXYBarPainter()); plot.setRenderer(Linecount, rendererb); } Linecount++; dataset = new TimeSeries( "Trainingshhenmeter " + JTronicHandle.JahrVergleich.getSelectedItem().toString()); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y9Werte[i]); } TimeSeriesCollection dataset9 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount, dataset9); plot.mapDatasetToRangeAxis(Linecount, 2); if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, getColour(Linecount, 255)); plot.setRenderer(Linecount, renderer); } else { rendererb = new XYBarRenderer(); rendererb.setSeriesPaint(0, getColour(Linecount, 150)); rendererb.setShadowVisible(false); rendererb.setGradientPaintTransformer(null); rendererb.setBarPainter(new StandardXYBarPainter()); plot.setRenderer(Linecount, rendererb); } } if (!JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { double max = axis.getRange().getUpperBound(); for (i = 0; i < 12; i++) { try { Kalender = new GregorianCalendar(Integer.parseInt(DataProperty.getProperty("Jahr", "0")), i, 1); } catch (Exception e) { JOptionPane.showMessageDialog(null, "JUebersicht\nException GregorianCalender " + e, "Achtung!", JOptionPane.ERROR_MESSAGE); } y10Werte[Kalender.get(Kalender.DAY_OF_YEAR)] = max; y10Werte[Kalender.get(Kalender.DAY_OF_YEAR) + 1] = 0; } dataset = new TimeSeries(""); for (i = 0; i < 366; i++) { dataset.add(xTime[i], y10Werte[i]); } TimeSeriesCollection dataset10 = new TimeSeriesCollection(dataset); plot.setDataset(Linecount + 1, dataset10); plot.mapDatasetToRangeAxis(Linecount + 1, 0); renderer = new StandardXYItemRenderer(2, ToolTip); renderer.setSeriesPaint(0, Color.white); plot.setRenderer(Linecount + 1, renderer); plot.getDomainAxis().setAutoRange(false); axis.setRange(0, max); } if (JTronicHandle.jRadioButton_jahresverlauf.isSelected()) { axis2.setRange(0, axis2.getRange().getUpperBound() * 1.5); axis3.setRange(0, axis3.getRange().getUpperBound() * 2); plot.setDomainCrosshairValue( (double) new GregorianCalendar(Jahr, Today.get(Today.MONTH), Today.get(Today.DAY_OF_MONTH)) .getTimeInMillis()); } chart.setPadding(padding); ChartPanel Panel = new ChartPanel(chart); Panel.setDismissDelay(100000); return Panel; }
From source file:de.tor.tribes.ui.views.DSWorkbenchStatsFrame.java
private void setupPlotDrawing(XYPlot pPlot) { pPlot.setBackgroundPaint(Constants.DS_BACK_LIGHT); pPlot.setDomainGridlinePaint(Color.DARK_GRAY); pPlot.setRangeGridlinePaint(Color.DARK_GRAY); pPlot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); pPlot.setDomainCrosshairVisible(true); pPlot.setRangeCrosshairVisible(true); DateAxis axis = (DateAxis) pPlot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("dd.MM.yyyy HH:mm:ss")); }
From source file:io.github.mzmine.modules.plots.msspectrum.MsSpectrumPlotWindowController.java
public void initialize() { final JFreeChart chart = chartNode.getChart(); final XYPlot plot = chart.getXYPlot(); // Do not set colors and strokes dynamically. They are instead provided // by the dataset and configured in configureRenderer() plot.setDrawingSupplier(null);/* ww w . j a v a 2s. c om*/ plot.setDomainGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setRangeGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); // chart properties chart.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); // legend properties LegendTitle legend = chart.getLegend(); // legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); // set the X axis (m/z) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setLabel("m/z"); xAxis.setUpperMargin(0.03); xAxis.setLowerMargin(0.03); xAxis.setRangeType(RangeType.POSITIVE); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setLabel("Intensity"); yAxis.setRangeType(RangeType.POSITIVE); yAxis.setAutoRangeIncludesZero(true); // set the fixed number formats, because otherwise JFreeChart sometimes // shows exponent, sometimes it doesn't DecimalFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); xAxis.setNumberFormatOverride(mzFormat); DecimalFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); yAxis.setNumberFormatOverride(intensityFormat); chartTitle = chartNode.getChart().getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartNode.setCursor(Cursor.CROSSHAIR); // Remove the dataset if it is removed from the list datasets.addListener((Change<? extends MsSpectrumDataSet> c) -> { while (c.next()) { if (c.wasRemoved()) { for (MsSpectrumDataSet ds : c.getRemoved()) { int index = plot.indexOf(ds); plot.setDataset(index, null); } } } }); itemLabelsVisible.addListener((prop, oldVal, newVal) -> { for (MsSpectrumDataSet dataset : datasets) { int datasetIndex = plot.indexOf(dataset); XYItemRenderer renderer = plot.getRenderer(datasetIndex); renderer.setBaseItemLabelsVisible(newVal); } }); legendVisible.addListener((prop, oldVal, newVal) -> { legend.setVisible(newVal); }); }
From source file:org.jfree.chart.demo.JFreeChartDemoBase.java
/** * Creates and returns a sample scatter plot. * * @return a sample scatter plot./* www . jav a 2 s . com*/ */ public JFreeChart createScatterPlot() { // create a default chart based on some sample data... final String title = this.resources.getString("other.scatter.title"); final String domain = this.resources.getString("other.scatter.domain"); final String range = this.resources.getString("other.scatter.range"); final XYDataset data = new SampleXYDataset2(); final JFreeChart chart = ChartFactory.createScatterPlot(title, domain, range, data, PlotOrientation.VERTICAL, true, true, // tooltips false // urls ); // then customise it a little... chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 1000, 0, Color.green)); final XYPlot plot = chart.getXYPlot(); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); return chart; }