Highcharts test tool

by Bhabani Raju

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container"></div>

CSS

#container {
    min-width: 300px;
    max-width: 800px;
    height: 300px;
    margin: 1em auto;
}

JavaScript

$(document).ready(function() {

 $.ajax({
 			dataType: "json",
        url: 'https://newapi.brandwatch.com/projects/1998196209/data/volume/queries/days/?endDate=2016-11-14T00:00:00.000Z&queryId=1998657357&startDate=2016-11-01T00:00:00.000Z&access_token=c59b4f94-5a05-4251-a1ea-b29725802b6f',
        success: function(response) {
        var jsontext = response.results;
     //alert(jsontext.length);
var jsonName;var jsonValue;
        $(jQuery.parseJSON(JSON.stringify(jsontext))).each(function() {  
            var data =this.values;
            //alert(data.length);
            var jname = []; var jvalue = [];
            $(data).each(function(index, element) {
                //alert('Name: ' + element.name + ', Value: ' + element.value);
                var splitname = element.name.split(" ");
                jname.push(splitname[0]
                );
                
                jvalue.push(
                    element.value
                    //Math.floor((Math.random() * 100) + 1)
                );
                
            });
             jsonName = jname;
             jsonValue = jvalue;
            //alert(jsonName);   
            //alert(jsonValue);

        });
           Highcharts.chart('container', {
             xAxis: {
                  categories: jsonName
              },
              series: [{
                  data: jsonValue,
                  type: 'column',
                  name: 'Date'
              }]
					});
        
      }
    });
    

});