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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:10:05+00:00 2026-05-22T21:10:05+00:00

I have been trying for days to plot a simple line graph utilising HighchartsJS

  • 0

I have been trying for days to plot a simple line graph utilising HighchartsJS via ajax. I have tried posting on their forum but help seem to be slow in coming forward.

I am using ASP.NET web forms.

Server Side

<WebMethod(EnableSession:=True)> _
    Public Function getData() As String

        Dim dr As DataRepository = New DataRepository
        Dim data As List(Of ArrayList) = New List(Of ArrayList)

        For Each q In dr.getAllData()
            Dim a As New ArrayList
            Dim d As Date = q.DateTime
            a.Add(d.Ticks)
            a.Add(q.TotalRevenue)
            data.Add(a)
        Next

        Dim ser As Serie = New Serie(data)

        Dim str As String = JsonConvert.SerializeObject(ser)

        Return str

    End Function

This returns the following json object, Please note the double quotes wrapping everything.

"{"data":
    [
        [634420512000000000,100000.0000],
        [634421376000000000,100086.0000],
        [634422240000000000,100171.0000],
        [634423104000000000,100257.0000]
    ]
}"

Clientside i am calling the above function and rendering my chart like so.

$(document).ready(function () {
    var options = {
        chart: {
            renderTo: 'container',
            defaultSeriesType: 'line'
        },
        title: {},
        xAxis: {
            type: 'datetime'
        },
        yAxis: {},
        series: []
    };

    $.ajax({
        type: "POST",
        dataType: "json",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        url: "_services/ScriptService.asmx/getData",
        success: function (items) {

            var obj = jsonParse(items.d);
            var series = { data: [] };

            $.each(obj, function (itemNo, item) {
                series.data.push(item);
            });

            options.series.push(series);

        },
        cache: false,
        error: function (XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); }
    });
    chart = new Highcharts.Chart(options);
});

‘items’ in the above call is as follows;

"{"data":
    [
        [634420512000000000,100000.0000],
        [634421376000000000,100086.0000],
        [634422240000000000,100171.0000],
        [634423104000000000,100257.0000]
    ]
}"

I use ‘jsonParser(items.d’) to create a correct json object(removing the double quotes).

‘obj’ now contains my json object and ‘item’ when inspected in firebug now looks like this;

[
    [634420512000000000, 100000], 
    [634421376000000000, 100086], 
    [634422240000000000, 100171], 
    [634423104000000000, 100257]
]

When my chart renders, the points do not get plotted. What am I doing wrong?

Solved the issue.

Needed to change the line

series.data.push(obj.data);

to;

series.data = obj.data;
  • 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-22T21:10:06+00:00Added an answer on May 22, 2026 at 9:10 pm

    Solved the issue.

    Needed to change the line

    series.data.push(obj.data);
    

    to;

    series.data = obj.data;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying PyMC these days, and I wrote a very simple mcmceasy.py.
I have been trying to work on a simple code for two days now.
I have been trying to days now to get this website completed ... however,
I have been trying for 4 days to get app-engine and grails working together
I have been trying for days to figure out how to parse this JSON
I have been trying to get a2billing to work for the past 4 days
I have been trying to set up Titanium and Android for 3 days. Still
I have been trying to optimize an ASP.NET C# application for a few days
I have been trying to set up OpenCV for the past few days with
i have been trying to uplaod an application to apple store for 2 days

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.