HChart - Test kiwis request v1.5

Query a kiwis v1.5 timeseries for generic Timestamp

HTML

<script src="http://code.highcharts.com/stock/highstock.js"></script>
<button id="btnAddKiWIS">Add Series</button>
<button id="btnAddKiWIS">Praise the Devil</button>
<button id="btnClear">Clear Table</button>
<div id="ChartContainer" style="height: 400px"></div>

JavaScript

var seriesFull = [];

function makeData(tsURL, tsName) {
    //Ajax query for data in JSON format
    $.getJSON(tsURL, function (data) {
        var data2 = data[0].data; //pointer to KVP parent object
        var data3 = []; //will store updated KVP for each item
        
        //Loop through date and param values and format for chart
        for (var i = 1; i < data2.length; i++) {
            //Get the date based on how requested in KiWIS, line below changes based on how you request the datestamp
            var myDate = new Date(data2[i][0].substring(0, 23));
            //Convert to UNIX time (easier if just request UNIX)
            var result = myDate.getTime();
            data2[i][0] = result; //updates the date in KVP to unix
            data2[i][1] = parseFloat(data2[i][1]); //Makes the param value a number
            data3.push(data2[i]); //Push new KVP into data3
        }
        
        //populate the series for the chart
        var singleSeries = {
            _colorIndex: seriesFull.length,
            _symbolIndex: seriesFull.length,
            //Can also extract name directly from query, but lazy example
            name: tsName,
            data: data3
        };
        seriesFull.push(singleSeries);
        
        //Create and render the chart passing in the series
        createMyChart2(seriesFull);
    });
}

$("#btnAddKiWIS").click(function () {
        makeData("http://waterdata.quinteconservation.ca/KiWIS/KiWIS?service=kisters&type=queryServices&request=getTimeseriesValues&datasource=0&format=json&ts_id=1400042&header=true&metadata=true&from=2013-06-25", "TS1");
});

$("#btnClear").click(function () {
    seriesFull.length = 0;
    var dataReset = [];
    $("#ChartContainer").html("");
});

function createMyChart2(dataSeries) {
    var chart = new Highcharts.StockChart({
        chart: {renderTo: 'ChartContainer'},
        legend: {enabled: true},
        rangeSelector: {selected: 1},
        title: {text: "Bryan's Test"},
     ...