List of usage examples for org.jfree.data.time TimeSeries add
public void add(RegularTimePeriod period, Number value)
From source file:org.jfree.data.time.TimeSeriesTest.java
@Test public void testGetMinY2() { TimeSeries ts = new TimeSeries("Time Series"); assertTrue(Double.isNaN(ts.getMinY())); ts.add(new Year(2014), 1.0); assertEquals(1.0, ts.getMinY(), EPSILON); ts.addOrUpdate(new Year(2014), null); assertTrue(Double.isNaN(ts.getMinY())); ts.addOrUpdate(new Year(2014), 1.0); assertEquals(1.0, ts.getMinY(), EPSILON); ts.clear();/*w ww.j a v a 2s .co m*/ assertTrue(Double.isNaN(ts.getMinY())); }
From source file:org.jfree.data.time.TimeSeriesTest.java
@Test public void testGetMaxY2() { TimeSeries ts = new TimeSeries("Time Series"); assertTrue(Double.isNaN(ts.getMaxY())); ts.add(new Year(2014), 1.0); assertEquals(1.0, ts.getMaxY(), EPSILON); ts.addOrUpdate(new Year(2014), null); assertTrue(Double.isNaN(ts.getMaxY())); ts.addOrUpdate(new Year(2014), 1.0); assertEquals(1.0, ts.getMaxY(), EPSILON); ts.clear();/* w w w. jav a 2 s . c o m*/ assertTrue(Double.isNaN(ts.getMaxY())); }
From source file:org.infoglue.deliver.util.charts.TimeSeriesDiagram.java
/** * Creates a dataset, consisting of two series of monthly data. * * @return the dataset.//from w w w .java2s . co m */ private XYDataset createDataset() throws Exception { TimeSeriesCollection timeSeriesDataset = new TimeSeriesCollection(); Document document = new DOMBuilder().getDocument(this.xmlData); this.writeDebug(document); Element headerElement = (Element) document.selectSingleNode("//chartHeader"); this.header = headerElement.getText(); Element axisYHeaderElement = (Element) document.selectSingleNode("//axisYHeader"); this.axisYHeader = axisYHeaderElement.getText(); Element axisXHeaderElement = (Element) document.selectSingleNode("//axisXHeader"); this.axisXHeader = axisXHeaderElement.getText(); Element timeGranularityElement = (Element) document.selectSingleNode("//timeGranularity"); this.timeGranulariry = timeGranularityElement.getText(); Element dateFormatElement = (Element) document.selectSingleNode("//dateFormat"); this.dateFormat = dateFormatElement.getText(); List series = document.selectNodes("//Series"); Iterator seriesIterator = series.iterator(); while (seriesIterator.hasNext()) { Element serieElement = (Element) seriesIterator.next(); String serieName = serieElement.attributeValue("name"); TimeSeries s1 = null; if (this.timeGranulariry.equalsIgnoreCase("Month")) s1 = new TimeSeries(serieName, Month.class); else if (this.timeGranulariry.equalsIgnoreCase("Week")) s1 = new TimeSeries(serieName, Week.class); List items = serieElement.selectNodes("Item"); Iterator itemsIterator = items.iterator(); while (itemsIterator.hasNext()) { Element itemElement = (Element) itemsIterator.next(); Element yearElement = (Element) itemElement.selectSingleNode("yearId"); Element timeElement = (Element) itemElement.selectSingleNode("timeId"); Element valueElement = (Element) itemElement.selectSingleNode("value"); String year = yearElement.getText(); String time = timeElement.getText(); String value = valueElement.getText(); if (this.timeGranulariry.equalsIgnoreCase("Month")) s1.add(new Month(new Integer(time).intValue(), new Integer(year).intValue()), new Float(value)); else if (this.timeGranulariry.equalsIgnoreCase("Week")) s1.add(new Week(new Integer(time).intValue(), new Integer(year).intValue()), new Float(value)); } timeSeriesDataset.addSeries(s1); //timeSeriesDataset.addSeries(s2); timeSeriesDataset.setDomainIsPointsInTime(true); } return timeSeriesDataset; }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Some simple checks for the hashCode() method. *//*from w ww . j a v a2 s . co m*/ public void testHashCode() { TimeSeries s1 = new TimeSeries("Test"); TimeSeries s2 = new TimeSeries("Test"); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); s1.add(new Day(1, 1, 2007), 500.0); s2.add(new Day(1, 1, 2007), 500.0); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); s1.add(new Day(2, 1, 2007), null); s2.add(new Day(2, 1, 2007), null); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); s1.add(new Day(5, 1, 2007), 111.0); s2.add(new Day(5, 1, 2007), 111.0); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); s1.add(new Day(9, 1, 2007), 1.0); s2.add(new Day(9, 1, 2007), 1.0); assertEquals(s1, s2); assertEquals(s1.hashCode(), s2.hashCode()); }
From source file:org.jfree.data.time.TimeSeriesTest.java
/** * Some tests to ensure that the createCopy(int, int) method is * functioning correctly.//from ww w . j a va 2 s .c o m */ @Test public void testCreateCopy2() { TimeSeries series = new TimeSeries("Series", Month.class); series.add(new Month(MonthConstants.JANUARY, 2003), 45.0); series.add(new Month(MonthConstants.FEBRUARY, 2003), 55.0); series.add(new Month(MonthConstants.JUNE, 2003), 35.0); series.add(new Month(MonthConstants.NOVEMBER, 2003), 85.0); series.add(new Month(MonthConstants.DECEMBER, 2003), 75.0); try { // copy just the first item... TimeSeries result1 = series.createCopy(0, 0); assertEquals(new Month(1, 2003), result1.getTimePeriod(0)); // copy the first two items... result1 = series.createCopy(0, 1); assertEquals(new Month(2, 2003), result1.getTimePeriod(1)); // copy the middle three items... result1 = series.createCopy(1, 3); assertEquals(new Month(2, 2003), result1.getTimePeriod(0)); assertEquals(new Month(11, 2003), result1.getTimePeriod(2)); // copy the last two items... result1 = series.createCopy(3, 4); assertEquals(new Month(11, 2003), result1.getTimePeriod(0)); assertEquals(new Month(12, 2003), result1.getTimePeriod(1)); // copy the last item... result1 = series.createCopy(4, 4); assertEquals(new Month(12, 2003), result1.getTimePeriod(0)); } catch (CloneNotSupportedException e) { assertTrue(false); } // check negative first argument boolean pass = false; try { /* TimeSeries result = */ series.createCopy(-1, 1); } catch (IllegalArgumentException e) { pass = true; } catch (CloneNotSupportedException e) { pass = false; } assertTrue(pass); // check second argument less than first argument pass = false; try { /* TimeSeries result = */ series.createCopy(1, 0); } catch (IllegalArgumentException e) { pass = true; } catch (CloneNotSupportedException e) { pass = false; } assertTrue(pass); TimeSeries series2 = new TimeSeries("Series 2"); try { TimeSeries series3 = series2.createCopy(99, 999); assertEquals(0, series3.getItemCount()); } catch (CloneNotSupportedException e) { assertTrue(false); } }
From source file:com.hello2morrow.sonargraph.jenkinsplugin.model.TimeSeriesPlot.java
/** * Creates a XYDataset from a CSV file./*from w w w .j a v a2s . c o m*/ */ @Override protected XYDataset createXYDataset(SonargraphMetrics metric, int maximumNumberOfDataPoints) throws IOException { assert metric != null : "Parameter 'metric' of method 'createXYDataset' must not be null"; //For some reason, the class of the time series is required here, otherwise an exception is thrown that a Date instance is expected. @SuppressWarnings("deprecation") TimeSeries timeSeries = new TimeSeries(metric.getShortDescription(), FixedMillisecond.class); List<IDataPoint> dataset = m_datasetProvider.readMetricValues(metric); int size = dataset.size(); SonargraphLogger.INSTANCE.fine(size + " data points found for metric '" + metric.getStandardName() + "' in file '" + m_datasetProvider.getStorageName() + "'"); List<IDataPoint> reducedSet = reduceDataSet(dataset, maximumNumberOfDataPoints); BuildDataPoint point = null; for (IDataPoint datapoint : reducedSet) { if (datapoint instanceof InvalidDataPoint) { // We could create a gap in the graph by adding null: // xySeries.add(datapoint.getX(), null); continue; } else if (datapoint instanceof BuildDataPoint) { point = (BuildDataPoint) datapoint; if (point.getTimestamp() == 0) { continue; } timeSeries.add(new FixedMillisecond(point.getTimestamp()), point.getY()); } } if (point != null) { setTimestampOfLastDisplayedPoint(point.getTimestamp()); } TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection(); TimeSeries avgDataset = MovingAverage.createMovingAverage(timeSeries, "Avg of " + metric.getShortDescription(), MOVING_AVG_PERIOD, 0); setDataSetSize(avgDataset.getItemCount()); timeSeriesCollection.addSeries(avgDataset); //SG-325: We cannot use JFreeChart methods of version 1.0.14 // setMinimumValue(avgDataset.getMinY()); // setMaximumValue(avgDataset.getMaxY()); // We only show the average data and omit the original data // timeSeriesCollection.addSeries(timeSeries); for (Object item : avgDataset.getItems()) { if (item instanceof TimeSeriesDataItem) { checkMinMaxYValue(((TimeSeriesDataItem) item).getValue().doubleValue()); } } return timeSeriesCollection; }
From source file:org.jfree.data.time.TimeSeriesTest.java
/** * Some tests to ensure that the createCopy(RegularTimePeriod, * RegularTimePeriod) method is functioning correctly. */// ww w . jav a 2 s . c om @Test public void testCreateCopy1() { TimeSeries series = new TimeSeries("Series", Month.class); series.add(new Month(MonthConstants.JANUARY, 2003), 45.0); series.add(new Month(MonthConstants.FEBRUARY, 2003), 55.0); series.add(new Month(MonthConstants.JUNE, 2003), 35.0); series.add(new Month(MonthConstants.NOVEMBER, 2003), 85.0); series.add(new Month(MonthConstants.DECEMBER, 2003), 75.0); try { // copy a range before the start of the series data... TimeSeries result1 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.DECEMBER, 2002)); assertEquals(0, result1.getItemCount()); // copy a range that includes only the first item in the series... TimeSeries result2 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.JANUARY, 2003)); assertEquals(1, result2.getItemCount()); // copy a range that begins before and ends in the middle of the // series... TimeSeries result3 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.APRIL, 2003)); assertEquals(2, result3.getItemCount()); TimeSeries result4 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.DECEMBER, 2003)); assertEquals(5, result4.getItemCount()); TimeSeries result5 = series.createCopy(new Month(MonthConstants.NOVEMBER, 2002), new Month(MonthConstants.MARCH, 2004)); assertEquals(5, result5.getItemCount()); TimeSeries result6 = series.createCopy(new Month(MonthConstants.JANUARY, 2003), new Month(MonthConstants.JANUARY, 2003)); assertEquals(1, result6.getItemCount()); TimeSeries result7 = series.createCopy(new Month(MonthConstants.JANUARY, 2003), new Month(MonthConstants.APRIL, 2003)); assertEquals(2, result7.getItemCount()); TimeSeries result8 = series.createCopy(new Month(MonthConstants.JANUARY, 2003), new Month(MonthConstants.DECEMBER, 2003)); assertEquals(5, result8.getItemCount()); TimeSeries result9 = series.createCopy(new Month(MonthConstants.JANUARY, 2003), new Month(MonthConstants.MARCH, 2004)); assertEquals(5, result9.getItemCount()); TimeSeries result10 = series.createCopy(new Month(MonthConstants.MAY, 2003), new Month(MonthConstants.DECEMBER, 2003)); assertEquals(3, result10.getItemCount()); TimeSeries result11 = series.createCopy(new Month(MonthConstants.MAY, 2003), new Month(MonthConstants.MARCH, 2004)); assertEquals(3, result11.getItemCount()); TimeSeries result12 = series.createCopy(new Month(MonthConstants.DECEMBER, 2003), new Month(MonthConstants.DECEMBER, 2003)); assertEquals(1, result12.getItemCount()); TimeSeries result13 = series.createCopy(new Month(MonthConstants.DECEMBER, 2003), new Month(MonthConstants.MARCH, 2004)); assertEquals(1, result13.getItemCount()); TimeSeries result14 = series.createCopy(new Month(MonthConstants.JANUARY, 2004), new Month(MonthConstants.MARCH, 2004)); assertEquals(0, result14.getItemCount()); } catch (CloneNotSupportedException e) { assertTrue(false); } }
From source file:org.jfree.data.time.TimeSeriesTest.java
/** * Some checks for the getIndex() method. *///ww w .java 2s . c o m @Test public void testGetIndex() { TimeSeries series = new TimeSeries("Series", Month.class); assertEquals(-1, series.getIndex(new Month(1, 2003))); series.add(new Month(1, 2003), 45.0); assertEquals(0, series.getIndex(new Month(1, 2003))); assertEquals(-1, series.getIndex(new Month(12, 2002))); assertEquals(-2, series.getIndex(new Month(2, 2003))); series.add(new Month(3, 2003), 55.0); assertEquals(-1, series.getIndex(new Month(12, 2002))); assertEquals(0, series.getIndex(new Month(1, 2003))); assertEquals(-2, series.getIndex(new Month(2, 2003))); assertEquals(1, series.getIndex(new Month(3, 2003))); assertEquals(-3, series.getIndex(new Month(4, 2003))); }
From source file:org.jfree.data.time.TimeSeriesTest.java
/** * Check that cloning works./*from w w w .ja v a2 s . c om*/ */ @Test public void testClone() throws CloneNotSupportedException { TimeSeries series = new TimeSeries("Test Series"); RegularTimePeriod jan1st2002 = new Day(1, MonthConstants.JANUARY, 2002); series.add(jan1st2002, new Integer(42)); TimeSeries clone; clone = (TimeSeries) series.clone(); clone.setKey("Clone Series"); clone.update(jan1st2002, new Integer(10)); int seriesValue = series.getValue(jan1st2002).intValue(); int cloneValue = clone.getValue(jan1st2002).intValue(); assertEquals(42, seriesValue); assertEquals(10, cloneValue); assertEquals("Test Series", series.getKey()); assertEquals("Clone Series", clone.getKey()); }
From source file:v800_trainer.JUebersicht.java
public JPanel Update_Uebersicht(JCicloTronic JTronicHandle) { int i;//from w w w. ja va2 s.c om 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; }