ZingChart: How to Speed Up My Chart
First: Analyze
Common chart attributes that slow down a chart
rulesbecause this generates a large if statement inside parse. If you have manyrulesobjects, you will have manyifstatements.
2D
valuesarray. If you are plotting timeseries data, this will always be a limiting factor to how fast your chart is. We can only parse and render a 2Darrayat an optimal speed compared to a 1Dvaluesarray.Turn off animation.
How many plots do you have. Do you have one plot with 20k points or do you have two hundred plots with one hundred points? The amount of plots vs nodes will also slow down rendering.
Second: Optimize
Speeding up your charts can be dependent on the chart type you are using. There are a general list of attributes in the plot object that will help.
"plot":{
// helps with smart sampling
"mode":"fast",
// helps crosshair rendering (crosshairs are MUCH faster than tooltips for chart types with nodes/markers)
"exact":true,
// smart sample dataset and render data
"smartSampling":true,
// max nodes to have event listeners for eg) tooltips wont show but crosshair will
"maxNodes":100,
// max nodes to have event listeners for eg) tooltips wont show but crosshair will
"maxTrackers":100,
}
Defining a canvas render can be a quick way to speed up a render
zingchart.render({ output: 'canvas' });
Lastly, the next level of speed comes from global zingchart object settings.
zingchart.DEV.CACHECANVASTEXT = true;
zingchart.DEV.CHECKDECIMALS = false;
zingchart.DEV.CACHESELECTION = true;
zingchart.DEV.MEDIARULES = false;
zingchart.DEV.SKIPTRACKERS = true;
zingchart.render({...});