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

  • Home
  • SEARCH
  • 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 3605624
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:08:50+00:00 2026-05-18T21:08:50+00:00

I’m using Highcharts (link to a specific demo — click View Options to compare

  • 0

I’m using Highcharts (link to a specific demo — click View Options to compare below code) to render some data for personal-use.

[Note: this is almost definitely a me-related error, so I don’t mean to insinuate that Highcharts is at fault — it’s really a wonderful api!]

When setting the series.data field of the chart object, I encounter strange array sectioning.

For instance, this works fine:

series: [{
    name: 'seriesName',
    data: [22, 24, 15]
}]

And three data points are plotted with values 22, 24 and 15.

However,

series: [{
    name: 'sillySeries',
    data: chartData[0]
}]

renders 3 points with the values 2, 4 and 5 and the titles of the points are 2, 2 and 1 respectively… that is, it’s splitting the array entries into a title and then a value for two-digit numbers.

console.log shows me that chartData looks like

22,24,15,2010-9,2010-10,2010-11 

(3 values for 3 months)

Although the actual arrays are more like [22,24,15][2010-9,2010-10,2010-11]

My 2d-array chartData[][] has [column][row] indices for the data, and I figured that asking for chartData[0] would return an array.

Perhaps my question should be: How do I return a 1d array from a 2d array representation for setting properties/values in javascript objects? It seems like I’m probably overlooking something very obvious.


edit:

data: [24]

plots one point at 24, awesome.

data: '24'

splits up the data as title and then value, effectively plotting a point at 4 and not 24.

So the representation becomes a string when I try to pass an array to the data field. Any way I can do like string.toArray ?


edit 2:

chartData[col][row] is declared as an empty array

var chartData = [];

and subsequently filled up with values by iterating over an HTML table’s rows and columns, where the innermost loop contents look like

chartData[cellIndex][rowIndex] = $(currentCell).text();
  • 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-05-18T21:08:51+00:00Added an answer on May 18, 2026 at 9:08 pm

    parseInt() saved the day.

    something like

    for (i=0; i<chartData[0].length; ++i) {
        columnOne.push(parseInt(chartData[0][i]);
    }
    

    gave me an array that I could then use to display the data with the data field in the object notation

    data: columnOne
    

    or more literally

    chart1.series[0].data = columnOne;

    Thank you James for pointing out

    While chartData is probably an array, it sounds like chartData[0] is a string.

    which lead to my discovery that the data in my array was actually all strings, which I kept this way because some fields are strings, some are dates (YYYY-MM-DD) and some are just ints.

    Many thanks to you both =)

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Does anyone know how can I replace this 2 symbol below from the string
I'm making a simple page using Google Maps API 3. My first. One marker
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6

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.