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 9222935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:57:13+00:00 2026-06-18T03:57:13+00:00

Seem to be struggling to get my data in the correct format for use

  • 0

Seem to be struggling to get my data in the correct format for use with a highchart’s pie chart.

If I force the data as follows my graph appears so I know I’ve done the integration correctly:

data: [
      ['Test', 30],
      ['Other', 70],
      ]

But when I try and use my actual data, it ain’t working.

I’ve tried the following which doesn’t work:

data: <%= Location.browsers.map { |o| [o.type, o.count] }.inspect %>

Have also tried:

data: <%= Location.browsers.map { |o| "#{o.type}, #{o.count}" }.to_json %> 

The first one gives me a result like this:

"[[\"Safari\", 6448], [\"Microsoft\", 5253], [\"Microsoft-CryptoAPI\", 5185], [\"Dalvik\", 3870], [\"Chrome\", 3701], [\"Mozilla\", 3239], [\"Android\", 2285], [\"Windows-Update-Agent\", 2018], [\"Internet Explorer\", 1843], [\"Firefox\", 1459]]"

Which looks ok.

What’s the correct way to run this query?

  • 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-18T03:57:14+00:00Added an answer on June 18, 2026 at 3:57 am
    data: <%= raw Location.browsers.map { |o| [o.type, o.count] } %>
    

    or

    data: <%= raw Location.browsers.map { |o| [o.type, o.count] }.to_s %>
    

    should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling to use Chromium Tabs in Cocoa and I really seem to be
I've been struggling for the entire day, I can't seem to get it right
Im just learning C# at uni and seem to be struggling to get this
I am consuming the following WCF Data Service, I can't seem to get the
Really struggling to get to these route data values...When I type I just cant
I'm strugling a bit with old libs and can't seem to get from QRCodeWriter
I've been struggling with this for several hours and can't seem to figure out
I'm struggling in creating a RTL UI in iPhone application. The framework doesn't seem
This might seem an easy question for some, but I am struggling with it.
I've been struggling with how to structure my 3-tier applications. I always seem to

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.