Area Plot

Area plots are similar to line plots, but with the area between the line and a reference line filled in. An area plot is created if the DATA_TYPE_FILL bit is on in the value of the DataType attribute. The default reference line is y = 0. The location of the reference line can be changed from 0 by using setReference(double). The Fill Area Attributes determine how the area is filled.

Simple Area Plot

This example draws a simple area plot. The default value of the FillType attribute is FILL_TYPE_SOLID. The example sets the FillColor attribute to blue. So the area between the line and y = 0 is solid blue.

 

(Download Code)

 

import com.imsl.chart.*;

import java.awt.Color;

 

public class SampleArea extends JFrameChart {

 

    public SampleArea() {       

        Chart chart = getChart();

        AxisXY axis = new AxisXY(chart);

        double y[] = {4, -6, 2, 1, -8};

        Data data = new Data(axis, y);

        data.setDataType(Data.DATA_TYPE_FILL);

        data.setFillColor(Color.blue);

    }

   

    public static void main(String argv[]) {

        new SampleArea().setVisible(true);

    }

}

 

Painted Area Example

This example shows an area chart filled in with a painted texture. The texture is created by a static method FillPaint.crosshatch.

A second data set is plotted as a set of markers.

The Legend node is painted in this example and has entries for both the filled area data set and the marker data set.

(Download Code)

 

import com.imsl.chart.*;

import java.awt.Color;

 

public class SampleArea extends JFrameChart {

 

    public SampleArea() {       

        Chart chart = getChart();

        AxisXY axis = new AxisXY(chart);

        double y[] = {4, -6, 2, 1, -8};

        Data data = new Data(axis, y);

        data.setDataType(Data.DATA_TYPE_FILL);

        data.setFillColor(Color.blue);

    }

   

    public static void main(String argv[]) {

        new SampleArea().setVisible(true);

    }

}

 

Attribute Reference

The attribute Reference defines the reference line. If its value is a, then the reference line is y = a. Its default value is 0.



Visual Numerics - Developers of IMSL and PV-WAVE
http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260