Using GenResultsTable to display a pie chart

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
Is there any way to display a Pie Chart Report from Quickbase into a new window created by a code page? I am trying to create a button to generate a daily summary report and it was requested to get a Pie Chart of the data. I know Highcharts could be used as an external tool but is there a way to just display a Pie Chart that is currently in Quickbase already?
Photo of William Marrone

William Marrone

  • 310 Points 250 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of Dan

Dan

  • 140 Points 100 badge 2x thumb
This is best done with script and the QuickBase API and is a three step process:

(1) Use the API to get the raw data the pie chart would be based on

(2) Use Underscore and jQuery libraries to process the data. This will likely involve filter and aggregating the data using various underscore methods (groupBy, CountBy etc). The data needs to be formatted into a HighChart option objecct (you can see the relevant code on the HighChart's demo page).

(3) Use underscore's template method to take the aggregated data and merge it into a template and display within a QuickBase page.

There are examples somewhere in the forum you can search for. If you get stuck follow up here.
Photo of Chad Cox

Chad Cox

  • 120 Points 100 badge 2x thumb
I am running into the same issue as the OP. I have a Pie Chart displayed just fine in QB. I did not create the Pie Chart, someone else did. I am being tasked with getting it to show up in another site (WordPress) using the API to call it.

Below is what my Pie Chart report URL looks like (without my domain).
/db/boquead?a=q&qid=160&nv=1&v0=314&ifv=1

Below is the URL I am using to get all the JavaScript that would help me recreate this Pie Chart in my site.
/db/boquead?a=API_GenResultsTable&qid=160&nv=1&v0=314&jsa=1

What I am seeing is the first URL that displays the report shows me 14 items in my legend and 14 corresponding slices of the pie chart. The JavaScript data that gets returned does not have the legend items with their names, and it does not contain all of the individual slices of data. I get 125 items in my array, many of them are empty, some are $0, and I am not getting any names. From the data that gets returned, I would not be able to recreate this pie chart report, as I am missing the legend items and some of the values.

Am I missing something with my approach? How can I get the legend items? Which is what each slice of the pie represents?

Thanks for any help.