List of usage examples for org.jfree.data.time Month Month
public Month(Date time, TimeZone zone)
Month
instance, based on a date/time and a time zone. From source file:org.jfree.data.time.MonthTest.java
/** * Two objects that are equal are required to return the same hashCode. *//*from w w w . ja va 2s .co m*/ @Test public void testHashcode() { Month m1 = new Month(2, 2003); Month m2 = new Month(2, 2003); assertTrue(m1.equals(m2)); int h1 = m1.hashCode(); int h2 = m2.hashCode(); assertEquals(h1, h2); }
From source file:CargarEntrenamiento.grafica2.java
public void iejmplo() { s1.add(new Month(2, 2001), 181.8); //s1.add(new Week(1, 1), null); s1.add(new Month(3, 2001), 167.3); s1.add(new Month(4, 2001), 153.8); s1.add(new Month(5, 2001), 167.6); s1.add(new Month(6, 2001), 158.8); s1.add(new Month(7, 2001), 148.3); s1.add(new Month(8, 2001), 153.9); s1.add(new Month(9, 2001), 142.7); s1.add(new Month(10, 2001), 123.2); s1.add(new Month(11, 2001), 131.8); s1.add(new Month(12, 2001), 139.6); s1.add(new Month(1, 2002), 142.9); s1.add(new Month(2, 2002), 138.7); s1.add(new Month(3, 2002), 137.3); s1.add(new Month(4, 2002), 143.9); s1.add(new Month(5, 2002), 139.8); s1.add(new Month(6, 2002), 137.0); s1.add(new Month(7, 2002), 132.8); TimeSeries s2 = new TimeSeries("L&G UK Index Trust"); s2.add(new Month(2, 2001), 129.6); s2.add(new Month(3, 2001), 123.2); s2.add(new Month(4, 2001), 117.2); s2.add(new Month(5, 2001), 124.1); s2.add(new Month(6, 2001), 122.6); s2.add(new Month(7, 2001), 119.2); s2.add(new Month(8, 2001), 116.5); s2.add(new Month(9, 2001), 112.7); s2.add(new Month(10, 2001), 101.5); s2.add(new Month(11, 2001), 106.1); s2.add(new Month(12, 2001), 110.3); s2.add(new Month(1, 2002), 111.7); s2.add(new Month(2, 2002), 111.0); s2.add(new Month(3, 2002), 109.6); s2.add(new Month(4, 2002), 113.2); s2.add(new Month(5, 2002), 111.6); s2.add(new Month(6, 2002), 108.8); s2.add(new Month(7, 2002), 101.6); TimeSeries s3 = new TimeSeries("andres2255"); s3.add(new Month(2, 2001), 129.6); s3.add(new Month(10, 2001), 106.1); s3.add(new Month(1, 2002), 111.7); s3.add(new Month(2, 2002), 111.0); datos.addSeries(s1);//from www . ja v a2s . c o m datos.addSeries(s2); datos.addSeries(s3); grafica = ChartFactory.createTimeSeriesChart("titulo", "etiquetas X", "etiquetaY", datos, true, true, false); /// grafica.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) grafica.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); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); } DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); }
From source file:org.jfree.data.time.MonthTest.java
/** * The {@link Month} class is immutable, so should not be {@link Cloneable}. *//*from w ww . j ava2 s .co m*/ @Test public void testNotCloneable() { Month m = new Month(2, 2003); assertFalse(m instanceof Cloneable); }
From source file:org.jfree.data.time.junit.MonthTest.java
/** * Serialize an instance, restore it, and check for equality. *//*from ww w . j a v a2 s .c om*/ public void testSerialization() { Month m1 = new Month(12, 1999); Month m2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(m1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); m2 = (Month) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(m1, m2); }
From source file:graficoComparacion.graficaCompa.java
public void grafica1() { s1.add(new Month(4, 2001), 153.8); s1.add(new Month(5, 2001), 167.6); s1.add(new Month(6, 2001), 158.8); s1.add(new Month(7, 2001), 148.3); s1.add(new Month(8, 2001), 153.9); s1.add(new Month(9, 2001), 142.7); s1.add(new Month(10, 2001), 123.2); s1.add(new Month(11, 2001), 131.8); s1.add(new Month(12, 2001), 139.6); s1.add(new Month(1, 2002), 142.9); s1.add(new Month(2, 2002), 138.7); s1.add(new Month(3, 2002), 137.3); s1.add(new Month(4, 2002), 143.9); s1.add(new Month(5, 2002), 139.8); s1.add(new Month(6, 2002), 137.0); s1.add(new Month(7, 2002), 132.8); TimeSeries s2 = new TimeSeries("L&G UK Index Trust"); s2.add(new Month(2, 2001), 129.6); s2.add(new Month(3, 2001), 123.2); s2.add(new Month(4, 2001), 117.2); s2.add(new Month(5, 2001), 124.1); s2.add(new Month(6, 2001), 122.6); s2.add(new Month(7, 2001), 119.2); s2.add(new Month(8, 2001), 116.5); s2.add(new Month(9, 2001), 112.7); s2.add(new Month(10, 2001), 101.5); s2.add(new Month(11, 2001), 106.1); s2.add(new Month(12, 2001), 110.3); s2.add(new Month(1, 2002), 111.7); s2.add(new Month(2, 2002), 111.0); s2.add(new Month(3, 2002), 109.6); s2.add(new Month(4, 2002), 113.2); s2.add(new Month(5, 2002), 111.6); s2.add(new Month(6, 2002), 108.8); s2.add(new Month(7, 2002), 101.6); TimeSeries s3 = new TimeSeries("andres2255"); s3.add(new Month(2, 2001), 129.6); s3.add(new Month(10, 2001), 106.1); s3.add(new Month(1, 2002), 111.7); s3.add(new Month(2, 2002), 111.0); datos.addSeries(s1);//from w w w. j av a 2 s . c o m datos.addSeries(s2); datos.addSeries(s3); }
From source file:org.jfree.data.time.MonthTest.java
/** * Some checks for the getFirstMillisecond() method. *//* ww w. j a va 2 s.com*/ @Test public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Month m = new Month(3, 1970); assertEquals(5094000000L, m.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.junit.MonthTest.java
/** * Two objects that are equal are required to return the same hashCode. *//* www. j a v a 2s . c om*/ public void testHashcode() { Month m1 = new Month(2, 2003); Month m2 = new Month(2, 2003); assertTrue(m1.equals(m2)); int h1 = m1.hashCode(); int h2 = m2.hashCode(); assertEquals(h1, h2); }
From source file:org.jfree.data.time.MonthTest.java
/** * Some checks for the getFirstMillisecond(TimeZone) method. *///from w w w . j a v a2 s . c o m @Test public void testGetFirstMillisecondWithTimeZone() { Month m = new Month(2, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); assertEquals(-628444800000L, m.getFirstMillisecond(zone)); // try null calendar boolean pass = false; try { m.getFirstMillisecond((TimeZone) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.time.Month.java
/** * Returns the month preceding this one. Note that the returned * {@link Month} is "pegged" using the default time-zone, irrespective of * the time-zone used to peg of the current month (which is not recorded * anywhere). See the {@link #peg(Calendar)} method. * * @return The month preceding this one. *//*w ww. java2 s . c o m*/ @Override public RegularTimePeriod previous() { Month result; if (this.month != MonthConstants.JANUARY) { result = new Month(this.month - 1, this.year); } else { if (this.year > 1900) { result = new Month(MonthConstants.DECEMBER, this.year - 1); } else { result = null; } } return result; }
From source file:org.jfree.data.time.junit.MonthTest.java
/** * The {@link Month} class is immutable, so should not be {@link Cloneable}. *///from w ww . j a v a 2s . c om public void testNotCloneable() { Month m = new Month(2, 2003); assertFalse(m instanceof Cloneable); }