Graph Manipulation

Graph Manipulation Methods

addmenuitem

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
textString

Defines the text to be displayed.

"resize" | ...

functionString

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

"window.myFunc()" | ...

orderNumeric

The order of custom context menu items.

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

101 | 2 | 105 | ...

https://app.zingsoft.com/demos/embed/IMV9GPHJ
https://app.zingsoft.com/demos/embed/IMV9GPHJ

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 | ...

nodeindexNumeric

The index of where the scale node should be inserted.

If it is not set, it is placed at the end.

0 | 8 | 20 | ...

scaleString

The index of where the scale node should be inserted.

If it is not set, it is placed at the end.

0 | 8 | 20 | ...

updateBoolean

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

valueMixed

The new scale value.

5 | "Jan" | ...

https://app.zingsoft.com/demos/embed/763FB33O
https://app.zingsoft.com/demos/embed/763FB33O

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');

load

https://app.zingsoft.com/demos/embed/VRZ14LJQ
https://app.zingsoft.com/demos/embed/VRZ14LJQ

Loads a new JSON packet from a URL.

zingchart.exec('myid', 'load', {
  dataurl : 'newjson.php'
});
AttributeTypeInfo
dataurlString

The URL to read the JSON from.

"newjson.php" | ...

https://app.zingsoft.com/demos/embed/SFNKFA54
https://app.zingsoft.com/demos/embed/SFNKFA54

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
dataObject

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 | ...

objectString

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

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

updateBoolean

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

https://app.zingsoft.com/demos/embed/763FB33O
https://app.zingsoft.com/demos/embed/763FB33O

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 | ...

https://app.zingsoft.com/demos/embed/GEZ7KPI8
https://app.zingsoft.com/demos/embed/GEZ7KPI8

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>

nodeindexNumeric

The index of the value to be removed.

0 | 8 | 20 | ...

scaleString

The name of the scale.

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

updateBoolean

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

https://app.zingsoft.com/demos/embed/KG7OEMT3
https://app.zingsoft.com/demos/embed/KG7OEMT3

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
heightMixed

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%" | ...

widthMixed

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%" | ...

https://app.zingsoft.com/demos/embed/SJU23QJ6
https://app.zingsoft.com/demos/embed/SJU23QJ6

Takes a full JSON packet to replace the current one.

zingchart.exec('myid', 'setdata', {
  data: {...}
});
AttributeTypeInfo
dataObject

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

{...}

updateBoolean

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

https://app.zingsoft.com/demos/embed/MO8KPNEC
https://app.zingsoft.com/demos/embed/MO8KPNEC

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 | ...

keyvalueNumeric

The nodeindex which the guide fires at.

2 | 1 | ...

https://app.zingsoft.com/demos/embed/H7F2UJ4L
https://app.zingsoft.com/demos/embed/H7F2UJ4L

Flushes and applies all queued data manipulation changes set via API calls.

zingchart.exec('myid', 'update');