Advertisement
andikas

highchart

Dec 7th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $.ajax({
  2.    url: base_url+'/dashboard/graph-booking-week',
  3.    type: 'GET',
  4.    async: true,
  5.    dataType: "json",
  6.    success: function (data) {
  7.        var tgl = [];
  8.        var graph = [];
  9.        $.each(data, function(index, dataa){
  10.                                tgl.push(index);
  11.                                graph.push(dataa);
  12.                              });
  13.        var detail = {
  14.            container : 'container-week',
  15.            title: 'Number of transactions per week',
  16.            axisTitle: 'Date'
  17.        }
  18.        visitorData(detail,graph,tgl);
  19.    }
  20.   });
  21.  
  22.   function visitorData (detail,data,tgl) {
  23.      Highcharts.chart(detail.container, {
  24.          title: {
  25.              text: detail.title
  26.          },
  27.  
  28.          yAxis: {
  29.              title: {
  30.                  text: 'Total transactions'
  31.              }
  32.          },
  33.          xAxis: {
  34.              categories:tgl,
  35.              title: {
  36.                  text: detail.axisTitle
  37.              }
  38.          },
  39.          legend: {
  40.              layout: 'vertical',
  41.              align: 'center',
  42.              verticalAlign: 'bottom'
  43.          },
  44.          series: [{
  45.              name: 'Booking',
  46.              data: data
  47.          }],
  48.  
  49.     });
  50.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement