Summ:  Constr. Methods    Details:  Constr. Methods   
com.artfulbits.aiCharts
Class ChartField

java.lang.Object Field com.artfulbits.aiCharts.ChartField

Declaration: public class ChartField extends Field

 

Represents Field-derived class used to draw chart. ChartField initially wraps ChartEngine objects and delegates layout and paint calls accordingly. All operations involving chart's objects manipulation have to be performed on wrapped ChartEngine. ChartField class may be instantiated directly in net.rim.device.api.ui.container.MainScreen MainScreen of your net.rim.device.api.ui.UiApplication UiApplication
 public class StepAreaSampleApp extends UiApplication
 
 public static void main(String[] args)
 {
  StepAreaSampleApp app = new StepAreaSampleApp();
  app.pushScreen(new StepAreaSampleScreen());
  app.enterEventDispatcher();
 }
 
 
 lass AreaSampleScreen extends MainScreen
 
 ChartField chartField = new ChartField();
 
 public StepAreaSampleScreen()
 {
  ChartArea chartArea = new ChartArea();
  ChartSeries series1 = new ChartSeries(ChartTypes.StepArea);
 
  double[] data1 = { 32, 26, 26, 29, 39, 48, 45, 52, 55, 50 };
 
  for (int i = 0; i < data1.length; i++)
  {
   series1.getPoints().addXY(i, data1[i]);
  }
 
  chartField.getSeries().add(series1);
 
  chartField.getAreas().add(chartArea);
  chartField.setPalette(ChartPalette.MSOffice);
  chartField.setBorder(BorderFactory
    .createBevelBorder(new XYEdges(4, 4, 4, 4)));
 
  add(chartField);
 }
 
 protected void sublayout(int width, int height)
 {
  chartField.setSize(width, height);
 
  super.sublayout(width, height);
 }
 
 
Samples along the SDK will give more idea of ChartField class usages.

 

Since: 1.0
See also: getChart()

 

 

Constructors Summary
ChartField()
    
Initializes a new instance of ChartField.
ChartField(long style)
    
Initializes a new instance of ChartField.

 

 

Methods Summary
ChartNamedCollection getAreas()
    
Gets current areas collection linked to wrapped chart.
ChartEngine getChart()
    
Gets the instance of ChartEngine class that is currently wrapped by this view.
ChartNamedCollection getLegends()
    
Gets the legend collection.
ChartPalette getPalette()
    
Returns current palette assigned to chart.
ChartNamedCollection getSeries()
    
Gets the series collection.
ChartCollection getTitles()
    
Returns titles collection.
void setHeight(int height)
    
Sets height for this field.
void setPalette(ChartPalette palette)
    
Sets chart palette.
void setSize(int width, int height)
    
Sets both: width and height for this field.
void setWidth(int width)
    
Sets width for this field.

 

Methods inherited from class: java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

 

 

 

ChartField

 

public ChartField( long style)

 

Initializes a new instance of ChartField.

 

Parameters:
style-
forwarded to parent Field

 

 

 

ChartField

 

public ChartField( )

 

Initializes a new instance of ChartField.

 

 

 

 

getPalette

 

public ChartPalette getPalette( )

 

Returns current palette assigned to chart.

 

Returns:
instance of ChartPalette class

 

Since: 1.0
See also: ChartPalette

 

 

 

setPalette

 

public void setPalette( ChartPalette palette)

 

Sets chart palette.

 

Parameters:
palette-
instance of ChartPalette class.

 

Since: 1.0
See also: setPalette(ChartPalette)ChartPalette

 

 

 

getChart

 

public ChartEngine getChart( )

 

Gets the instance of ChartEngine class that is currently wrapped by this view. ChartEngine should be used to manipulate chart components.

 

Returns:
instance of ChartEngine class.

 

Since: 1.0
See also: ChartEngine

 

 

 

getSeries

 

public ChartNamedCollection getSeries( )

 

Gets the series collection.
 // Iterate over series collection.
 for(ChartSeries series : chartView.getSeries())
 {
 	// Set series properties here
 	...
 }
 

 

Returns:
instance of ChartNamedCollection containing series objects

 

Since: 1.0
See also: ChartSeries

 

 

 

getAreas

 

public ChartNamedCollection getAreas( )

 

Gets current areas collection linked to wrapped chart.

 

Returns:
instance of ChartCollection class containing current areas of chart

 

Since: 1.0
See also: ChartArea

 

 

 

getLegends

 

public ChartNamedCollection getLegends( )

 

Gets the legend collection.

 

Returns:
instance of ChartCollection containing currently assigned legends.

 

Since: 1.0
See also: ChartLegend

 

 

 

getTitles

 

public ChartCollection getTitles( )

 

Returns titles collection.

 

Returns:
instance of ChartCollection containing titles.

 

Since: 1.0
See also: ChartTitle

 

 

 

setWidth

 

public void setWidth( int width)

 

Sets width for this field.

 

Parameters:
width-
desired width.

 

See also: setHeight(int)setSize(int,int)

 

 

 

setHeight

 

public void setHeight( int height)

 

Sets height for this field.

 

Parameters:
height-
desired height.

 

See also: setWidth(int)setSize(int,int)

 

 

 

setSize

 

public void setSize( int width,
int height)

 

Sets both: width and height for this field.

 

Parameters:
width-
desired width.
height-
desired height.

 

See also: setWidth(int)setHeight(int)

 

 

© 2005 - 2010 ArtfulBits. All rights reserved.