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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:35:04+00:00 2026-06-04T05:35:04+00:00

×212414 ×123754 I am calling a PageMethod in codebehind.aspx.cs file which returns me a

  • 0

×212414
×123754

I am calling a PageMethod in codebehind.aspx.cs file which returns me a string array[] in the javascript code in the aspx page the problem at hand is that string array returns Time(X axis-Value),Data/Name(Y axis Value),Type(Defines the type of chart (Spline or Column)) from a WEB SERVICE. I am using that data to add series dynamically to the chart. Using the function chart.AddSeries() but I am unable to do so.

Can anyone please guide me how to do that and upon doing that I want to add points to the particular Series.

Please Note that I would be displaying to types{Spline and Column} on the same chart.

<script type="text/javascript">


     alert("Bingo");


     $(function () {
         $(document).ready(function () {

             Highcharts.setOptions({

                 global: {

                     useUTC: false

                 }

             });



             var chart;

             chart = new Highcharts.Chart({

                 chart: {

                     renderTo: 'ltrChart',

                     type: 'spline',

                     marginRight: 10,

                     events: {

                         load: function () {


                             PageMethods.GetSingleValue(function (result) {

                                 var Name = new Array();
                                 var Type = new Array();
                                 var Data = new Array();
                                 var Time = new Array();

                                 var Ser = chart.series;

                                 for (var i = 0; i < 6; i++) {
                                     Type[i] = result[i].split('-')[0];
                                     Name[i] = result[i].split('-')[1];
                                     Data[i] = result[i].split('-')[2];
                                     Time[i] = result[i].split('-')[3];

   chart.addSeries({ name :Name[i], data : [ [Time[i], Data[i]] ] }, true, true);




                                     /* Test Method To ensure data Fetching */
                                     // alert(Type[i] + Name[i] + Data[i] + Time[i]);
                                     // alert(result[i]);


                                 }

                             })



                             //console.log(typeof PageMethods.GetSingleValue);
                             // PageMethods.GetSingleValue();
                             setInterval("PageMethods.GetSingleValue()", 5000);







                         }

                     }

                 },

                 title: {

                     text: 'Live random data'

                 },

                 xAxis: {

                 //type: 'datetime',

                 //tickPixelInterval: 150

             },

             yAxis: {

                 title: {

                     text: 'Value'

                 },

                 plotLines: [{

                     value: 0,

                     width: 1,

                     color: '#808080'

                 }]

             },

             tooltip: {

                 formatter: function () {

                     return '<b>' + this.series.name + '</b><br/>' +

                        Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +

                        Highcharts.numberFormat(this.y, 2);

                 }

             },

             legend: {

                 enabled: false

             },

             exporting: {

                 enabled: false

             },

             series: [{

                 name: 'Test Data',

                 data: [[10, 50], [15, 55]]

             }]

         });

     });

 });  
   </script>
  • 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-04T05:35:05+00:00Added an answer on June 4, 2026 at 5:35 am

    This is what I’ve done and works like a charm. On a side-note, since you mentioned aspx page, why don’t you just buy the dot net highcharts library? It makes life a lot easier if you’re a dot net fan!

    I am initially creating a chart with 5 elements, and then using the “iterated” JSON serialized string to pass data to client-side. Traversing the elements gives me a dynamic live chart!

    Highcharts chart = new Highcharts("livechart")
            .InitChart(new Chart
            {
                Events = new ChartEvents { Load = "ChartEventsLoad" }
            })
            .SetSeries(initialSeries)
            .SetXAxis(new XAxis { Categories = lsst.ToArray() })
            .AddJavascripVariable("iterated", iterateData.ToString())
            .AddJavascripVariable("index", "5")
            .AddJavascripFunction("ChartEventsLoad",
            @"// set up the updating of the chart each 5 seconds
            var result = iterated;
            var theseries = eval(result); // De-serializing the JSON object
            var loopseries = function() {
            var sseries = livechart.series[0]
               ,shift = sseries.data.length > 5; // shift if the series is longer than 5;
            sseries.addPoint(theseries[0].data[index], true, shift);
            var sseries1 = livechart.series[1]
            sseries1.addPoint(theseries[1].data[index], true, shift);
            index++; };
            setInterval(loopseries, 5000);")
    

    You can add as many series as you like; you can use a loop if needed and the same code I’ve added as a function can be used to create the chart completely in Javascript.

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

Sidebar

Related Questions

This is my code: conn = sqlite3.connect(nnpcconfig.commondb) cur = conn.cursor() query = ['2124124', 'test2',
We've just set up one of our projects in TeamCity (7.0 (21241)) to label

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.