Discussions

Expand all | Collapse all

How to use a Summary Report in Javascript with Highcharts

  • 1.  How to use a Summary Report in Javascript with Highcharts

    Posted 01-21-2018 15:45
    I would like to use a summary Report in javascript with the API_GenResultsTable.  The report is summarizing sales for ProjectManagers and grouping by YearMonth(yyyy-mm).

    When I run the report it looks like this:



    However, I can't find the fields in javascript that are holding the data.  When I use the jsa=1 parameter I find the qdb_data[0,0] but it only shows the Sales value.  I can't find the associated PM and YearMonth???

    Does anyone know how I can do this?  I could run a doQuery but then I would have to summarize all the sales by month in the javascript.  Of course I can do this, but I was hoping to be able to leverage the summary reports.

    Any thoughts?

    Thanks,
    Dean


  • 2.  RE: How to use a Summary Report in Javascript with Highcharts

    Posted 01-25-2018 14:44
    All the API methods that perform a query (ie API_DoQueryAPI_GenResultsTable ...) return rectangularly arranged data (be it XML, CSV, JS Array). HighCharts requires grouped data to generate some type aggregated chart. Therefor you have to group /  aggregate the raw data in JavaScript using something like _.groupBy() before building the HighChart options variable.