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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:00:01+00:00 2026-06-10T18:00:01+00:00

I am trying to update high charts on page load and on select menu

  • 0

I am trying to update high charts on page load and on select menu change with JQUERY AJAX call. There is data being returned in [[10,1228800000],[10,1228800000]] format.The chart is blank and does not graph any of the data.

Tried several solutions posted on here but none worked.

var chart;
        $(document).ready(function() {


            var options = {
                chart: {
                    renderTo: 'stats',
                    defaultSeriesType: 'spline'
                },
                title: {text:''},
                xAxis: {
                    type: 'datetime'
                },
                yAxis: {},
                series: []
            };
    var month = 'July';
    $.ajax({
        type: "POST",
        data: "month="+month,
        url: "update_visits_chart",
        success: function (data) {

            options.series.push(data);
            chart = new Highcharts.Chart(options);
        }
    });

Any errors? thanks in advance.
EDIT:

MOST RECENT CODE STILL NOT WORKING:

var options = {

            chart: {
                renderTo: 'stats',
                type: 'spline'
            },
            title: {
                text: ''
            },
            xAxis: {

                type:'datetime',
                tickInterval: 30 * 24 * 3600 * 1000,
                dateTimeLabelFormats: {
                    day: '%b %e'
                },
                labels: {
                    rotation: -45,
                    align: 'right'
                }
            },
            yAxis: {
                title: {
                    text: 'Number of visits'
                },
                min: 0
            },
            tooltip: {
                formatter: function() {
                        return Highcharts.dateFormat('%b %e', this.x) +'<br />'+this.y+' visit(s)';
                }
            },
            legend: {
                enabled: true
            },
            credits: {
                enabled: false
            },
            exporting: {
                enabled: false
            },
            series: [{
                name: 'Number of Visits',
                data: []
            }]
        };
        var month = 'July';
        $.ajax({
            type: "POST",
            url: "update_visits_chart",
            data: "month="+month,
            success: function(data){
                options.series[0].data = data;
                chart = new Highcharts.Chart(options);
            }
        });
  • 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-10T18:00:04+00:00Added an answer on June 10, 2026 at 6:00 pm

    You have to use the setData methode of the series object as descriped in documentation. In your case it is options.series[0].setData(Data)

    And I think you have to turn your Ajax result from string to a real object/array by using JSON.parse(data).

    EDIT:
    @Ricardo Lohmann: in the ajax-call he did not specify the dataType he expects in the response, so jQuery will guess the dataType. But it will not recognize a string starting with [ as JSON and I doubt his response will be served with correct mime type application/json. So specifying the correct mime type should also solve the problem. But I do not have an example of the complete ajax respons of the questioner. So I’m just guessing, too.

    I’d recommend the following ajax call:

    $.ajax({
        type: "POST",
        url: "update_visits_chart",
        data: {month: month},
        dataType: 'json',
        success: function(data){
            options.series[0].setData(data);
        }
    });
    

    @Jugal Thakkar

    $.getJSON is just a shortcut for the ajax-call above, but it is less flexible because you have less options.

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

Sidebar

Related Questions

Im trying to update a table with the following code. If I change WHERE
We are trying to build a High-Volume Orders Record System. There are three primary
I'm trying to improve performance under high load and would like to implement opcode
I'm trying to update an existing data series with a new data array and
I'm trying to create a data import mechanism for a database that requires high
I am trying update my version of sqlite3 on mac os x 10.5.7 I
I am trying update text views while this loop is processing. Here is my
I trying to update a model on a callback but the validation is causing
When trying to update a subversion working copy from Netbeans, I get the following
Im trying to update the contents of an element after running some php code.

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.