XY series

There is a diversity of applications which require analysis of data by comparing two variables against each other. The graphical representation of data pairs(x,y) consists basically of a collection of data points scattered across the chart area, rather than following an equidistant progression along the x axis, as the previous examples have demonstrated so far.
A scatter chart is made up of data points plotted against a horizontal and a vertical scale. The 'x' and 'y' values positions are calculated against the horizontal and vertical scales, respectively. An XY series consists of a sequence of data pairs(x,y), whose data points can be displayed in different shapes, as a square, a circle, a triangle, a cross and a dot.

The chart context of scatter graphs is represented by the class com.jinsight.jetchart.ScatterGraph, to which the XY series has to be added.

The class used to generate an XY series is com.jinsight.jetchart.XYSerie.

import javax.swing.*;
import java.awt.*;
import com.jinsight.jetchart.*;

public class Main extends JFrame {

   public Main() { 

        ScatterGraph graph=new ScatterGraph();

        Container ct=getContentPane();

        ct.add("Center",graph);
        
	XYSerie xy=new XYSerie();
        xy.setTitle("XY series");
	xy.setColor(Color.red);

        double[][] values={{35.2,10.1},{37.3,10.85},{44.9,12.48},{17.68,12.63},{63.55,24.58},
  		           {103.8,25.6},{250.2,39.7},{81.98,43.1},{126.1,48.4},{85.5,74.6}};
	
	// The method setValues(double[] values) is not
	// used with XY series.
        xy.setMultipleValues(values);

        graph.addSerie(xy);

	// Enables tooltips display. Move mouse cursor over
	// a data point to see the xy values.
	graph.getToolTip().setEnabled(true);

        
        setSize(400,300);

        setVisible(true);


  }

  public static void main(String[] args) {
        new Main();
  }

}