Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9169007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:46:05+00:00 2026-06-17T15:46:05+00:00

I am trying to generate a chart using Google Charts API, but I can’t

  • 0

I am trying to generate a chart using Google Charts API, but I can’t seem to get the data in the required format.

serializeJSON(data) in coldfusion gives me the JSON data, but looks like that is not what the Charts API expects. Is there any component I can use to convert it to the required format?

Query

<cfquery name="getAllUsers" datasource="cccac_swipe" result="UserDetailsResult">
Select login_mode,count(login_mode) as total from login_activity,ccac_registered_users where login_activity.student_id=ccac_registered_users.student_id GROUP BY login_mode
</cfquery>

ColdFusion’s JSON

{"COLUMNS":["LOGIN_MODE","TOTAL"],"DATA":[["manual",123],["swipe",20]]}

Expected JSON

{ "cols": [ {"id":"","label":"SignIn Method","pattern":"","type":"string"}, {"id":"","label":"Count","pattern":"","type":"number"} ], "rows": [ {"c":[{"v":"manual","f":null},{"v":123,"f":null}]}, {"c":[{"v":"swipe","f":null},{"v":20,"f":null}]} ] }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:46:07+00:00Added an answer on June 17, 2026 at 3:46 pm

    This is basically what you need. Just plug in your query data.

    <cfset chartsData = structNew()>
    <cfset chartsData["cols"] = arrayNew(1)>
    
    <!--- use a query loop to copy query data to this struct --->
    <cfloop query="UserDetailsResult">
       <cfset chartsRow = structNew()>
       <cfset chartsRow["id"] = ""> 
       <cfset chartsRow["label"] = "SignIn Method">
       <cfset chartsRow["pattern"] = "">
       <cfset chartsRow["type"] = "string">
    
       <cfset arrayAppend(chartsData["cols"], chartsRow)>
    </cfloop>
    
    <cfset chartsDataJSON = serializeJSON(chartsData)>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Highcharts to generate nice-looking charts. I am trying get these charts
I am trying to set Google Chart using API generated from below link Google
I'm trying to generate a simple static ELF using libelf, but I seem to
I'm using SpiderWebPlot from JFreeChart in order to generate a chart. But what I
I'm trying to automatically generate a line chart using VBA and Excel where each
I'm trying to generate sparklines for a dashboard using the Microsoft chart control on
How can I generate graphs and charts from a mysql database using php? I'm
I'm trying to generate a GeoChart using a set of data retrieved from mysql
I am trying to generate a chart using the MS Chart Control in ASP.NET
Context : I'm trying to create a pie chart using jqPlot, gathering data from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.