ZingChart jQuery AJAX Demo

A quick example of how to use the ZingChart jQuery Wrapper with AJAX for asynchronous charting.

HTML

<script src="http://cdn.zingchart.com/zingchart.jquery.min.js"></script>
<script src="http://cdn.zingchart.com/zingchart.min.js"></script>
<div id="myChart"></div>
<button type="button">Draw Trendline</button>

CSS

#myChart {
    height:400px;
    width:600px;
}

JavaScript

// Data for the chart
var myData = {
    type: "line",
    plot:{
        aspect:"spline"
    },
    series: [
        {
            values: [(1,0)(1,1)(50,8)(100,44)(211,40)(44,11)]
        }
    ]
};

// Make your chart
$("#myChart").zingchart({
    data: myData
});

// Bind a click event to the button
$("button").click(function(){
    
    // Draw Trendline
    $("#myChart").drawTrendline({
        lineColor: "#F00",
        lineWidth: 1,
        alpha: 1,
        lineStyle: "solid"
    });
});