Custom Chart Scripts

VAIGAI_KOTHANDA
Giga Contributor

Hi ,

We have a requirement to create a   custom chart to display a bar graph of the number of created, resolved, and open.   Open is defined as not in 'resolved' or 'closed' incident state.   These bar graphs are grouped by location.   The date used is current date.   Use a filter on the assignment group to capture only those incidents that are assigned to an assignment group.

The chart will display a Graph that has three bars that represent number created, resolved, and open for each location for that day (the date the report is being generated)

can you please guide on this requirement.

Regards,

Vaigai K

1 ACCEPTED SOLUTION

Hi Travis,



Appreciate your info here.



But our requirement is something as below:-



Custom Chart Scripts


Custom Chart Script:



Both the above link here will explain you the requirement.



We are not aware with the scripting of Custom Charts, so if you can guide us with that then it would be great!! Travis Toulson



Thanks,


Shahid


View solution in original post

20 REPLIES 20

Hi Travis, Travis Toulson



Sorry for bugging you again.



We are stuck here with a big problem.


We want to use the dot walk functionality inside the groupBy() function as shown in the below part of a script.



var ga = new GlideAggregate('incident');


  •               ga.addEncodedQuery(allQuery);
  •               ga.addAggregate('COUNT');
  •               ga.groupBy('location.company.name');
  •               ga.orderBy('location.company.name');
  •               ga.query();
  •               while (ga.next()) {
  •                       categories.push(ga.location.company.name+ '' || '(empty)');
  •               }



But i think the GlideAggregate is not allowing us to do the same and we are not able to get the right data here in the report.



What we exactly want here is to group the data by location's company name.



Can you guide us here as we have already scratched our head out trying all the possible way we know.



Thanks,


Shahid


Hi Vaigai,



In this case, we can change query to get locations with no parent as categories.


And for series too, change the query such as to aggreagare on all child locations too..



Hope this helps..



Regards,


Saranesh


Hi tltoulson,


That video was excellent. Thanks for sharing the script too! Just curious, given what you've shown us, how would one reproduced the Custom Chart Example found in the wiki   with this technique and HighCharts? Essentially a trend chart of closed and opened incidents side by side.


Hey Luis,



It's actually easier than you might think.   Almost everything will stay the same.   The main difference is that you need to change your GlideAggregates addTrend function to create a Trend based grouping.   Then when you push the value to the categories, you will want to push ga.getValue('timeref') to retrieve the time value (month name, week number, etc) or you can create your own string for the category.   You still add values to the series with the same code.



You also need to change the type in the chart configuration from column to line I think.   I'm short on time so I wasn't able to put together the code.   If you're still having trouble with this explanation, let me know and I will try to find some time to sit down and put together a demo.


I gave it the ol' college try. This is currently out of my realm.   Thanks anyway.