<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ZingSoft Demo</title> <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script> <style></style> </head> <body> <div id='myChart'></div> <script> ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"]; var myConfig = { type: "bar", title: { text: 'Y-Axis Non-Zero Value' }, plotarea: { maskTolerance: [0, 0] //prevent bars from overflowing x-axis, }, scaleY: { minValue: null }, series: [{ values: [35, 42, 67, 89, 25, 34, 67, 85] }] }; zingchart.bind(null, 'dataparse', function(e, oGraph) { var dynamicMinvalue = 0; // sanity checks so we don't throw console error with malformed graph JSON if (oGraph && oGraph.graphset && oGraph.graphset[0]) { if (oGraph.graphset[0].series && oGraph.graphset[0].series[0]) { dynamicMinvalue = oGraph.graphset[0].series[0].values.reduce(function(a, b) { return Math.min(a, b); }); oGraph.graphset[0].scaleY.minValue = (dynamicMinvalue - 10); } } return oGraph; }); zingchart.render({ id: 'myChart', data: myConfig, height: 400, width: '100%' }); </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ZingSoft Demo</title> <script src="https://cdn.zingchart.com/zingchart.min.js"></script> </head> <body> <div id='myChart'></div> </body> </html>
var myConfig = { type: "bar", title: { text: 'Y-Axis Non-Zero Value' }, plotarea: { maskTolerance: [0, 0] //prevent bars from overflowing x-axis, }, scaleY: { minValue: null }, series: [{ values: [35, 42, 67, 89, 25, 34, 67, 85] }] }; zingchart.bind(null, 'dataparse', function(e, oGraph) { var dynamicMinvalue = 0; // sanity checks so we don't throw console error with malformed graph JSON if (oGraph && oGraph.graphset && oGraph.graphset[0]) { if (oGraph.graphset[0].series && oGraph.graphset[0].series[0]) { dynamicMinvalue = oGraph.graphset[0].series[0].values.reduce(function(a, b) { return Math.min(a, b); }); oGraph.graphset[0].scaleY.minValue = (dynamicMinvalue - 10); } } return oGraph; }); zingchart.render({ id: 'myChart', data: myConfig, height: 400, width: '100%' });