Zingchart click event handling
I am not sure where to put following zingchart click ev开发者_如何学Cent handling code in the html page. zingchart.click = function(dataStr){ var data = eval('(' + dataStr + ')'); alert("Chart Clicked - ID: " + data["id"]); }
If anybody knows please provide the sample HTML code.
The zingchart.click
function can go anywhere after the zingchart script include.
Here is an example:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../zingchart-1.1.min.js"></script>
</head>
<body>
<div>
<div>
<div id="zingchart"></div>
</div>
<script type="text/javascript">
var jsonConfig = '{"graphset" : [{"type" : "line","series" : [{"values" : [5, 10, 15, 5, 10, 5]}] }]}';
zingchart.render({
data : jsonConfig,
width : 600,
height : 300,
container : 'zingchart'
});
zingchart.click = function(data){
alert("Chart Clicked - ID: " + data["id"]);
}
</script>
</div>
</body>
</html>
精彩评论