Start of Content Area

Syntax documentation IChartModel  Locate the document in its SAP Library structure

 

public interface IChartModel

Base data model for the chart control.

 

Implementing classes: JCOChartModel, VectorChartModel, DefaultChartModel

 

IChartModel and DefaultChartModel

Method

Description

Argument

Return value

firstRow

Sets the pointer of the actual row to first row in the model and returns the number of the first row.

()

int

getColor

Returns the color value of the current row.

()

java.lang.String

getExtension

Returns the extension value of the current row.

The extension is a text string that is displayed as tooltip when you move the mouse cursor over the chart element. It shows effect on bar and pie charts, but no effect on line charts.

()

java.lang.String

getFieldName

Returns the field name of the actual row and the specified column.

(int col)

java.lang.String

getFieldValue

Returns the field value of the actual row and the specified column.

(int col)

java.lang.String

getGroupId

Returns the group id of the actual row.

()

java.lang.String

getNumColumns

Returns the number of columns in the model.

()

int

getNumRows

Returns the number of rows in the model.

()

int

getRow

Returns the row position of the pointer (actual row).

()

int

getX

Returns the X value of the actual row.

()

java.lang.String

getY

Returns the Y value of the actual row.

()

java.lang.String

nextRow

Sets the pointer to the next row in the model. If the point has reached the end of the model the method returns false.

()

boolean

 

JCOChartModel (Methods in addition to the IChartModel/DefaultChartModel)

Method

Description

Argument

setDataSrc

Sets a JCO data table into this model.

(com.sap.mw.jco.JCO.
 Table DataSrc)

 

VectorChartModel (Methods in addition to the IChartModel/DefaultChartModel)

Method

Description

Argument

addItem

Adds an entry with extension to the model.

The extension is a text string that is displayed as tooltip when you move the mouse cursor over the chart element. It shows effect on bar and pie charts, but no effect on line charts.

If you use a pie chart to display the data, the X values will be used.

(java.lang.String groupid,
 java.lang.String x,
 java.lang.String y,
 java.lang.String color,
 java.lang.String extension)

addItem

Adds an entry with an URL and an alternate text to the model.

The alternate text is a text string that is displayed as tooltip when you move the mouse cursor over the chart element.

URL and alternate text show effect on bar and pie charts, but no effect on line charts.

If you use a pie chart to display the data, the X values will be used.

(java.lang.String groupid,
 java.lang.String x,
 java.lang.String y,
 java.lang.String color,
 java.lang.String url,
 java.lang.String altText)

 

Example

Setting up the VectorChartModel

//  create model
  
VectorChartModel model = new VectorChartModel();
//  add two items of the same group with color 20 and an extension

  
model.addItem("gr1""A""7""20""Information to block A");

  model.addItem(
"gr1""B""4""20""Information to block B");
// add two items of the same group with color 10, an URL and an 
// alternate text

  
model.addItem("gr2","10","3","10","http://www.sap.de","Link to SAP");
  model.addItem(
"gr2","20","1","10","http://www.bmw.de","Link to BMW");

 

Setting up the JCOChartModel

// create a new JCO table
    
JCO.Table table = new JCO.Table("DAX");

// add the info/header to the table. The header is defined by the 
// column name, data type and length (see JCO table API for details).
    
table.addInfo("GROUPID", JCO.TYPE_CHAR, 50);
    table.addInfo(
"X", JCO.TYPE_CHAR, 50);
    table.addInfo(
"Y", JCO.TYPE_CHAR, 50);
    table.addInfo(
"Z", JCO.TYPE_CHAR, 50);
    table.addInfo(
"COLOR", JCO.TYPE_CHAR, 50);
    table.addInfo(
"EXTENSION", JCO.TYPE_CHAR, 150);
// append a record to the table. setValue sets the value as string. 
// The second parameter is the column. The numbers are according to 
// the sequence of the definition of the header (see above).
    
table.appendRow();
    table.setValue(
"07.2001", 0);
    table.setValue(
"SAP", 1);
    table.setValue(
"158", 2);
    table.setValue(
"20", 3);
    table.setValue(
"10", 4);
    table.setValue(
"href=\"http://www.sap-ag.de/\"", 5);

    ..
/   create a JCOChartModel and set the JCO table
    
model = new JCOChartModel();
    ((JCOChartModel) model).setDataSrc(table);

 

 

Related Topics

Using beans and models

 

 

End of Content Area