jquery - How to remove decimal from Year, in google chart API? -


i have implemented google chart api in admin panel. have worked, data loaded in jquery.

here's code:-

google.load("visualization", "1", { packages: ["corechart"] }); google.setonloadcallback(drawchart);  function drawchart() {     /*--------this code line chart ----------*/               var optionsline = {       title: 'user enrollment statistics',       curvetype: 'function',       legend: { position: 'bottom' }     };                $.ajax({         type: "post",         url: "<?php echo base_url();?>ajax-graph-user-join",         data: {'type':'yearwise','year':'','month':''},         datatype: "json",         success: function (data) {             var dataarr = [];             for(var = 0; < data.length; i++)             {                 var ar = [data[i].year, data[i].user];                 dataarr.push(ar);             }             console.log(dataarr);             var dataline = google.visualization.arraytodatatable(dataarr);             var chartline = new google.visualization.linechart($("#linechart")[0]);             chartline.draw(dataline, optionsline);         },         failure: function (r) {             alert(r.d);         },         error: function (r) {             alert(r.d);         }     }); } 

now, explain issue, sharing image:- enter image description here

as can see, years(along x-axis) showing decimals 0 , .5

i want years shown integer only, , without comma i.e. 2,014.

how can that?

edit:-

after been suggested put haxis: {format: '0000'} in optionsline, graph coming this: enter image description here

two 2015 , 2 2016

use haxis.format configuration option

var optionsline = {   title: 'user enrollment statistics',   curvetype: 'function',   legend: { position: 'bottom' },   haxis: {     format: '0000'   } };           

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -