addmenuitem

DemoAdds 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
textStringDefines the text to be displayed.

"resize" | ...

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

"window.myFunc()" | ...

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

101 | 2 | 105 | ...

DemoAdds a new value on the scale.


          
zingchart.exec('myid', 'addscalevalue', {
    graphid : 0,
    scale : 'scale-x',
    nodeindex : 4,
    value : 23
});
        
AttributeTypeInfo
graphid (optional)MixedThe id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

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

0 | 8 | 20 | ...

scaleStringThe name of the scale.

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

updateBooleanSets (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

valueMixedThe new scale value.

5 | "Jan" | ...

DemoDestroys 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

DemoLoads a new JSON packet from a URL.


          
zingchart.exec('myid', 'load', {
    dataurl : 'newjson.php'
});
        
AttributeTypeInfo
dataurlStringThe URL to read the JSON from.

"newjson.php" | ...

DemoModifies 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
dataObjectThe JSON packet to apply to the graph. It will be merged with the previous JSON.

{...}

graphid (optional)MixedThe id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

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

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

updateBooleanSets (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

DemoReloads the chart, or only a specific chart from the graphset if graphidparameter is provided.


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

          
zingchart.exec('myid', 'reload', {
    graphid : 0
});
        
AttributeTypeInfo
graphid (optional)MixedThe id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

DemoRemoves a value from the scale.


          
zingchart.exec('myid', 'removescalevalue', {
    graphid : 0,
    scale : 'scale-x',
    nodeindex : 4
});
        
AttributeTypeInfo
graphid (optional)MixedThe id/index of the graph. The default is 0.

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

nodeindexNumericThe index of the value to be removed.

0 | 8 | 20 | ...

scaleStringThe name of the scale.

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

updateBooleanSets (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

DemoResizes the chart according to new dimensions set by the width and heightparameters.


          
zingchart.exec('myid', 'resize', {
    width : 600,
    height : 400
});
        

          
zingchart.exec('myid', 'resize', {
    width : '100%',
    height : 200
});
        
AttributeTypeInfo
heightMixedSets the new width of the chart. If percentage value is provided, then the width will be relative to the container's width.

500 | "50%" | ...

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

500 | "50%" | ...

DemoTakes a full JSON packet to replace the current one.


          
zingchart.exec('myid', 'setdata', {
    data : {...}
});
        
AttributeTypeInfo
dataObjectThe JSON packet to apply to the graph. It will replace the previous JSON.

{...}

updateBooleanSets (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

DemoFire the guide object at a specific node.


          
zingchart.exec('myid', 'setguide', {
        graphid  : 0,
        keyvalue : 2
    });
        
AttributeTypeInfo
graphid (optional)MixedThe id/index of the graph. The default is 0.

"mygraph" | 0 | 1 | ...

keyvalueNumericThe nodeindex which the guide fires at.

2 | 1 | ...

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


          
zingchart.exec('myid', 'update');
        
On This Page