CHART

From iMath
Jump to: navigation, search

Syntax

CHART ( string , expression , expression , expression , expression , integer , string )

CHART ( string , symbol = expression , expression , equation , expression , integer , string )

CHART ( string , symbol = expression , expression , expression , expression , integer , string )

Implemented in iMath since version 2.2.0 or earlier.

Explanation

Update or create data in a chart with the Office object name given in the first string (in other words, the chart must already exist in the document).

  • X values: The first expression must be a vector of values or an relation assigning a vector of values to a variable.
  • Units of X values: If the x-values contain units, they must be given in the second expression. In other words, after dividing the x-values by the units, a vector of numbers must result.
  • Y values: The third expression must be either a vector of values or an equation or an equation label. If you specify an equation or a label, the vector of x-values will be substituted into the equation to produce a vector of y-values. This will only work if you specified the x-values as a relation!
  • Units of Y values: If the y-values contain units, they must be given in the fourth expression.
  • Chart series: The fifth argument is the index of the chart series. It is assigned by iMath and should not be changed.
  • Series name for the legend: The last argument gives the series name for the legend, because specifying it through the Office chart dialog does not work properly.

Please always use the iMath menu when creating charts or adding a series to a chart. Otherwise, it is not guaranteed that the communication between iMath and the Office chart object works properly.

Example

Chart of a linear function, x-values range from 0 to 5.

 %%ii @y@ EQDEF y = x+c
 %%ii @c@ EQDEF c = 5
 %%ii CHART {"Object3",x=0:5,1,VAL(RHS(@y@)),1,1,"linear function"}

Chart of a linear function with units, x-values range from 0 to 5m.

 %%ii @y@ EQDEF y = x+c
 %%ii @c@ EQDEF c = 5"m"
 %%ii CHART {"Object27",x=0:5"m","m",VAL(RHS(@y@)),"m",1,"linear function"}

See also