Target zones

A target zone is a color filled polygon horizontally or vertically painted across the chart area. The goal of a target zone is to set upper and lower limits across which a sequence of data points can be plotted and compared against delimiter values.
Only two dimensional charts display target zones.

A target zone is an exclusive implementation of the chart context represented by the Graph class. ScatterGraph and PieGraph does not support target zones.

The application below displays a line series plotted across a green target zone.


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

public class Main extends JFrame  {

   public Main() {

        Graph graph=new Graph();

        graph.setTitle(new String[]{"The JetChart Library","Target zones"});
        
        TargetZone tz=new TargetZone();
        double[] upperValues={100,95,110,90};
        double[] lowerValues={60,55,70,50};
        tz.setValues(upperValues,lowerValues);
        tz.setColor(Color.green);

        GraphSet graphSet=graph.getGraphSet(0);
        graphSet.addTargetZone(tz);
        
        Scale scale=graphSet.getScale();
        scale.setAutoScaleEnabled(false);
        scale.setMaxValue(150);
        scale.setIncrement(30);

        Grid grid=graphSet.getGrid();
        grid.setEnabled(true);
        grid.setColor(Color.decode("#999999"));
        grid.setStyle(Grid.DASHED);

        GridCrossedLines gc=graphSet.getGridCrossedLines();
        gc.setEnabled(true);
        gc.setColor(Color.decode("#999999"));
        gc.setStyle(GridCrossedLines.DASHED);

        LineSerie ls=new LineSerie(new double[]{74,50,90,100},"Line series");
        ls.setColor(Color.red);
        ls.setThickness(2);

        graph.addSerie(ls);

        Container ct=getContentPane();
        ct.add(graph);

        setSize(500,250);
        setVisible(true);
   }

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

}