Show Nav

Data Manipulation

Adds a node to an existing plot.
zingchart.exec('myid', 'addnode', {
    graphid : 0,
    plotindex : 1,
    nodeindex : 2,
    value : 37
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

nodeindex Numeric

The index in the specified plot where the new node should go. The current values will be shifted. If this parameter is not set, it is placed at the end.

0 | 8 | 20 | ...

plotid String

The id of the plot to add data to.

"mylineplot" | ...

plotindex Numeric

The index of the plot to add data to.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

value Numeric

The value to add to the plot.

45 | 0.27 | ...

Adds a new plot.
zingchart.exec('myid', 'addplot', {
    graphid : 0,
    plotindex : 1,
    data : {
        values : [10, 20, 15, ...],
        text : "My new plot"
    }
});
AttributeTypeInfo
data/plotdata Object

The JSON data that would be set in the series section of the JSON for the individual plot.

{...}

graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

The id of an existing plot after which the new plot will be inserted. If it is not set, it is placed at the end.

"mylineplot" | ...

plotindex Numeric

The index of the plot to be inserted. If it is not set, it is placed at the end.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Appends data to the existing series. Can be used on a single plot or the whole series.
Note: that the value arrays sent do not concatenate the existing ones.
zingchart.exec('myid', 'appendseriesdata', {
    graphid : 0,
    plotindex : 1,
    data : {
        lineColor : "red"
    }
});
zingchart.exec('myid', 'appendseriesdata', {
    graphid : 0,
    data : [
        {
            lineColor : "red"
        },
        {
            lineColor : "yellow"
        }
    ]
});
AttributeTypeInfo
data Mixed

The JSON data that would be set in the series section of the JSON for the individual plot. If setting multiple plots, data should be in an array.

{...} | [ {...}, {...}, ... ]

graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

The id of the plot if only appending the data on a single plot.

"mylineplot" | ...

plotindex Numeric

The index of the plot if only appending the data on a single plot.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Appends data to the end of a plot. Can be used on a single plot or the whole series.
zingchart.exec('myid', 'appendseriesvalues', {
    plotindex : 1,
    values : [19, 28, 13, 42, ...]
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

The id of an existing plot after which the new plot will be inserted. If it is not set, it is placed at the end.

"mylineplot" | ...

plotindex Numeric

The index of the plot if only appending the data on a single plot.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

values Array

An array of values to append. If plotindex is not specified, the data should be an array of arrays.

[...] | [ [...], [...], ... ]

Returns the series data as an object. If plot is specified via plotindex or plotid then only that series item data is returned.
zingchart.exec('myid', 'getseriesdata', {});
zingchart.exec('myid', 'getseriesdata', {
    graphid : 0,
    plotindex : 1
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

The id of the plot if only setting the data on a single plot.

"mylineplot" | ...

plotindex Numeric

The index of the plot if only setting the data on a single plot.

0 | 1 | ...

Returns the series values in an array or an array of arrays. If plot is specified via plotindex or plotid then only that series item values are returned.
zingchart.exec('myid', 'getseriesvalues', {});
zingchart.exec('myid', 'getseriesvalues', {
    plotindex : 2
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

The id of the plot if only setting the data on a single plot.

"mylineplot" | ...

plotindex Numeric

The index of the plot if only setting the data on a single plot.

0 | 1 | ...

Modifies an existing plot.
zingchart.exec('myid', 'modifyplot', {
    graphid : 0,
    plotindex : 1,
    data : {
        lineWidth : 2,
        lineColor : "yellow"
    }
});
AttributeTypeInfo
data/plotdata Object

The JSON string that would be appended in the series section of the JSON for the individual plot.

{...}

graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

The id of an existing plot after which the new plot will be inserted. If it is not set, it is placed at the end.

"mylineplot" | ...

plotindex Numeric

The index of the plot to be inserted. If it is not set, it is placed at the end.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Removes a node.
zingchart.exec('myid', 'removenode', {
    graphid : 0,
    plotindex : 1,
    nodeindex : 2
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

nodeindex Numeric

The index of the node to be removed. The values will be shifted.

0 | 8 | 20 | ...

plotid String

The id of the plot to remove the data from.

"mylineplot" | ...

plotindex Numeric

The index of the plot to remove the data from.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Removes a plot.
zingchart.exec('myid', 'removeplot', {
    graphid : 0,
    plotindex : 1
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

The id of the plot to be removed.

"mylineplot" | ...

plotindex Numeric

The index of the plot to be removed.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Sets the new 3D parameters for the view, overrides the settings from 3d-aspect attribute of the chart
zingchart.exec('myid', 'set3dview', {
    'y-angle' : 10,
    depth : 60
});
AttributeTypeInfo
graphid Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

x-angle
xAngle
Numeric

Sets the X rotation viewing angle for the true 3D view. Viewing angle may vary depending on the chart type.

0 | 8 | 20 | ...

y-angle
yAngle
Numeric

Sets the Y rotation viewing angle for the true 3D view. Viewing angle may vary depending on the chart type.

"mygraph" | 0 | 1 | ...

z-angle
zAngle
Numeric

Sets the Z rotation viewing angle for the true 3D view. Viewing angle may vary depending on the chart type.

5| 10| ...

depth Numeric

Sets the Z depth for a 3D chart type displayed in either isometric or true 3D.

5 | 10 | ...

Changes the value on a single node.
zingchart.exec('myid', 'setnodevalue', {
    graphid : 0,
    plotindex : 1,
    nodeindex : 2,
    value : 80
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

nodeindex Numeric

The index of the node to replace.

0 | 8 | 20 | ...

plotid String

The id of the plot.

"mylineplot" | ...

plotindex Numeric

The index of the plot.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Replaces the series data. Can be used on a single plot or the whole series.
zingchart.exec('myid', 'setseriesdata', {
    graphid : 0,
    plotindex : 1,
    data : {
        values : [10, 15, 20, ...],
        lineColor : "red"
    }
});
zingchart.exec('myid', 'setseriesdata', {
    graphid : 0,
    data : [
        {
            values : [10, 15, 20, ...],
            lineColor : "red"
        },
        {
            values : [40, 25, 30, ...],
            lineColor : "yellow"
        }
    ]
});
AttributeTypeInfo
data Mixed

The JSON data that would be set in the series section of the JSON for the individual plot. If setting multiple plots, data should be in an array.

{...} | [ {...}, {...}, ... ]

graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

The id of the plot if only setting the data on a single plot.

"mylineplot" | ...

plotindex Numeric

The index of the plot if only setting the data on a single plot.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Replaces the series values. Can be used on a single plot or the whole series.
zingchart.exec('myid', 'setseriesvalues', {
    values : [
        [19, 28, 13, 42, ...],
        [37, 11, 27, 25, ...]
    ]
});
zingchart.exec('myid', 'setseriesvalues', {
    plotindex : 1,
    values : [19, 28, 13, 42, ...]
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

The id of the plot if only setting the data on a single plot.

"mylineplot" | ...

plotindex Numeric

The index of the plot if only setting the data on a single plot.

0 | 1 | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

values Array

An array of values. If plotindex is not specified, the data should be an array of arrays.

[...] | [ [...], [...], ... ]

Export

Exports the current data. Only works if exportdataurl is set in zingchart.render or url parameter is set.
zingchart.exec('myid', 'exportdata');
Returns a Base64 encoded image string. Returns -1 if failed to get image data.
Note: charts with output: 'svg' must get data inside callback function.
zingchart.exec('myid', 'getimagedata', {
    filetype : 'png'
});
AttributeTypeInfo
filetype/format String

The image filetype. The default is jpg. Other options are bmp (flash only) and png.

"png" | "jpg" | "bmp" (flash only)

callback Function

The callback function is used for svg charts exporting

function(imagedata) {...}

Creates a printable version of the chart and attempts to print it.
zingchart.exec('myid', 'print');
Produces an image of the graph. Only works if exportimageurl is set in zingchart.render or url parameter is set.
zingchart.exec('myid', 'saveasimage');

Feed

Clears the current graph and restarts the feed.
zingchart.exec('myid', 'clearfeed');
Returns the interval value set on the feed.
zingchart.exec('myid', 'getinterval');
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Sets the feed interval on a feed graph. 49 is the max numeric value in seconds, if you put 50 it switches to milliseconds.
zingchart.exec('myid', 'setinterval', '{"interval" : 3}');
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

interval Numeric

Time of the feed interval set in seconds or milliseconds.

1 | 500 | ...

Starts the feed.
zingchart.exec('myid', 'startfeed');
Stops the feed.
zingchart.exec('myid', 'stopfeed');

Graph Information

Returns the chart's type.
zingchart.exec('myid', 'getcharttype', {
    graphid : 0
});
zingchart.exec('myid', 'getcharttype', {
    graphid : "mygraph"
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Returns the entire JSON.
zingchart.exec('myid', 'getdata');
Returns the number of graphs in the chart.
zingchart.exec('myid', 'getgraphlength');
Returns the number of nodes in a given plot.
zingchart.exec('myid', 'getnodelength', {
    graphid : 0,
    plotindex : 2
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotindex Numeric

The index of the plot.

0 | 1 | ...

Returns the value of the given node.
zingchart.exec('myid', 'getnodevalue', {
    graphid : 0,
    plotindex : 2,
    nodeindex : 10
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

nodeindex Numeric

The index in the specified plot of the node.

0 | 8 | 20 | ...

plotindex Numeric

The index of the plot.

0 | 1 | ...

Returns various attributes for specific chart elements (graph, plotarea, scale, plot, node). Depending on the object requested, a subset of the following attributes will be returned: x, y, width, height, lineColor, lineWidth, borderColor, borderWidth, backgroundColor1, backgroundColor2, text, values, minValue, maxValue, step, stepSize.
zingchart.exec('myid', 'getobjectinfo', {
    object : 'graph'
});
zingchart.exec('myid', 'getobjectinfo', {
    object : 'scale',
    name : 'scale-x'
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

name String

The name of the scale if object is "scale".

"scale-x" | "..."

nodeindex Numeric

The index in the specified plot where the new node should go. The current values will be shifted. If this parameter is not set, it is placed at the end.

0 | 8 | 20 | ...

object String

"graph" | "plotarea" | "scale" | "plot" | "node"

plotid String

The id of the plot to add data to.

"mylineplot" | ...

plotindex Numeric

The index of the plot to add data to.

0 | 1 | ...

Returns the number of plots in a given graph.
zingchart.exec('myid', 'getplotlength', {
    graphid : 0
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Returns the value of the given plot.
zingchart.exec('myid', 'getplotvalues', {
    graphid : 0,
    plotindex : 2
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotindex Numeric

The index of the plot.

0 | 1 | ...

Returns the render mode (canvas/svg/vml).
zingchart.exec('myid', 'getrender');
Returns an array containing the ids of the existing rules in a chart.
zingchart.exec('myid', 'getrules',{
    plotindex:0
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotindex Numeric

The index of the plot containing the rules to be returned.

0 | 1 | ...

Returns an array containing the names of the active scales on the chart.
zingchart.exec('myid', 'getscales');
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Returns the version of the library currently being used.
zingchart.exec('myid', 'getversion');
Returns various scale and node related information based on x and y positions in the chart. The returned data is an Array of objects holding information relative to key scales, value scales and node proximity.
zingchart.exec('myid', 'getxyinfo', {
    x : 280,
    y : 120
});
AttributeTypeInfo
x Numeric

The x position.

5 | 10 | ...

y Numeric

The y position.

5 | 10 | ...

Returns an object containing the 3d chart view information. True3d is 1 if not a 3d graph, else true3d returns a boolean value of true if 3d graph.
zingchart.exec('myid', 'get3dview',{
    plotindex:0
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotindex Numeric

The index of the plot containing the rules to be returned.

0 | 1 | ...

Graph Manipulation

Adds a new item to the context menu.
Note: Function must be registered in the global scope.
zingchart.exec('myid', 'addmenuitem', {
    text : "New Item",
    function : 'window.myFunc()',
    order : 4,
});
AttributeTypeInfo
text String

Defines the text to be displayed.

"resize" | ...

function String

Name of the function to be associated with this context menu item.

"window.myFunc()" | ...

order Numeric

The order of custom context menu items. Higher the number, earlier in custom context menu items its placed.

101 | 2 | 105 | ...

Adds a new value on the scale.
zingchart.exec('myid', 'addscalevalue', {
    graphid : 0,
    scale : 'scale-x',
    nodeindex : 4,
    value : 23
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

nodeindex Numeric

The index of where the scale node should be inserted. If it is not set, it is placed at the end.

0 | 8 | 20 | ...

scale String

The name of the scale.

"scale-x" | "scale-x-2" | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

value Mixed

The new scale value.

5 | "Jan" | ...

Destroys the chart, removing the associated DOM nodes and events. Represents the recommended way to remove a chart from a page.
zingchart.exec('myid', 'destroy');
Loads a new JSON packet from a URL.
zingchart.exec('myid', 'load', {
    dataurl : 'newjson.php'
});
AttributeTypeInfo
dataurl String

The URL to read the JSON from.

"newjson.php" | ...

Modifies any part of the current graph.
zingchart.exec('myid', 'modify', {
    graphid : 0,
    data : {
            title : {
            text : "New title"
        }
    }
});
zingchart.exec('myid', 'modify', {
    graphid : 0,
    object : 'title',
    data : {
        text : "New title"
    }
});
AttributeTypeInfo
data Object

The JSON packet to apply to the graph. It will be merged with the previous JSON.

{...}

graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

object String

Optional shortcut to only modify specific parts of the graph. The options are title, plotset (series), plotarea and legend.

"title" | "plotset" | "series" | "plotarea" | "legend"

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Reloads the chart, or only a specific chart from the graphset if graphid parameter is provided.
zingchart.exec('myid', 'reload');
zingchart.exec('myid', 'reload', {
    graphid : 0
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Removes a value from the scale.
zingchart.exec('myid', 'removescalevalue', {
    graphid : 0,
    scale : 'scale-x',
    nodeindex : 4
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | .../p>

nodeindex Numeric

The index of the value to be removed.

0 | 8 | 20 | ...

scale String

The name of the scale.

"scale-x" | "scale-x-2" | ...

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Resizes the chart according to new dimensions set by the width and height parameters.
zingchart.exec('myid', 'resize', {
    width : 600,
    height : 400
});
zingchart.exec('myid', 'resize', {
    width : '100%',
    height : 200
});
AttributeTypeInfo
height Mixed

Sets the new width of the chart. If percentage value is provided, then the width will be relative to the container's width.

500 | "50%" | ...

width Mixed

Sets the new width of the chart. If percentage value is provided, then the width will be relative to the container's width.

500 | "50%" | ...

Takes a full JSON packet to replace the current one.
zingchart.exec('myid', 'setdata', {
    data : {...}
});
AttributeTypeInfo
data Object

The JSON packet to apply to the graph. It will replace the previous JSON.

{...}

update Boolean

Sets (default true) if the data manipulation API is instantly applied or "queued" in a list of consecutive API calls. Require the call of update API in order for all the queued changes to take effect.

true | false | 1 | 0

Fire the guide object at a specific node.
zingchart.exec('myid', 'setguide', {
        graphid  : 0,
        keyvalue : 2
    });
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

keyvalue Numeric

The nodeindex which the guide fires at.

2 | 1 | ...

Flushes and applies all queued data manipulation changes set via API calls.
zingchart.exec('myid', 'update');

History

Goes to the previous page in the chart history.
zingchart.exec('myid', 'goback');
Goes forward one page in the chart history.
zingchart.exec('myid', 'goforward');

Notes

Note: Requires the zingchart-api-annotations.min.js module.
Adds a note to a chart.
zingchart.exec('zc', 'addnote', {
    id : 'note1',
    type : 'node',
    text : 'Note 1',
    plotindex : 0,
    nodeindex : 3
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id String

The id of the note to be added.

"note1" | "note2"

text String

The text to be included in the note.

"Note 1" | "%v widgets"

type String

The type of note to be added.

"node" | "scale" | "xy"

style Object

Styling attributes to be applied to the note.

{ ... }

plotindex Numeric

The index of the plot to which the note will be added.

0 | 1 | ...

nodeindex Numeric

The index of the node to which the note will be added.

0 | 1 | ...

scaleindex Numeric

The index of the scale to which the note will be added.

0 | 1 | ...

scalevalue Mixed

The value of the scale item to which the note will be added.

"Friday" | 1 | 2 | ...

x Numeric

The x position.

5 | 10 | ...

y Numeric

The y position.

5 | 10 | ...

offset-x Numeric

An offset in the x direction to be applied to the note.

5 | -10 | ...

offset-y Numeric

An offset in the y direction to be applied to the note.

0 | 1 | ...

Removes a note from a chart.
zingchart.exec('zc', 'removenote', {
    id : ['note1', 'note2', 'note3']
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id Mixed

The id of the note or notes to be removed.

"rule1" | ["rule1,"rule2"]

Updates an existing note.
zingchart.exec('zc', 'updatenote', {
    id : 'note1',
    style : {
        'border-color' : '#090',
        'border-width' : 5
    },
    type : 'node',
    plotindex : 1,
    nodeindex : 1,
    text : 'Note 1 (revision 1)'
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id String

The id of the note to be updated.

"note1" | "note2"

text String

The text to be included in the note.

"Note 1" | "%v widgets"

type String

The type of note to be updated.

"node" | "scale" | "xy"

style Object

Styling attributes to be applied to the note.

{ ... }

plotindex Numeric

The index of the plot to update the note to.

0 | 1 | ...

nodeindex Numeric

The index of the node to update the note to.

0 | 1 | ...

scaleindex Numeric

The index of the scale to update the note to.

0 | 1 | ...

scalevalue Mixed

The value of the scale item to update the note to.

"Friday" | 1 | 2 | ...

x Numeric

The x position.

5 | 10 | ...

y Numeric

The y position.

5 | 10 | ...

offset-x Numeric

An offset in the x direction to be applied to the note.

5 | -10 | ...

offset-y Numeric

An offset in the y direction to be applied to the note.

0 | 1 | ...

Objects

Adds one or more objects (labels or shapes) on the chart.
zingchart.exec('myid', 'addobject', {
    'type' : 'label',
    'data' : {
        'id' : 'label1',
        'text' : 'My Label',
        'x' : 200,
        'y' : 100
    }
});
AttributeTypeInfo
data Mixed

The data containing the object definitions. It can be an object if just one item is added or an array of objects if many items are added at once.

{...} | [{...}, {...}, ...]

graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

type String

The type of the object.

"label" | "shape"

Removes one or more objects (labels or shapes) from the chart.
zingchart.exec('myid', 'removeobject', {
    'type' : 'label',
    'id' : 'label1'
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id Mixed

The id's of the objects to remove. It can be a string in case one object is removed or an array if many objects are removed.

"label1" | ["label1", "label2", ...]

Repaints all the object collection when previous object related API's were called using update: false
zingchart.exec('myid', 'repaintobjects', {});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Updates one or more objects (labels or shapes) of the chart.
zingchart.exec('myid', 'updateobject', {
    'type' : 'label',
    'data' : {
        'id' : 'label1',
        'background-color' : '#f90'
    }
});
AttributeTypeInfo
data Mixed

The data containing the object definitions. It can be an object if just one item is updated or an array of objects if many items are updated at once. The objects should be referenced by their id's.

{...} | [{...}, {...}, ...]

graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Rules

Note: Requires the zingchart-api-rules.min.js module.
Adds a rule to a chart.
zingchart.exec('myid', 'addrule', {
    id : 'rule1',
    plotindex : 0,
    rule : '%node-value < 50',
    style : {
        'background-color' : '#f00'
    }
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id String

The id of the rule to be added.

"rule1" | "rule2"

plotindex Numeric

The index of the plot.

0 | 1 | ...

rule String

The rule parameters to be added.

"%node-value < 50" | "%v > 50" | ...

style Object

The style to be applied when the rule parameters are met.

{ ... }

Removes a rule from a chart.
zingchart.exec('myid', 'removerule', {
    id : ['rule1', 'rule2']
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id Mixed

The id or ids of the rule or rules to be removed.

"rule1" | ["rule1,"rule2"]

plotindex Numeric

The index of the plot containing the rules to be removed.

0 | 1 | ...

Updates an existing rule.
zingchart.exec('zc', 'updaterule',{
    id : 'rule1',
    plotindex : 0,
    style : {
        'background-color' : '#aaa #333'
    }
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

id Mixed

The id of the rule to be updated.

"rule1" | "rule2"

plotindex Numeric

The index of the plot.

0 | 1 | ...

rule String

The rule parameters to be updated.

"%node-value < 50" | "%v > 50" | ...

type String

The style to be applied when the rule parameters are met.

"background-color" : "#f00" | "border-color" : "#ff0" | ...

Selection

Clears the current node/s selection.
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Deselects a combination of nodes in the chart.
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

nodeindex Mixed

Sets the nodes that will be included in the selection collection.

"1" | "2-4" | [1, 3, 4] | ...

plotindex Mixed

Sets the plots that will be included in the selection collection.

"1" | "2-4" | [1, 3, 4] | ...

Returns the current node/s selection.
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Sets a combination of nodes in the chart as selected. If toggle is true then the nodes already selected will be deselected.
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

nodeindex Mixed

Sets the nodes that will be included in the selection collection.

"1" | "2-4" | [1, 3, 4] | ...

plotindex Mixed

Sets the plots that will be included in the selection collection.

"1" | "2-4" | [1, 3, 4] | ...

toggle Boolean

Sets if the already selected nodes will be deselected.

true | false | 1 | 0

Sets the selection combination for the entire chart.
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

selection Array

An array of objects containing selection information.

[[...], [...]]

Clicks a specified node.
zingchart.exec('myid', 'clicknode');
Closes modal screen.
zingchart.exec('myid', 'closemodal');

Toggle

Makes the chart inactive for user interactions, usually in the case of time consuming operations. An optional text can be provided as a waiting message. See enable.
zingchart.exec('myid', 'disable', {
    text : 'Wait, data is being fetched...'
});
AttributeTypeInfo
text String

Sets a text to be displayed while the chart is disabled.

"Wait..." | ...

Makes the chart active for user interactions. See disable.
zingchart.exec('myid', 'enable');
Destroys the full screen render of the chart.
zingchart.exec('myid', 'exitfullscreen');
Renders the chart in full screen mode.
zingchart.exec('myid', 'fullscreen');
Hide the guide object.
zingchart.exec('myid', 'hideguide');
Hide the context menu.
zingchart.exec('myid', 'hidemenu');
Hides the plot set by plotindex (or plotid).
zingchart.exec('myid', 'hideplot', {
    graphid : 0,
    plotindex : 2
});
zingchart.exec('myid', 'hideplot', {
    plotindex : 1
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

Sets the id of the plot.

"mylineplot" | ...

plotindex Numeric

Sets the index of the plot.

0 | 1 | ...

toggle-action String

Sets the toggle action performed when the plot is hidden.

"hide" | "remove"

Maximizes the legend.
zingchart.exec('myid', 'legendmaximize');
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Minimize the legend.
zingchart.exec('myid', 'legendminimize');
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Opens chart in a modal window.
zingchart.exec('myid', 'openmodal');
Show the hoverstate of a specific node.
zingchart.exec('myid', 'showhoverstate', {
        nodeindex: 2
    });
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

nodeindex Numeric

The node index on the graph. The default is 0.

0 | 1 | ...

Show the guide object.
zingchart.exec('myid', 'showguide');
Display the context menu.
zingchart.exec('myid', 'showmenu');
Shows the plot set by plotindex (or plotid).
zingchart.exec('myid', 'showplot', {
    graphid : 0,
    plotindex : 2
});
zingchart.exec('myid', 'showplot', {
    plotid : "mylineplot"
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

plotid String

Sets the id of the plot.

"mylineplot" | ...

plotindex Numeric

Sets the index of the plot.

0 | 1 | ...

toggle-action String

Sets the toggle action performed when the plot is hidden.

"hide" | "remove"

Toggles the About Screen.
zingchart.exec('myid', 'toggleabout');
Toggles the Bug Report Screen.
zingchart.exec('myid', 'togglebugreport');
Toggles the Dimension of the current graph between 2D and 3D if possible.
zingchart.exec('myid', 'toggledimension');
Toggles the visibility of the legend.
zingchart.exec('myid', 'togglelegend');
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Toggles the visibility of the View Source Screen.
zingchart.exec('myid', 'togglesource');
Toggles the visibility of the Plot.
zingchart.exec('myid', 'toggleplot');

Tooltip

Hides visibility of tooltip.
zingchart.exec('myid', 'hidetooltip');
Locks a visible tooltip in its visible state.
zingchart.exec('myid', 'locktooltip');
Shows a tooltip.
zingchart.exec('myid', 'showtooltip');
Unlocks a locked tooltip.
zingchart.exec('myid', 'unlocktooltip');

Zoom

Resets the zoom on the chart.
zingchart.exec('myid', 'viewall', {
    graphid : 0
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

Zooms in the graph.
zingchart.exec('myid', 'zoomin', {
    graphid : 0,
    zoomx : true,
    zoomy : true
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

zoomx Boolean

Sets if the graph will zoom on the x scale.

true | false | 1 | 0

zoomy Boolean

Sets if the graph will zoom on the y scale.

true | false | 1 | 0

Zooms out the graph.
zingchart.exec('myid', 'zoomout', {
    graphid : 0,
    zoomx : true,
    zoomy : true
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

zoomx Boolean

Sets if the graph will zoom on the x scale.

true | false | 1 | 0

zoomy Boolean

Sets if the graph will zoom on the y scale.

true | false | 1 | 0

Zooms to a specific area in a graph.
zingchart.exec('myid', 'zoomto', {
    graphid : 0,
    xmin : 10,
    xmax : 40,
    ymin : 1500,
    ymax : 3000
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

kmin Numeric

The minimum Unix time value (in milliseconds) to zoom to.

1417651200000 | 1417661200000 | ...

kmax Numeric

The maximum Unix time value (in milliseconds) to zoom to.

1417651200000 | 1417661200000 | ...

xmax Numeric

The max x position to zoom to.

5 | 10 | ...

xmin Numeric

The min x position to zoom to.

5 | 10 | ...

ymax Numeric

The max y position to zoom to.

5 | 10 | ...

ymin Numeric

The min y position to zoom to.

5 | 10 | ...

Zooms to a specific area in a graph specified by x scale values/labels.
zingchart.exec('myid', 'zoomtovalues', {
    graphid : 0,
    xmin : "Jan",
    xmax : "Apr",
    ymin : 1500,
    ymax : 3000
});
AttributeTypeInfo
graphid (optional) Mixed

The id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

xmax Mixed

The max x value to zoom to.

40 | "Apr" | ...

xmin Mixed

The min x value to zoom to.

10 | "Jan" | ...

ymax Numeric

The max y position to zoom to.

5 | 10 | ...

ymin Numeric

The min y position to zoom to.

5 | 10 | ...