plot
  • 30 Oct 2020
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

plot

  • Dark
    Light
  • PDF

Article summary

Description

Renders a plot visualization to a specified Picture app object.


Input Parameters

NameTypeRequiredDescription
tokenOrNameTextYesPicture app object token or name
lockerTokenTextYesPlot's locker token
widthNumberYesDisplay pixel width (height will auto-scale)
data1ArrayYesPlot's required 1st data series
[data2]ArrayNoPlot's optional 2nd data series
[data3]ArrayNoPlot's optional 3rd data series
[data4]ArrayNoPlot's optional 4th data series
[data5]ArrayNoPlot's optional 5th data series
[data6]ArrayNoPlot's optional 6th data series
[data7]ArrayNoPlot's optional 7th data series
[data8]ArrayNoPlot's optional 8th data series
[data9]ArrayNoPlot's optional 9th data series
[data10]ArrayNoPlot's optional 10th data series

Returns

No return value.


Examples

// 1 series plot example...
// prepare plot data
var data = [10, 25, -30, 50, -15];

// render plot with token 'AAA' to picture object '[20]'
// width of plot will be 200 pixels; height adjusted to scale
app.plot("[20]", "AAA", 200, data);
// 3 series plot example...
// prepare plot data
var data1 = [10, 25, -30, 50, -15];
var data2 = [22, 54, 38.45, -18, -65];
var data3 = [32.64, 81, 104, -45.3, -12];

// render plot with token 'AAA' to picture object '[20]'
// width of plot will be 200 pixels; height adjusted to scale
app.plot("[20]", "AAA", 200, data1, data2, data3);

Remarks

Plots are graphical visualizations of data prepared by your scripts. The configuration of each plot, along with any sample data, is developed using Composer and stored in your app's locker.

When your script runs, this function will replace the sample data in your plot's configuration with the provided series data. Up to 10 data series are currently supported.

You only need to specify the plot's width (in pixels) for rendering. The runtime will ensure the height is scaled appropriately to preserve the plot's native aspect ratio so the plot does not appear distorted.


What's Next