com.iproject.wbmpcreator
Class WBMPChart

java.lang.Object
  |
  +--com.iproject.wbmpcreator.WBMPfile
        |
        +--com.iproject.wbmpcreator.WBMPChart

public class WBMPChart
extends WBMPfile

See Also:
Serialized Form

Field Summary
static int APPLEPIE_TYPE_1
          The apple pie chart type 1 (plain circle).
Up to 4 sectors are drawn.
static int APPLEPIE_TYPE_2
          The apple pie chart type 2 (3D circle)
static int CHART_PLAIN
          Chart with points connected with lines.
static int CHART_PLAIN_FILLED
          Chart with points connected with lines.
static int CHART_POINT
          Chart with points NOT connected with lines.
static int CHART_POINT_FILLED
          Chart with points NOT connected with lines.
static int HISTOGRAM_TYPE_1
          The first type of histograms.
Up to 4 rectangles are drawn.
static int HISTOGRAM_TYPE_2
          The second type of histograms (rectangles one on another)
static int HISTOGRAM_TYPE_3
          The third type of histograms (3D)
static int HISTOGRAM_TYPE_4
          The fourth type of histograms (3D rectangles one on another)
static int LINEAR_TYPE_1
          The first type of linear histograms (rectangles one above another)
static int LINEAR_TYPE_2
          The second type of linear histograms (rectangles one next to another)
static int LINEAR_TYPE_3
          The third type of linear histograms (3D rectangles one above another)
static int LINEAR_TYPE_4
          The fourth type of linear histograms (3D rectangles one next to another)
static int PROGRESS_BAR_HORIZONTAL
          Chart with points NOT connected with lines.
static int PROGRESS_BAR_VERTICAL
           
static int STOCK_TYPE_1
          The stock chart type 1 (bars)
NOTE that each double[] array consists of 3 values: BID_MIN, BID_MAX, BID_CLOSE for a given period of time.
static int STOCK_TYPE_2
          The stock chart type 2 (candles)
NOTE that each double[] array consists of 4 values: BID_MIN, BID_MAX, BID_OPEN, BID_CLOSE for a given period of time.
 
Fields inherited from class com.iproject.wbmpcreator.WBMPfile
ALIGN_CENTER, ALIGN_HORIZONTAL_CENTER, ALIGN_HORIZONTAL_LEFT, ALIGN_HORIZONTAL_RIGHT, ALIGN_VERTICAL_BOTTOM, ALIGN_VERTICAL_CENTER, ALIGN_VERTICAL_TOP, APPEND_MODE_CONTINUOUS, APPEND_MODE_DIVISION, LINE_CHAIN3_1, LINE_CHAIN3_2, LINE_INT2_1, LINE_INT2_2, LINE_INT3_2, LINE_POINT1, LINE_POINT2, LINE_POINT3, MIX_MODE_AND, MIX_MODE_NOT, MIX_MODE_OR, MIX_MODE_XOR
 
Constructor Summary
WBMPChart(int xSize, int ySize)
          This constructor creates WBMPChart instance with the given resolution.
WBMPChart(WBMPDimension imageDim)
          This constructor creates WBMPChart instance with the given dimensions.
WBMPChart(WBMPfile wbmpFile)
          This constructor creates WBMPChart instance from WBMPfile instance.
 
Method Summary
 WBMPfile drawAdvancedChart(java.lang.String[] params, java.lang.String[] axis, java.util.Vector values, int chart_type, int length, int width, boolean useAxis)
          Method for drawing advanced (more complicated than ordinary) charts.
 
Methods inherited from class com.iproject.wbmpcreator.WBMPfile
align, convert2WBMPfile, convert2WBMPfile, createWBMPFile, destroyWBMPFile, draw3DRect, drawArc, drawCircle, drawCustomString, drawLine, drawOval, drawPoint, drawRect, drawSpecialLine, drawString, drawTTFString, executeSequence, getByteArray, getElementAt, getRectArea, getString, getWBMPLength, getWBMPpic, getWBMPWidth, invertWBMPImage, mix, mix, openEWBMPFile, openWBMPFile, printWBMPImage, reduce, rotate, saveEWBMP2File, saveWBMPFile, setElementAt, setWBMPLength, setWBMPWidth, writeWBMPFile
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HISTOGRAM_TYPE_1

public static final int HISTOGRAM_TYPE_1
The first type of histograms.
Up to 4 rectangles are drawn. Each rectangle has its own color and height.
Example (also valid for ALL histograms and linear charts):
 // crate chart with (90,50) dimensions
   WBMPChart wc=new WBMPChart(90,50);
 // assign parameter names
   String[] params={"1ST","2ND","3RD","4TH"};
 // assign axis names
   String[] axis={"X AXIS","Y AXIS"};
 // specify quantity of data pieces
   Vector vc=new Vector(5);
   double[] values1={1d};
   double[] values2={2d};
   double[] values3={3d};
   double[] values4={4d};
   double[] values5={5d};
 // add data to Vector
   vc.add(values1);
   vc.add(values2);
   vc.add(values3);
   vc.add(values4);
   vc.add(values5);
 // draw chart
   try{
     wc.drawAdvancedChart(params,axis,vc,wc.HISTOGRAM_TYPE_1,90,50,true).saveWBMP2File("c://chart.wbmp");
   }catch(Exception e){
     e.printStackTrace();
   }
 

HISTOGRAM_TYPE_2

public static final int HISTOGRAM_TYPE_2
The second type of histograms (rectangles one on another)

HISTOGRAM_TYPE_3

public static final int HISTOGRAM_TYPE_3
The third type of histograms (3D)

HISTOGRAM_TYPE_4

public static final int HISTOGRAM_TYPE_4
The fourth type of histograms (3D rectangles one on another)

LINEAR_TYPE_1

public static final int LINEAR_TYPE_1
The first type of linear histograms (rectangles one above another)

LINEAR_TYPE_2

public static final int LINEAR_TYPE_2
The second type of linear histograms (rectangles one next to another)

LINEAR_TYPE_3

public static final int LINEAR_TYPE_3
The third type of linear histograms (3D rectangles one above another)

LINEAR_TYPE_4

public static final int LINEAR_TYPE_4
The fourth type of linear histograms (3D rectangles one next to another)

CHART_PLAIN

public static final int CHART_PLAIN
Chart with points connected with lines.

CHART_POINT

public static final int CHART_POINT
Chart with points NOT connected with lines.

CHART_PLAIN_FILLED

public static final int CHART_PLAIN_FILLED
Chart with points connected with lines.

CHART_POINT_FILLED

public static final int CHART_POINT_FILLED
Chart with points NOT connected with lines.

PROGRESS_BAR_HORIZONTAL

public static final int PROGRESS_BAR_HORIZONTAL
Chart with points NOT connected with lines. A progress bar is represented in percents. It's better to specify the real dimensions of a bar when drawing. It doesn't require axis names, axis and values.
values here is int[] array with just one element.

Please refer to documentation for more details.


PROGRESS_BAR_VERTICAL

public static final int PROGRESS_BAR_VERTICAL

APPLEPIE_TYPE_1

public static final int APPLEPIE_TYPE_1
The apple pie chart type 1 (plain circle).
Up to 4 sectors are drawn. Each sector has its own color and size.
Example (also valid for ALL apple pie charts):
 // crate chart with (90,50) dimensions
   WBMPChart wc=new WBMPChart(90,50);
 // assuming parameter names as null
 // assign axis names as null
 // specify quantity of data pieces
   Vector vc=new Vector(4);
   double[] values1={1d};
   double[] values2={2d};
   double[] values3={3d};
   double[] values4={4d};
 // add data to Vector
   vc.add(values1);
   vc.add(values2);
   vc.add(values3);
   vc.add(values4);
 // draw chart
   try{
     wc.drawAdvancedChart(null,null,vc,wc.APPLEPIE_TYPE_1,90,50,false).saveWBMP2File("c://chart.wbmp");
   }catch(Exception e){
     e.printStackTrace();
   }
 

APPLEPIE_TYPE_2

public static final int APPLEPIE_TYPE_2
The apple pie chart type 2 (3D circle)

STOCK_TYPE_1

public static final int STOCK_TYPE_1
The stock chart type 1 (bars)
NOTE that each double[] array consists of 3 values: BID_MIN, BID_MAX, BID_CLOSE for a given period of time. You can also make "holes" in this chart by inserting the null value. Example of usage:
 WBMPChart wc=new WBMPChart(90,50);
 String[] params={"1ST","2ND","3RD","4TH"};
 String[] axis={"X AXIS","Y AXIS"};
 Vector vc=new Vector(5);
 double[] values1=new double[3];
 values1[0]=121.05;
 values1[1]=121.10;
 values1[2]=121.06;
 vc.add(values1);
 double[] values2=new double[3];
 values2[0]=121.08;
 values2[1]=121.13;
 values2[2]=121.13;
 vc.add(values2);
 double[] values5=new double[3];
 values5[0]=121.11;
 values5[1]=121.16;
 values5[2]=121.12;
 vc.add(values5);
 // add null value as an example
 vc.add(null);
 double[] values3=new double[3];
 values3[0]=121.13;
 values3[1]=121.18;
 values3[2]=121.13;
 vc.add(values3);
 double[] values4=new double[3];
 values4[0]=121.10;
 values4[1]=121.18;
 values4[2]=121.15;
 vc.add(values4);

 try{
   wc.drawAdvancedChart(null,null,vc,wc.STOCK_TYPE_1,90,50,false).saveWBMP2File("c://chart.wbmp");
 }catch(Exception e){
   e.printStackTrace();
 }
 

STOCK_TYPE_2

public static final int STOCK_TYPE_2
The stock chart type 2 (candles)
NOTE that each double[] array consists of 4 values: BID_MIN, BID_MAX, BID_OPEN, BID_CLOSE for a given period of time. You can also make "holes" in this chart by inserting the null value.
Example of usage:
 WBMPChart wc=new WBMPChart(90,50);
 String[] params={"1ST","2ND","3RD","4TH"};
 String[] axis={"X AXIS","Y AXIS"};
 Vector vc=new Vector(5);
 double[] values1=new double[4];
 values1[0]=121.05;
 values1[1]=121.10;
 values1[2]=121.06;
 values1[3]=121.08;
 vc.add(values1);
 double[] values2=new double[4];
 values2[0]=121.08;
 values2[1]=121.13;
 values2[2]=121.13;
 values2[3]=121.08;
 vc.add(values2);
 double[] values5=new double[4];
 values5[0]=121.11;
 values5[1]=121.16;
 values5[2]=121.12;
 values5[3]=121.14;
 vc.add(values5);
 // add null value as an example
 vc.add(null);
 double[] values3=new double[4];
 values3[0]=121.13;
 values3[1]=121.18;
 values3[2]=121.13;
 values3[3]=121.18;
 vc.add(values3);
 double[] values4=new double[4];
 values4[0]=121.10;
 values4[1]=121.18;
 values4[2]=121.15;
 values4[3]=121.12;
 vc.add(values4);

 try{
   wc.drawAdvancedChart(null,null,vc,wc.STOCK_TYPE_2,90,50,false).saveWBMP2File("c://chart.wbmp");
 }catch(Exception e){
   e.printStackTrace();
 }
 
Constructor Detail

WBMPChart

public WBMPChart(int xSize,
                 int ySize)
This constructor creates WBMPChart instance with the given resolution.
Parameters:
xSize - the X axis size in points
ySize - the Y axis size in points

WBMPChart

public WBMPChart(WBMPDimension imageDim)
This constructor creates WBMPChart instance with the given dimensions.
Parameters:
imageDim - dimensions of the resulting images

WBMPChart

public WBMPChart(WBMPfile wbmpFile)
This constructor creates WBMPChart instance from WBMPfile instance.
Parameters:
wbmpFile - the WBMPfile instance
Method Detail

drawAdvancedChart

public WBMPfile drawAdvancedChart(java.lang.String[] params,
                                  java.lang.String[] axis,
                                  java.util.Vector values,
                                  int chart_type,
                                  int length,
                                  int width,
                                  boolean useAxis)
                           throws ChartDrawException,
                                  java.lang.Exception
Method for drawing advanced (more complicated than ordinary) charts. It supports the following chart types:
Parameters:
params - the array of parameters. Up to 4 parameters are supported (due to monochrome type). Each parameter must have not more than 3 chars (using numbers is recommended). The parameters are displayed in the right upper corner. It is not necessary to use axis descriptions while drawing stock charts. So, to draw stock charts just specify null as this parameter.
axis - axis descriptions. The 0 value represents the X, and the first value represents the Y axis description. If you don't want to describe the axis set this parameter to null.
values - the Vector representation of data in double[] format. For some charts (for example, STOCK charts) this parameter can contain null values.
chart_type - the type of a chart from the list
length - the length of a resulting chart
width - the width of a resulting chart
useAxis - a flag notifying WBMPcreator whether to draw axis or no.
Returns:
the WBMPfile instance of the chart.
Since:
1.50