<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FAdvanced_Graphics%2FChart</id>
		<title>Java/Advanced Graphics/Chart - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FAdvanced_Graphics%2FChart"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Advanced_Graphics/Chart&amp;action=history"/>
		<updated>2026-04-21T15:00:12Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Advanced_Graphics/Chart&amp;diff=7595&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Advanced_Graphics/Chart&amp;diff=7595&amp;oldid=prev"/>
				<updated>2010-06-01T06:48:38Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:48, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Advanced_Graphics/Chart&amp;diff=7594&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Advanced_Graphics/Chart&amp;diff=7594&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Animation Line Chart ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.applet.*;&lt;br /&gt;
import java.net.URL;&lt;br /&gt;
import java.util.*;&lt;br /&gt;
import graph.*;&lt;br /&gt;
/*************************************************************************&lt;br /&gt;
**&lt;br /&gt;
**    Applet example2&lt;br /&gt;
**                                              Version 1.0   January 1996&lt;br /&gt;
**&lt;br /&gt;
**************************************************************************&lt;br /&gt;
**    Copyright (C) 1996 Leigh Brookshaw&lt;br /&gt;
**&lt;br /&gt;
**    This program is free software; you can redistribute it and/or modify&lt;br /&gt;
**    it under the terms of the GNU General Public License as published by&lt;br /&gt;
**    the Free Software Foundation; either version 2 of the License, or&lt;br /&gt;
**    (at your option) any later version.&lt;br /&gt;
**&lt;br /&gt;
**    This program is distributed in the hope that it will be useful,&lt;br /&gt;
**    but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
**    GNU General Public License for more details.&lt;br /&gt;
**&lt;br /&gt;
**    You should have received a copy of the GNU General Public License&lt;br /&gt;
**    along with this program; if not, write to the Free Software&lt;br /&gt;
**    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.&lt;br /&gt;
**************************************************************************&lt;br /&gt;
**&lt;br /&gt;
**    This is a simple applet that creates a Scroll Chart using the &lt;br /&gt;
**    Graph2D class library&lt;br /&gt;
**&lt;br /&gt;
*************************************************************************/&lt;br /&gt;
public class example2 extends Applet {&lt;br /&gt;
      Graph2D graph;&lt;br /&gt;
      Label title;&lt;br /&gt;
      DataSet data1 = new DataSet();&lt;br /&gt;
      CalculateData cd1;&lt;br /&gt;
      Axis    yaxis_right;&lt;br /&gt;
/*&lt;br /&gt;
**    In milliseconds how often do we want to add a new data point.&lt;br /&gt;
*/&lt;br /&gt;
      int period      = 500;&lt;br /&gt;
/*&lt;br /&gt;
**    Maximum number of points to display before scrolling the data&lt;br /&gt;
*/&lt;br /&gt;
      int maximum        = 25;&lt;br /&gt;
      URL markersURL;&lt;br /&gt;
/*&lt;br /&gt;
**    Initialize the applet. The Parameters passed are the title of the plot&lt;br /&gt;
**    the marker file to use and the update period in milliseconds&lt;br /&gt;
*/&lt;br /&gt;
      public void init() {&lt;br /&gt;
        int i;&lt;br /&gt;
        int j;&lt;br /&gt;
/*&lt;br /&gt;
**      Get the passed parameters&lt;br /&gt;
*/&lt;br /&gt;
        String st       = &amp;quot;TITLE&amp;quot;;&lt;br /&gt;
        String mfile    = &amp;quot;marker.txt&amp;quot;;&lt;br /&gt;
        period   = 10;//Integer.parseInt(getParameter(&amp;quot;PERIOD&amp;quot;));&lt;br /&gt;
/*&lt;br /&gt;
**      Create the Graph instance and modify the default behaviour&lt;br /&gt;
*/&lt;br /&gt;
        graph = new Graph2D();&lt;br /&gt;
        graph.zerocolor = new Color(0,255,0);&lt;br /&gt;
        graph.borderTop    = 50;&lt;br /&gt;
        graph.borderBottom = 50;&lt;br /&gt;
/*&lt;br /&gt;
**      Create the Title&lt;br /&gt;
*/&lt;br /&gt;
        title = new Label(st, Label.CENTER);&lt;br /&gt;
        title.setFont(new Font(&amp;quot;TimesRoman&amp;quot;,Font.PLAIN,25));&lt;br /&gt;
        setLayout( new BorderLayout() );&lt;br /&gt;
        add(&amp;quot;North&amp;quot;,  title);&lt;br /&gt;
        add(&amp;quot;Center&amp;quot;, graph);&lt;br /&gt;
/*&lt;br /&gt;
**      Load a file containing Marker definitions&lt;br /&gt;
*/&lt;br /&gt;
        try {&lt;br /&gt;
           markersURL = this.getClass().getResource(mfile);&lt;br /&gt;
           graph.setMarkers(new Markers(markersURL));&lt;br /&gt;
        } catch(Exception e) {&lt;br /&gt;
           System.out.println(&amp;quot;Failed to create Marker URL!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
**      Modify the default Data behaviour&lt;br /&gt;
*/&lt;br /&gt;
        data1.linecolor   = new Color(255,0,0);&lt;br /&gt;
        data1.marker      = 1;&lt;br /&gt;
        data1.markercolor = new Color(100,100,255);&lt;br /&gt;
/*&lt;br /&gt;
**      Setup the Axis. Attach it to the Graph2D instance, and attach the data&lt;br /&gt;
**      to it.&lt;br /&gt;
*/&lt;br /&gt;
        yaxis_right = graph.createAxis(Axis.RIGHT);&lt;br /&gt;
        yaxis_right.attachDataSet(data1);&lt;br /&gt;
        yaxis_right.setLabelFont(new Font(&amp;quot;Helvetica&amp;quot;,Font.PLAIN,20));&lt;br /&gt;
        graph.attachDataSet(data1);&lt;br /&gt;
/*&lt;br /&gt;
**      Calculate the data asynchronously using a new Thread.&lt;br /&gt;
*/&lt;br /&gt;
        cd1 = new CalculateData(data1,graph,period,maximum);&lt;br /&gt;
        cd1.start();&lt;br /&gt;
      }&lt;br /&gt;
      public static void main(String[] a){&lt;br /&gt;
         javax.swing.JFrame f = new javax.swing.JFrame();&lt;br /&gt;
         Applet app = new example2();&lt;br /&gt;
         app.init();&lt;br /&gt;
         &lt;br /&gt;
         f.getContentPane().add (app);&lt;br /&gt;
         f.pack();&lt;br /&gt;
         f.setSize (new Dimension (500, 500));&lt;br /&gt;
         f.setVisible(true);&lt;br /&gt;
      }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
** Here is the Thread class to calculate the data and append it to the existing&lt;br /&gt;
** data set.&lt;br /&gt;
** This class is easily modified to get the data from a server &lt;br /&gt;
** or the local machine. Currently the data is Random.&lt;br /&gt;
*/&lt;br /&gt;
class CalculateData extends Thread {&lt;br /&gt;
//      local copy of the update period in milliseconds&lt;br /&gt;
        int p = 1000;&lt;br /&gt;
        DataSet d;&lt;br /&gt;
        Graph2D g;&lt;br /&gt;
//      local copy of the maximum number of points.&lt;br /&gt;
        int m = 25;&lt;br /&gt;
        Random random = new Random();&lt;br /&gt;
&lt;br /&gt;
        public CalculateData(DataSet ds, Graph2D g, int p, int m)&lt;br /&gt;
        {&lt;br /&gt;
            this.d = ds;&lt;br /&gt;
            this.g = g;&lt;br /&gt;
            if(p &amp;gt; 100   ) this.p = p;&lt;br /&gt;
            if(m &amp;gt; 0     ) this.m = m;&lt;br /&gt;
  }&lt;br /&gt;
        public void run() {&lt;br /&gt;
              int i =0;&lt;br /&gt;
              double data[] = new double[2];&lt;br /&gt;
              int count = 0;&lt;br /&gt;
              if(d == null) return;&lt;br /&gt;
              setPriority(Thread.MIN_PRIORITY);&lt;br /&gt;
&lt;br /&gt;
              while(true) {&lt;br /&gt;
                   count++;&lt;br /&gt;
                   if(count &amp;gt;= m) d.delete(0,0);&lt;br /&gt;
                   data[1] = (2.0*random.nextDouble() - 1.0)*15.0;&lt;br /&gt;
                   data[0] = count;&lt;br /&gt;
                   try {&lt;br /&gt;
                        d.append(data,1);&lt;br /&gt;
          }&lt;br /&gt;
                   catch (Exception e) {&lt;br /&gt;
                        System.out.println(&amp;quot;Error appending Data!&amp;quot;);&lt;br /&gt;
                   }&lt;br /&gt;
                   d.yaxis.maximum = 15.0;&lt;br /&gt;
                   d.yaxis.minimum = -15.0;&lt;br /&gt;
//                 To avoid flashing try and repaint halfway through the sleep&lt;br /&gt;
                   g.repaint(p/2);&lt;br /&gt;
                   try {    sleep(p); }&lt;br /&gt;
                   catch(Exception e) { }&lt;br /&gt;
       }&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A rudimentary bar chart class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.util.*;&lt;br /&gt;
import javax.swing.*;&lt;br /&gt;
import no.geosoft.cc.geometry.Geometry;&lt;br /&gt;
import no.geosoft.cc.graphics.*;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * G demo program. Demonstrates:&lt;br /&gt;
 *&lt;br /&gt;
 * &amp;lt;ul&amp;gt;&lt;br /&gt;
 * &amp;lt;li&amp;gt;A rudimentory bar chart class&lt;br /&gt;
 * &amp;lt;li&amp;gt;Rendering techniques&lt;br /&gt;
 * &amp;lt;/ul&amp;gt;&lt;br /&gt;
 * &lt;br /&gt;
 * @author &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A rudimentary chart library ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.util.Iterator;&lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.awt.event.*;&lt;br /&gt;
import java.text.DecimalFormat;&lt;br /&gt;
import javax.swing.*;&lt;br /&gt;
import no.geosoft.cc.geometry.Geometry;&lt;br /&gt;
import no.geosoft.cc.util.NiceNumbers;&lt;br /&gt;
import no.geosoft.cc.util.NiceNumber;&lt;br /&gt;
import no.geosoft.cc.graphics.*;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * G demo program. Demonstrates:&lt;br /&gt;
 *&lt;br /&gt;
 * &amp;lt;ul&amp;gt;&lt;br /&gt;
 * &amp;lt;li&amp;gt;A rudimentary chart library&lt;br /&gt;
 * &amp;lt;li&amp;gt;The use of multiple scenes&lt;br /&gt;
 * &amp;lt;li&amp;gt;World extent usage&lt;br /&gt;
 * &amp;lt;li&amp;gt;Zooming and scrolling&lt;br /&gt;
 * &amp;lt;li&amp;gt;&amp;lt;em&amp;gt;Nice number&amp;lt;/em&amp;gt; generation&lt;br /&gt;
 * &amp;lt;/ul&amp;gt;&lt;br /&gt;
 * &lt;br /&gt;
 * @author &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== bar-graph drawable ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
/**&lt;br /&gt;
 * &lt;br /&gt;
 * LibSparkline : a free Java sparkline chart library&lt;br /&gt;
 * &lt;br /&gt;
 *&lt;br /&gt;
 * Project Info:  http://reporting.pentaho.org/libsparkline/&lt;br /&gt;
 *&lt;br /&gt;
 * (C) Copyright 2008, by Larry Ogrodnek, Pentaho Corporation and Contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * This library is free software; you can redistribute it and/or modify it under the terms&lt;br /&gt;
 * of the Apache License 2.0.&lt;br /&gt;
 *&lt;br /&gt;
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;&lt;br /&gt;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the Apache License 2.0 along with this library;&lt;br /&gt;
 * if not, a online version is available at http://www.apache.org/licenses/&lt;br /&gt;
 *&lt;br /&gt;
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.&lt;br /&gt;
 * in the United States and other countries.]&lt;br /&gt;
 *&lt;br /&gt;
 * ------------&lt;br /&gt;
 * BarGraphDrawable.java&lt;br /&gt;
 * ------------&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.awt.Graphics2D;&lt;br /&gt;
import java.awt.geom.Rectangle2D;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * A very fast and very simple bar-graph drawable. This code is based on the BarGraph class writen by Larry Ogrodnek&lt;br /&gt;
 * but instead of producing a low-resolution image, this class writes the content into a Graphics2D context.  &lt;br /&gt;
 *&lt;br /&gt;
 * @author Thomas Morgner&lt;br /&gt;
 */&lt;br /&gt;
public class BarGraphDrawable&lt;br /&gt;
{&lt;br /&gt;
  private static final int DEFAULT_SPACING = 2;&lt;br /&gt;
  private static final Color DEFAULT_COLOR = Color.gray;&lt;br /&gt;
  private static final Color DEFAULT_HIGH_COLOR = Color.black;&lt;br /&gt;
  private static final Color DEFAULT_LAST_COLOR = Color.red;&lt;br /&gt;
  private Number[] data;&lt;br /&gt;
  private Color color;&lt;br /&gt;
  private Color highColor;&lt;br /&gt;
  private Color lastColor;&lt;br /&gt;
  private Color background;&lt;br /&gt;
  private int spacing;&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates a default bargraph drawable with some sensible default colors and spacings.&lt;br /&gt;
   */&lt;br /&gt;
  public BarGraphDrawable()&lt;br /&gt;
  {&lt;br /&gt;
    this.highColor = BarGraphDrawable.DEFAULT_HIGH_COLOR;&lt;br /&gt;
    this.lastColor = BarGraphDrawable.DEFAULT_LAST_COLOR;&lt;br /&gt;
    this.color = BarGraphDrawable.DEFAULT_COLOR;&lt;br /&gt;
    this.spacing = BarGraphDrawable.DEFAULT_SPACING;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the numeric data for the drawable or null, if the drawable has no data.&lt;br /&gt;
   *&lt;br /&gt;
   * @return the data.&lt;br /&gt;
   */&lt;br /&gt;
  public Number[] getData()&lt;br /&gt;
  {&lt;br /&gt;
    return data;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Defines the numeric data for the drawable or null, if the drawable has no data.&lt;br /&gt;
   *&lt;br /&gt;
   * @param data the data (can be null).&lt;br /&gt;
   */&lt;br /&gt;
  public void setData(final Number[] data)&lt;br /&gt;
  {&lt;br /&gt;
    this.data = data;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the main color for the bars.&lt;br /&gt;
   *&lt;br /&gt;
   * @return the main color for the bars, never null.&lt;br /&gt;
   */&lt;br /&gt;
  public Color getColor()&lt;br /&gt;
  {&lt;br /&gt;
    return color;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Defines the main color for the bars.&lt;br /&gt;
   *&lt;br /&gt;
   * @param color the main color for the bars, never null.&lt;br /&gt;
   */&lt;br /&gt;
  public void setColor(final Color color)&lt;br /&gt;
  {&lt;br /&gt;
    if (color == null)&lt;br /&gt;
    {&lt;br /&gt;
      throw new NullPointerException();&lt;br /&gt;
    }&lt;br /&gt;
    this.color = color;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the color for the highest bars. This property is optional and the high-color can be null.&lt;br /&gt;
   *&lt;br /&gt;
   * @return the color for the higest bars, or null if high bars should not be marked specially.&lt;br /&gt;
   */&lt;br /&gt;
  public Color getHighColor()&lt;br /&gt;
  {&lt;br /&gt;
    return highColor;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Defines the color for the highest bars. This property is optional and the high-color can be null.&lt;br /&gt;
   *&lt;br /&gt;
   * @param highColor the color for the higest bars, or null if high bars should not be marked specially.&lt;br /&gt;
   */&lt;br /&gt;
  public void setHighColor(final Color highColor)&lt;br /&gt;
  {&lt;br /&gt;
    this.highColor = highColor;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the color for the last bar. This property is optional and the last-bar-color can be null.&lt;br /&gt;
   *&lt;br /&gt;
   * @return the color for the last bar in the graph, or null if last bars should not be marked specially.&lt;br /&gt;
   */&lt;br /&gt;
  public Color getLastColor()&lt;br /&gt;
  {&lt;br /&gt;
    return lastColor;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Defines the color for the last bar. This property is optional and the last-bar-color can be null.&lt;br /&gt;
   *&lt;br /&gt;
   * @param lastColor the color for the last bar in the graph, or null if last bars should not be marked specially.&lt;br /&gt;
   */&lt;br /&gt;
  public void setLastColor(final Color lastColor)&lt;br /&gt;
  {&lt;br /&gt;
    this.lastColor = lastColor;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the color for the background of the graph. This property can be null, in which case the bar&lt;br /&gt;
   * will have a transparent background.&lt;br /&gt;
   *&lt;br /&gt;
   * @return color for the background or null, if the graph has a transparent background color.&lt;br /&gt;
   */&lt;br /&gt;
  public Color getBackground()&lt;br /&gt;
  {&lt;br /&gt;
    return background;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Defines the color for the background of the graph. This property can be null, in which case the bar&lt;br /&gt;
   * will have a transparent background.&lt;br /&gt;
   *&lt;br /&gt;
   * @param background the background or null, if the graph has a transparent background color.&lt;br /&gt;
   */&lt;br /&gt;
  public void setBackground(final Color background)&lt;br /&gt;
  {&lt;br /&gt;
    this.background = background;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the spacing between the bars.&lt;br /&gt;
   *&lt;br /&gt;
   * @return the spacing between the bars.&lt;br /&gt;
   */&lt;br /&gt;
  public int getSpacing()&lt;br /&gt;
  {&lt;br /&gt;
    return spacing;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Defines the spacing between the bars.&lt;br /&gt;
   *&lt;br /&gt;
   * @param spacing the spacing between the bars.&lt;br /&gt;
   */&lt;br /&gt;
  public void setSpacing(final int spacing)&lt;br /&gt;
  {&lt;br /&gt;
    this.spacing = spacing;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Draws the bar-graph into the given Graphics2D context in the given area. This method will not draw a graph&lt;br /&gt;
   * if the data given is null or empty.&lt;br /&gt;
   *&lt;br /&gt;
   * @param g2 the graphics context on which the bargraph should be rendered. &lt;br /&gt;
   * @param drawArea the area on which the bargraph should be drawn.&lt;br /&gt;
   */&lt;br /&gt;
  public void draw(Graphics2D g2, Rectangle2D drawArea)&lt;br /&gt;
  {&lt;br /&gt;
    if (g2 == null)&lt;br /&gt;
    {&lt;br /&gt;
      throw new NullPointerException();&lt;br /&gt;
    }&lt;br /&gt;
    if (drawArea == null)&lt;br /&gt;
    {&lt;br /&gt;
      throw new NullPointerException();&lt;br /&gt;
    }&lt;br /&gt;
    final int height = (int) drawArea.getHeight();&lt;br /&gt;
    if (height &amp;lt;= 0)&lt;br /&gt;
    {&lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    Graphics2D g = (Graphics2D) g2.create();&lt;br /&gt;
    g.translate(drawArea.getX(), drawArea.getY());&lt;br /&gt;
    if (background != null)&lt;br /&gt;
    {&lt;br /&gt;
      g.setBackground(background);&lt;br /&gt;
      g.clearRect(0, 0, (int) drawArea.getWidth(), height);&lt;br /&gt;
    }&lt;br /&gt;
    if (data == null || data.length == 0)&lt;br /&gt;
    {&lt;br /&gt;
      g.dispose();&lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
    final float d = getDivisor(data, height);&lt;br /&gt;
    final int a = computeAverage(data);&lt;br /&gt;
    final int spacing1 = getSpacing();&lt;br /&gt;
    final int w = ((int) drawArea.getWidth() - (spacing1 * data.length)) / data.length;&lt;br /&gt;
    int x = 0;&lt;br /&gt;
    final int y = 0;&lt;br /&gt;
    final double vHeight = drawArea.getHeight();&lt;br /&gt;
    final Rectangle2D.Double bar = new Rectangle2D.Double();&lt;br /&gt;
    &lt;br /&gt;
    for (int index = 0; index &amp;lt; data.length; index++)&lt;br /&gt;
    {&lt;br /&gt;
      Number i = data[index];&lt;br /&gt;
      if (i == null)&lt;br /&gt;
      {&lt;br /&gt;
        continue;&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      final int h = (int) (i.floatValue() / d);&lt;br /&gt;
      final int intVal = i.intValue();&lt;br /&gt;
      if (index == (data.length - 1) &amp;amp;&amp;amp; lastColor != null)&lt;br /&gt;
      {&lt;br /&gt;
        g.setPaint(lastColor);&lt;br /&gt;
      }&lt;br /&gt;
      else if (intVal &amp;lt; a || (highColor == null))&lt;br /&gt;
      {&lt;br /&gt;
        g.setPaint(color);&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
        g.setPaint(highColor);&lt;br /&gt;
      }&lt;br /&gt;
      bar.setRect(x, y + (vHeight - h), w, intVal / d);&lt;br /&gt;
      g.fill(bar);&lt;br /&gt;
      x += (w + spacing1);&lt;br /&gt;
    }&lt;br /&gt;
    g.dispose();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Computes the average for all numbers in the array.&lt;br /&gt;
   *&lt;br /&gt;
   * @param data the numbers for which the average should be computed.&lt;br /&gt;
   * @return the average.&lt;br /&gt;
   */&lt;br /&gt;
  private static int computeAverage(final Number[] data)&lt;br /&gt;
  {&lt;br /&gt;
    int total = 0;&lt;br /&gt;
    int length = 0;&lt;br /&gt;
    for (int index = 0; index &amp;lt; data.length; index++)&lt;br /&gt;
    {&lt;br /&gt;
      Number i = data[index];&lt;br /&gt;
      if (i == null)&lt;br /&gt;
      {&lt;br /&gt;
        continue;&lt;br /&gt;
      }&lt;br /&gt;
      total += i.intValue();&lt;br /&gt;
      length += 1;&lt;br /&gt;
    }&lt;br /&gt;
    return (total / length);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Computes the scale factor to scale the given numeric data into the target&lt;br /&gt;
   * height.&lt;br /&gt;
   * &lt;br /&gt;
   * @param data&lt;br /&gt;
   *          the numeric data.&lt;br /&gt;
   * @param height&lt;br /&gt;
   *          the target height of the graph.&lt;br /&gt;
   * @return the scale factor.&lt;br /&gt;
   */&lt;br /&gt;
  public static float getDivisor(final Number[] data, final int height) {&lt;br /&gt;
    if (data == null) {&lt;br /&gt;
      throw new NullPointerException(&amp;quot;Data array must not be null.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    if (height &amp;lt; 1) {&lt;br /&gt;
      throw new IndexOutOfBoundsException(&amp;quot;Height must be greater or equal to 1&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    float max = Float.MIN_VALUE;&lt;br /&gt;
    float min = Float.MAX_VALUE;&lt;br /&gt;
    for (int index = 0; index &amp;lt; data.length; index++) {&lt;br /&gt;
      Number i = data[index];&lt;br /&gt;
      if (i == null) {&lt;br /&gt;
        continue;&lt;br /&gt;
      }&lt;br /&gt;
      final float numValue = i.floatValue();&lt;br /&gt;
      if (numValue &amp;lt; min) {&lt;br /&gt;
        min = numValue;&lt;br /&gt;
      }&lt;br /&gt;
      if (numValue &amp;gt; max) {&lt;br /&gt;
        max = numValue;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    if (max &amp;lt;= min) {&lt;br /&gt;
      return 1.0f;&lt;br /&gt;
    }&lt;br /&gt;
    if (height == 1) {&lt;br /&gt;
      return 0;&lt;br /&gt;
    }&lt;br /&gt;
    return (max - min) / (height - 1);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Chart based on Graph library ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.applet.*;&lt;br /&gt;
import java.net.URL;&lt;br /&gt;
import java.util.*;&lt;br /&gt;
import graph.*;&lt;br /&gt;
/*************************************************************************&lt;br /&gt;
**&lt;br /&gt;
**    Applet example3&lt;br /&gt;
**                                              Version 1.0   January 1996&lt;br /&gt;
**&lt;br /&gt;
**************************************************************************&lt;br /&gt;
**    Copyright (C) 1996 Leigh Brookshaw&lt;br /&gt;
**&lt;br /&gt;
**    This program is free software; you can redistribute it and/or modify&lt;br /&gt;
**    it under the terms of the GNU General Public License as published by&lt;br /&gt;
**    the Free Software Foundation; either version 2 of the License, or&lt;br /&gt;
**    (at your option) any later version.&lt;br /&gt;
**&lt;br /&gt;
**    This program is distributed in the hope that it will be useful,&lt;br /&gt;
**    but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
**    GNU General Public License for more details.&lt;br /&gt;
**&lt;br /&gt;
**    You should have received a copy of the GNU General Public License&lt;br /&gt;
**    along with this program; if not, write to the Free Software&lt;br /&gt;
**    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.&lt;br /&gt;
**************************************************************************&lt;br /&gt;
**&lt;br /&gt;
**    This applet demonstrates the interactive event handling of&lt;br /&gt;
**    the G2Dint class&lt;br /&gt;
**&lt;br /&gt;
*************************************************************************/&lt;br /&gt;
public class example3 extends Applet {&lt;br /&gt;
      LoadData dynamic;&lt;br /&gt;
      G2Dint graph;&lt;br /&gt;
      Label title;&lt;br /&gt;
      DataSet data1;&lt;br /&gt;
      Axis    xaxis;&lt;br /&gt;
      Axis    yaxis;&lt;br /&gt;
&lt;br /&gt;
      public void init() {&lt;br /&gt;
        int i;&lt;br /&gt;
        int j;&lt;br /&gt;
/*&lt;br /&gt;
**      Get the title of the plot and the data URL as parsed parameters&lt;br /&gt;
*/&lt;br /&gt;
        String st = &amp;quot;TITLE&amp;quot;;&lt;br /&gt;
        String data  = &amp;quot;elliptical.data&amp;quot;;&lt;br /&gt;
/*&lt;br /&gt;
**      Instantiate the Graph class and the LoadData class&lt;br /&gt;
*/&lt;br /&gt;
        graph = new G2Dint();&lt;br /&gt;
        dynamic = new LoadData();&lt;br /&gt;
        graph.borderTop    = 30;&lt;br /&gt;
        graph.borderBottom = 10;&lt;br /&gt;
        graph.borderRight  = 40;&lt;br /&gt;
        graph.setDataBackground(new Color(50,50,200));&lt;br /&gt;
        graph.setGraphBackground(new Color(0,200,255));&lt;br /&gt;
/*&lt;br /&gt;
**      Build the title and place it at the top of the graph&lt;br /&gt;
*/&lt;br /&gt;
        graph.setFont(new Font(&amp;quot;TimesRoman&amp;quot;,Font.PLAIN,25));&lt;br /&gt;
        title = new Label(st, Label.CENTER);&lt;br /&gt;
        title.setFont(new Font(&amp;quot;TimesRoman&amp;quot;,Font.PLAIN,25));&lt;br /&gt;
        setLayout( new BorderLayout() );&lt;br /&gt;
        add(&amp;quot;North&amp;quot;,  title);&lt;br /&gt;
        add(&amp;quot;Center&amp;quot;, graph);&lt;br /&gt;
/*&lt;br /&gt;
**      Start a new thread and load the data&lt;br /&gt;
*/&lt;br /&gt;
        try {&lt;br /&gt;
        data1 = dynamic.loadDataSet(this.getClass().getResource(data), graph);&lt;br /&gt;
        } catch (Exception e) {&lt;br /&gt;
          System.out.println(&amp;quot;Failed to load data file!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
/*&lt;br /&gt;
**      Specify the data line color&lt;br /&gt;
*/&lt;br /&gt;
        data1.linecolor = new Color(255,255,0);&lt;br /&gt;
/*&lt;br /&gt;
**      Instantiate the xaxis and attach the dataset.&lt;br /&gt;
*/&lt;br /&gt;
        xaxis = graph.createXAxis();&lt;br /&gt;
        xaxis.attachDataSet(data1);&lt;br /&gt;
        xaxis.setTitleText(&amp;quot;Wavelength_(angstroms)&amp;quot;);&lt;br /&gt;
        xaxis.setTitleColor(Color.magenta);&lt;br /&gt;
        xaxis.setTitleFont(new Font(&amp;quot;TimesRoman&amp;quot;,Font.ITALIC,25));&lt;br /&gt;
        xaxis.setLabelFont(new Font(&amp;quot;Helvetica&amp;quot;,Font.PLAIN,20));&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
**      Instantiate the yaxis and attach the dataset.&lt;br /&gt;
*/&lt;br /&gt;
        yaxis = graph.createYAxis();&lt;br /&gt;
        yaxis.attachDataSet(data1);&lt;br /&gt;
        yaxis.setTitleText(&amp;quot;Flux&amp;quot;);&lt;br /&gt;
        yaxis.setTitleColor(Color.magenta); &lt;br /&gt;
        yaxis.setTitleFont(new Font(&amp;quot;TimesRoman&amp;quot;,Font.ITALIC,25));&lt;br /&gt;
        yaxis.setLabelFont(new Font(&amp;quot;Helvetica&amp;quot;,Font.PLAIN,20));&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
      public static void main(String[] a){&lt;br /&gt;
         javax.swing.JFrame f = new javax.swing.JFrame();&lt;br /&gt;
         Applet app = new example3();&lt;br /&gt;
         app.init();&lt;br /&gt;
         &lt;br /&gt;
         f.getContentPane().add (app);&lt;br /&gt;
         f.pack();&lt;br /&gt;
         f.setSize (new Dimension (500, 500));&lt;br /&gt;
         f.setVisible(true);&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pie Chart ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.util.*;&lt;br /&gt;
import javax.swing.*;&lt;br /&gt;
import no.geosoft.cc.geometry.Geometry;&lt;br /&gt;
import no.geosoft.cc.graphics.*;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * G demo program. Demonstrates:&lt;br /&gt;
 *&lt;br /&gt;
 * &amp;lt;ul&amp;gt;&lt;br /&gt;
 * &amp;lt;li&amp;gt;A rudimentary pie chart class&lt;br /&gt;
 * &amp;lt;li&amp;gt;Annotation techniques&lt;br /&gt;
 * &amp;lt;li&amp;gt;Example geometry generation&lt;br /&gt;
 * &amp;lt;/ul&amp;gt;&lt;br /&gt;
 * &lt;br /&gt;
 * @author &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Scroll Chart ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.applet.*;&lt;br /&gt;
import java.net.URL;&lt;br /&gt;
import java.util.*;&lt;br /&gt;
import graph.*;&lt;br /&gt;
/*************************************************************************&lt;br /&gt;
**&lt;br /&gt;
**    Applet example2a&lt;br /&gt;
**                                              Version 1.0   August 1996&lt;br /&gt;
**&lt;br /&gt;
**************************************************************************&lt;br /&gt;
**    Copyright (C) 1996 Leigh Brookshaw&lt;br /&gt;
**&lt;br /&gt;
**    This program is free software; you can redistribute it and/or modify&lt;br /&gt;
**    it under the terms of the GNU General Public License as published by&lt;br /&gt;
**    the Free Software Foundation; either version 2 of the License, or&lt;br /&gt;
**    (at your option) any later version.&lt;br /&gt;
**&lt;br /&gt;
**    This program is distributed in the hope that it will be useful,&lt;br /&gt;
**    but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
**    GNU General Public License for more details.&lt;br /&gt;
**&lt;br /&gt;
**    You should have received a copy of the GNU General Public License&lt;br /&gt;
**    along with this program; if not, write to the Free Software&lt;br /&gt;
**    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.&lt;br /&gt;
**************************************************************************&lt;br /&gt;
**&lt;br /&gt;
**    This is a simple applet that creates a Scroll Chart using the &lt;br /&gt;
**    Graph2D class library and double buffering&lt;br /&gt;
**&lt;br /&gt;
*************************************************************************/&lt;br /&gt;
public class example2a extends Applet implements Runnable {&lt;br /&gt;
      Graph2D graph;&lt;br /&gt;
      Label title;&lt;br /&gt;
      DataSet data1 = new DataSet();&lt;br /&gt;
      Axis    yaxis_right;&lt;br /&gt;
      Image    osi = null;&lt;br /&gt;
      Graphics osg = null;&lt;br /&gt;
      int iwidth  = 0;&lt;br /&gt;
      int iheight = 0;&lt;br /&gt;
      Thread runner = null;&lt;br /&gt;
      Random random = new Random();&lt;br /&gt;
      int count = 0;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
**    In milliseconds how often do we want to add a new data point.&lt;br /&gt;
*/&lt;br /&gt;
      int period      = 500;&lt;br /&gt;
/*&lt;br /&gt;
**    Maximum number of points to display before scrolling the data&lt;br /&gt;
*/&lt;br /&gt;
      int maximum        = 25;&lt;br /&gt;
      URL markersURL;&lt;br /&gt;
/*&lt;br /&gt;
**    Initialize the applet. The Parameters passed are the title of the plot&lt;br /&gt;
**    the marker file to use and the update period in milliseconds&lt;br /&gt;
*/&lt;br /&gt;
      public void init() {&lt;br /&gt;
        int i;&lt;br /&gt;
        int j;&lt;br /&gt;
/*&lt;br /&gt;
**      Get the passed parameters&lt;br /&gt;
*/&lt;br /&gt;
        String st       = &amp;quot;TITLE&amp;quot;;&lt;br /&gt;
        String mfile    = &amp;quot;marker.txt&amp;quot;;&lt;br /&gt;
        period   = 10;&lt;br /&gt;
/*&lt;br /&gt;
**      Create the Graph instance and modify the default behaviour&lt;br /&gt;
*/&lt;br /&gt;
        graph = new Graph2D();&lt;br /&gt;
        graph.zerocolor = new Color(0,255,0);&lt;br /&gt;
        graph.borderTop    = 50;&lt;br /&gt;
        graph.borderBottom = 50;&lt;br /&gt;
        graph.setDataBackground(Color.black);&lt;br /&gt;
/*&lt;br /&gt;
**      Create the Title&lt;br /&gt;
*/&lt;br /&gt;
        title = new Label(st, Label.CENTER);&lt;br /&gt;
        title.setFont(new Font(&amp;quot;TimesRoman&amp;quot;,Font.PLAIN,25));&lt;br /&gt;
        setLayout( new BorderLayout() );&lt;br /&gt;
        add(&amp;quot;North&amp;quot;,  title);&lt;br /&gt;
        add(&amp;quot;Center&amp;quot;, graph);&lt;br /&gt;
/*&lt;br /&gt;
**      Load a file containing Marker definitions&lt;br /&gt;
*/&lt;br /&gt;
        try {&lt;br /&gt;
           markersURL = this.getClass().getResource(mfile);&lt;br /&gt;
           graph.setMarkers(new Markers(markersURL));&lt;br /&gt;
        } catch(Exception e) {&lt;br /&gt;
           System.out.println(&amp;quot;Failed to create Marker URL!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
**      Modify the default Data behaviour&lt;br /&gt;
*/&lt;br /&gt;
        data1.linecolor   = new Color(255,0,0);&lt;br /&gt;
        data1.marker      = 1;&lt;br /&gt;
        data1.markercolor = new Color(100,100,255);&lt;br /&gt;
/*&lt;br /&gt;
**      Setup the Axis. Attach it to the Graph2D instance, and attach the data&lt;br /&gt;
**      to it.&lt;br /&gt;
*/&lt;br /&gt;
        yaxis_right = graph.createAxis(Axis.RIGHT);&lt;br /&gt;
        yaxis_right.attachDataSet(data1);&lt;br /&gt;
        yaxis_right.setLabelFont(new Font(&amp;quot;Helvetica&amp;quot;,Font.PLAIN,20));&lt;br /&gt;
        graph.attachDataSet(data1);&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
      public void start() {&lt;br /&gt;
  if(runner == null) {&lt;br /&gt;
          runner = new Thread(this);&lt;br /&gt;
          runner.start();&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      public void stop() {&lt;br /&gt;
  if(runner != null) {&lt;br /&gt;
          runner.stop();&lt;br /&gt;
          runner = null;&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public void run() {&lt;br /&gt;
              int i =0;&lt;br /&gt;
              double data[] = new double[2];&lt;br /&gt;
              Graphics g;&lt;br /&gt;
              while(true) {&lt;br /&gt;
&lt;br /&gt;
                   count++;&lt;br /&gt;
                   if(count &amp;gt;= maximum) data1.delete(0,0);&lt;br /&gt;
                   data[1] = (2.0*random.nextDouble()-1.0)*50.0;&lt;br /&gt;
                   data[0] = count;&lt;br /&gt;
                   try {&lt;br /&gt;
                        data1.append(data,1);&lt;br /&gt;
          }&lt;br /&gt;
                   catch (Exception e) {&lt;br /&gt;
                        System.out.println(&amp;quot;Error appending Data!&amp;quot;);&lt;br /&gt;
                   }&lt;br /&gt;
                   data1.yaxis.maximum =  50.0;&lt;br /&gt;
                   data1.yaxis.minimum = -50.0;&lt;br /&gt;
                   &lt;br /&gt;
                   g = graph.getGraphics();&lt;br /&gt;
       if( osi == null || iwidth != graph.size().width&lt;br /&gt;
                                   || iheight != graph.size().height  ) {&lt;br /&gt;
                       iwidth = graph.size().width;&lt;br /&gt;
                       iheight = graph.size().height;&lt;br /&gt;
                       osi = graph.createImage(iwidth,iheight);&lt;br /&gt;
                       osg = osi.getGraphics();&lt;br /&gt;
                   }&lt;br /&gt;
                   osg.setColor(this.getBackground());&lt;br /&gt;
                   osg.fillRect(0,0,iwidth,iheight);&lt;br /&gt;
                   osg.setColor(g.getColor());&lt;br /&gt;
                   osg.clipRect(0,0,iwidth,iheight);&lt;br /&gt;
&lt;br /&gt;
                   graph.update(osg);&lt;br /&gt;
                   g.drawImage(osi,0,0,graph);&lt;br /&gt;
&lt;br /&gt;
                   try {  Thread.sleep(period); }&lt;br /&gt;
                   catch(Exception e) { }&lt;br /&gt;
       }&lt;br /&gt;
  }&lt;br /&gt;
      public static void main(String[] a){&lt;br /&gt;
         javax.swing.JFrame f = new javax.swing.JFrame();&lt;br /&gt;
         Applet app = new example2();&lt;br /&gt;
         app.init();&lt;br /&gt;
         &lt;br /&gt;
         f.getContentPane().add (app);&lt;br /&gt;
         f.pack();&lt;br /&gt;
         f.setSize (new Dimension (500, 500));&lt;br /&gt;
         f.setVisible(true);&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>