MakeLogic Wireless - microGraphs API
v1.0

com.makeLogic.mg
Class BarGraph

com.makeLogic.mg.BarGraph
All Implemented Interfaces:
java.lang.Runnable

public class BarGraph
implements java.lang.Runnable

Since:
MDK1.0
See Also:
com.makeLogic.mg

Field Summary
static int ALL_VALUES
          Specifies that all the values should be marked on the axis including the end values
static int DOTTED
          Set the drawing stroke style to DOTTED line
static int END_VALUES
          Specifies that only the end values should be marked on X or Y axis.
static int HORIZONTAL
          Sets the bars to show in horizontal position, that is parallel to X-axis
static int NONE
          An option that specifies nothing should be drawn
static int SOLID
          Set the drawing stroke style to SOLID line
static int VERTICAL
          Sets the bars to show in vertical position, that is parallel to Y-axis
static int X_AND_Y
          An option that specifies that the grid lines be drawn in both X and Y directions
static int X_ONLY
          An option that specifies that the grid lines be drawn parallel to X-axis only
static int Y_ONLY
          An option that specifies that the grid lines be drawn parallel to Y-axis only
static int ZOOM_IN
          Shows the graph in a more detailed manner.
static int ZOOM_OUT
          Shows the graph completely.
 
Constructor Summary
BarGraph(int[] x, int[] y, java.lang.String xLabel, java.lang.String yLabel, int ALIGNMENT, int DETAIL, java.lang.String title)
          Takes the values of x and y cooridnates in the form of an integer array.
 
Method Summary
 void paint(javax.microedition.lcdui.Graphics g)
           
 void refresh()
          Once the graph is displayed on the device, you should call refresh() method if you have made anychanges to the properties using the set methods.
 void run()
           
 void setBorder(boolean value)
          Sets the border for the graph.
 void setBorderStyle(int type)
          Border Style can be set to DOTTED or SOLID.
 void setGridStyle(int type)
          Sets the style of the grid.
 void setTitle(java.lang.String title)
          Sets a title for this graph.In most cases refresh() should be called for the changes to take effect
 void setViewType(int value)
          Sets the view type to one of the following predefined values.
 void setXGridStyle(int type)
          X - grid lines style can be set to either DOTTED or SOLID.This function takes affect only when the X-Grid is turned on.
 void setXLabel(java.lang.String label)
          The x-axis values can be labeled using this function.
 void setXValuesDisplayType(int type)
          The values displayed on the x-axis can be set to one of the following ways.
 void setYGridStyle(int type)
          Y - grid lines style can be set to either DOTTED or SOLID.This function takes affect only when the Y-Grid is turned on.
 void setYLabel(java.lang.String label)
          The y-axis values can be labeled using this function.In most cases refresh() should be called for the changes to take effect.
 void setYValuesDisplayType(int type)
          The values displayed on the y-axis can be set to one of the following ways.
 void showTitle(boolean value)
          Sets if the title for this graph should be displayed or not.In most cases refresh() should be called for the changes to take effect
 void showXAxis(boolean value)
          Sets if the X-Axis should be displayed or not.In most cases refresh() should be called for the changes to take effect
 void showXLabel(boolean value)
          Sets if the X-Label should be displayed or not.In most cases refresh() should be called for the changes to take effect
 void showYAxis(boolean value)
          Sets if the Y-Axis should be displayed or not.In most cases refresh() should be called for the changes to take effect
 void showYLabel(boolean value)
          Sets if the Y-Label should be displayed or not.In most cases refresh() should be called for the changes to take effect
 

Field Detail

X_ONLY

public static final int X_ONLY
An option that specifies that the grid lines be drawn parallel to X-axis only

Y_ONLY

public static final int Y_ONLY
An option that specifies that the grid lines be drawn parallel to Y-axis only

X_AND_Y

public static final int X_AND_Y
An option that specifies that the grid lines be drawn in both X and Y directions

NONE

public static final int NONE
An option that specifies nothing should be drawn

DOTTED

public static final int DOTTED
Set the drawing stroke style to DOTTED line

SOLID

public static final int SOLID
Set the drawing stroke style to SOLID line

END_VALUES

public static final int END_VALUES
Specifies that only the end values should be marked on X or Y axis. ie. at the origin and at the end of the axis shown

ALL_VALUES

public static final int ALL_VALUES
Specifies that all the values should be marked on the axis including the end values

ZOOM_IN

public static final int ZOOM_IN
Shows the graph in a more detailed manner. Adjusts the origin and the axes scaling so that the whole curve is just fitted into the graph

ZOOM_OUT

public static final int ZOOM_OUT
Shows the graph completely. In this case the origin starts at (0,0)

VERTICAL

public static final int VERTICAL
Sets the bars to show in vertical position, that is parallel to Y-axis

HORIZONTAL

public static final int HORIZONTAL
Sets the bars to show in horizontal position, that is parallel to X-axis
Constructor Detail

BarGraph

public BarGraph(int[] x,
                int[] y,
                java.lang.String xLabel,
                java.lang.String yLabel,
                int ALIGNMENT,
                int DETAIL,
                java.lang.String title)
Takes the values of x and y cooridnates in the form of an integer array. All the arguments should be passed with their correct values, otherwise the results are unpredictable. No arguments should be null.
Parameters:
int - x[]
The values of x dimension in the form of int array only. the size (x.length) of the array should be equal to the size of the y[] (ie y.length) passed as the second argument. If the sizes are different the results are unpredictable.
int - y[]
The values of x dimension in the form of int array only. the size (y.length) of the array should be equal to the size of the x[] (ie x.length) passed as the first argument. If the sizes are different the results are unpredictable.
String - xLabel
The label describing the values plotted along the X - Axis
String - yLabel
The label describing the values plotted along the Y - Axis
int - ALIGNMENT
- This can be only one of the following values.
BarGraph.HORIZONTAL - sets the bars to be displayed parallel to X - Axis
BarGraph.VERTICAL - sets the bars to be displayed parallel to Y - Axis
This parameter cannot be changed once the object is created
int - DETAIL
- This should be one of the following values only
BarGraph.ZOOM_IN - Shows the graph in a more detailed manner .That is the value starts from about 20% of the minimum value along the aligned axis
BarGraph.ZOOM_OUT - Shows the graph in complete. That is the value starts from zero along the aligned axis.
String - title
- A befitting name for the graph displayed
Since:
MWDK1.0
Method Detail

paint

public void paint(javax.microedition.lcdui.Graphics g)

run

public void run()
Specified by:
run in interface java.lang.Runnable

setGridStyle

public void setGridStyle(int type)
Sets the style of the grid. It allows drawing the grid lines along X-axis only or Y-axis only or aling both the axes or no grid lines at all. In most cases refresh() should be called for the changes to take effect.
Parameters:
int - type type should be one of the following values only, otherwise the results are unpredictable
BarGraph.X_ONLY
BarGraph.Y_ONLY
BarGraph.NONE
BarGraph.X_AND_Y
Since:
MWDK1.0
See Also:
refresh()

setBorder

public void setBorder(boolean value)
Sets the border for the graph. Border style can be set using setBorderStyle(int type). In most devices the Border overlaps the x-label. So, the advice is that the x-label be turned off while drawing the border. In most cases refresh() should be called for the changes to take effect.
Parameters:
boolean - value
Since:
MWDK1.0
See Also:
refresh(), setBorderStyle(int type)

setXGridStyle

public void setXGridStyle(int type)
X - grid lines style can be set to either DOTTED or SOLID.This function takes affect only when the X-Grid is turned on. In most cases refresh() should be called for the changes to take effect.
Parameters:
int - type . Type should be set to one of the following only
BarGraph.DOTTED
BarGraph.SOLID
Since:
MWDK1.0
See Also:
refresh(), setGridStyle(int type)

setYGridStyle

public void setYGridStyle(int type)
Y - grid lines style can be set to either DOTTED or SOLID.This function takes affect only when the Y-Grid is turned on. In most cases refresh() should be called for the changes to take effect.
Parameters:
int - type . Type should be set to one of the following only
BarGraph.DOTTED
BarGraph.SOLID
Since:
MWDK1.0
See Also:
refresh(), setGridStyle(int type)

setBorderStyle

public void setBorderStyle(int type)
Border Style can be set to DOTTED or SOLID. This function takes affect only when the Border is turned on. In most cases refresh() should be called for the changes to take effect
Parameters:
int - type . Type should be set to one of the following only
BarGraph.DOTTED
BarGraph.SOLID
Since:
MWDK1.0
See Also:
refresh(), setBorder(boolean value)

setXLabel

public void setXLabel(java.lang.String label)
The x-axis values can be labeled using this function. At times the border line can overlap with the x-label. We suggest that border be turned off while using x-label.In most cases refresh() should be called for the changes to take effect
Parameters:
String - label Label of the x-axis
Since:
MWDK1.0

setYLabel

public void setYLabel(java.lang.String label)
The y-axis values can be labeled using this function.In most cases refresh() should be called for the changes to take effect.
Parameters:
String - label Label of the y-axis
Since:
MWDK1.0

setXValuesDisplayType

public void setXValuesDisplayType(int type)
The values displayed on the x-axis can be set to one of the following ways.
1. Display the values all along the x-axis
2. Display values only at the origin and at the end of the x-axis in the device
3. Do not display values at all along x-axis
In most cases refresh() should be called for the changes to take effect
Parameters:
int - type. Type can be one of the following
BarGraph.NONE
BarGraph.END_VALUES
BarGraph.ALL_VALUES
Since:
MWDK1.0

setYValuesDisplayType

public void setYValuesDisplayType(int type)
The values displayed on the y-axis can be set to one of the following ways.
1. Display the values all along the y-axis
2. Display values only at the origin and at the end of the y-axis in the device
3. Do not display values at all along y-axis
In most cases refresh() should be called for the changes to take effect
Parameters:
int - type. Type can be one of the following
BarGraph.NONE
BarGraph.END_VALUES
BarGraph.ALL_VALUES
Since:
MWDK1.0

refresh

public void refresh()
Once the graph is displayed on the device, you should call refresh() method if you have made anychanges to the properties using the set methods. The changes will be seen on the screen only after calling the refresh() method
Since:
MWDK1.0

setTitle

public void setTitle(java.lang.String title)
Sets a title for this graph.In most cases refresh() should be called for the changes to take effect
Parameters:
String - title Title for this graph
Since:
MWDK1.0

showTitle

public void showTitle(boolean value)
Sets if the title for this graph should be displayed or not.In most cases refresh() should be called for the changes to take effect
Parameters:
String - title Title for this graph
Since:
MWDK1.0

showXAxis

public void showXAxis(boolean value)
Sets if the X-Axis should be displayed or not.In most cases refresh() should be called for the changes to take effect

showYAxis

public void showYAxis(boolean value)
Sets if the Y-Axis should be displayed or not.In most cases refresh() should be called for the changes to take effect

showXLabel

public void showXLabel(boolean value)
Sets if the X-Label should be displayed or not.In most cases refresh() should be called for the changes to take effect

showYLabel

public void showYLabel(boolean value)
Sets if the Y-Label should be displayed or not.In most cases refresh() should be called for the changes to take effect

setViewType

public void setViewType(int value)
Sets the view type to one of the following predefined values. This is helpful when the graph is to show the details. in ZOOM_OUT mode the values on the x-axis and y-axis start from zero and extend upto the max value that the curve has. in ZOOM_IN mode the curve is made to just fit into the graph. In this case the origin is not at (0,0) but very close to the minimum x and y values.

MakeLogic Wireless - microGraphs API
v1.0

Submit a bug or feature

MakeLogic is a trademark or regis.
Copyright 2002 MakeLogic. 19-111/1,Gauthamnagar,Malkajgiri,Hyderabad, AP, India