High-charts Plug-in for ServiceNow

ppparmar
Giga Contributor

Has anyone used High-charts plugin for generating fancy reports?

13 REPLIES 13

Sure do.   com.glideapp.report.charting_v2 v0.1 running in glide-eureka-04-08-2014__patch3-hotfix1-07-30-2014


It seems as though another script include that used to be loaded by default in Dublin, is no longer loaded automatically. You will have to include GlideV2ChartingIncludes.jsx as well. Glad you pointed this out, we're still on Dublin in prod but have Eureka in dev.




<?xml version="1.0" encoding="utf-8" ?>  


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">  


<script>


<script>


<script>


var jane = '1,0,4';  


var J = jane.split(',');


for(var i=0; i != J.length; i++) { J[i] = parseInt(J[i], 10); }




var bob = '3,7,9';  


var B = bob.split(',');


for(var i=0; i != B.length; i++) { B[i] = parseInt(B[i], 10); }


 


 


document.observe("dom:loaded", function() {  


  alert(B);


  alert(J);


      var chart1 = new Highcharts.Chart({  


 


 


              chart: {  


                      renderTo: 'newchart',  


                      type: 'bar'  


              },  


 


 


              title: {  


                      text: 'Fruit Consumption'  


              },  


 


 


              xAxis: {  


                      categories: ['Apples', 'Bananas', 'Oranges']  


              },  


 


 


              yAxis: {  


                      title: {  


                              text: 'Fruit eaten'  


                      }  


              },  


 


 


              series: [{    


                              name: 'Jane',    


                              data: J  


                      },    


                      {    


                              name: 'Bob',    


                              data: B  


              }]    


      });  


});


</script>


<script>


<div id="highwrapper" style="width: 940px; height: 680px; position:relative;">


<div id="newchart" style="width: 400px; height: 600px; margin: 20; position:absolute;top:0px;left:0px;"></div>


</div>


</j:jelly>  


btw - I also converted your data points for your series data in the arrays J and B into integers, otherwise your chart will show no data. Series data has to be in integer form.


You, Sir, have gone above and beyond.   Many thanks for the assist.   Bob and Jane will eat much fruit.



BobandJane.png


It was my pleasure, after all, my reports would've broken as soon as I upgraded prod to Eureka in a couple of weeks. In case you have a need for it, I've also gone on to incorporate a time period selector to my original report so that the users can select the range of time they want to pull data for. It's a lot of code to sift through but I'd be more than happy to share should you ever have a need for it.