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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:15:26+00:00 2026-05-16T00:15:26+00:00

this is my first post, but i’m excited to join this community. I have

  • 0

this is my first post, but i’m excited to join this community. I have a question regarding JavaScript which I am completely stumped about.

I’m writing a JavaScript application which pulls data from a server using ajax and adds it to a chart. I’m using Jquery and Highcharts as the framework and then writing my own JavaScript ‘wrapper’ around Highcharts to produce the interface.

When the processData function get called back with the jSON response, it begins with i=1, even though i shouldn’t even be initialized or even declared yet. Other variables are set as well. (I know this from using chrome developer tools to debug). This makes my loop not execute and none of my data gets added to the chart.

I don’t know how much code to show, but these are the most relevant parts. I can add more if needed.

function getData(series, min, max, numpts) {
        if (series === undefined) {
            console.log("error on getData");
            return;
        }

        var request = {};
        request.series = series;

        if (min !== undefined) {
            request.start = min;
        } //in seconds
        if (max !== undefined) {
            request.end = max;
        } 
        if (numpts !== undefined) {
            request.numpts = numpts;
        }
        $.getJSON('/data', request, processData);
        return;
    }

    function processData(data) {
        // handle the data after it comes back from an ajax request
        var curSeries,
            chartSeries,
            curPoint;

        for (var i = 0; i < data.length; i ++) {
            curSeries = data[i];
            chartSeries = chart.get(curSeries.name);

            if (chartSeries === null) {
                //alert("oops");
                chart.addSeries(curSeries);
            } else {
                for (var j = 0; j < curSeries.data.length; j ++) {
                    curPoint = curSeries.data[j];
                    chartSeries.addPoint(curPoint, false);
                }
            }
        }
        chart.redraw();
    }

These are both methods of a class I declared called graph.

Thanks if anyone has any ideas!
-Matt P

  • 1 1 Answer
  • 1 View
  • 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-16T00:15:27+00:00Added an answer on May 16, 2026 at 12:15 am

    I’d console inspect your data object to make sure it’s what you expect, as that loop should be working fine even if i is pre-declared: you’re assigning 0 to it at the beginning of the loop, anyway.

    The only reason I can think of that i would be defined and initialized before you defined and initialized it is if somewhere else in your codebase you don’t initialize the i with the var keyword. Doing that would dump it into the global scope (the window object), making it available via closure to any and every function in your codebase.

    If it’s not in one of your files, it may be in the highcharts graphing library (in which case run very quickly away from said library).

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

Sidebar

Related Questions

This is my first post, but I have been using this site for a
This is my first post, but this question has racked my brain and Google's
I have completely re-written this first post to better show what the problem is.
this is my first post on this website, but I'm all the time getting
This is my first post, thx, you've been very helpful. But I'm stuck. I
First I am sorry about the length of this post, but I wanted to
This is not a duplicate post, i just done research but not helping. First,
This is my first post and I my first experience with jquery. I have
This is my first post on stackoverflow, so please excuse me if my question
This is my first post here. I have a problem. I need to take

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.