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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:09:14+00:00 2026-05-30T03:09:14+00:00

I have a flot graph that polls data via ajax from an XML document.

  • 0

I have a flot graph that polls data via ajax from an XML document. I use mode: time for x axis. It works fine, except intermittently, some values from the xml Document gets dropped. Here is the code that fetches xml via ajax.

function graphUpdate() { 
    $.ajax( { 
        url: "EnergyDM.xml",
        type:"GET",
        dataType: "XML",
        success: onxmlReceived,
        error: function(xhr, textStatus, errorThrown)
        { 
            alert(textStatus + ' ' + errorThrown);
        }
    });
    // setTimeout(graphUpdate,10000);   
}   

function onxmlReceived(data) {

    var xmlData = null;

    //for Non IE Browsers
    if(window.DOMParser) {
        //xmlData = data;
        parser = new DOMParser();
        xmlData = parser.parseFromString(data, "text/xml");
    }

    // For IE
    else {
        xmlData = new ActiveXObject("Microsoft.XMLDOM");
        xmlData.async = false;
        xmlData.loadXML(data);
    } 

    $(xmlData).find('energyDM').each(function(){
        Rec_Count = parseInt($(this).find('edNum').text());
        d1=[];
        for(var i = 0; i < Rec_Count; i++) {
            if(i < 10) { 
                d1.push([(parseInt($(this).find('et000'+i).text(),10))*1000,
                    parseFloat($(this).find('ed000'+i).text())]);
            } else if(i < 100) {
                d1.push([(parseInt($(this).find('et00'+i).text(),10))*1000,
                    parseFloat($(this).find('ed00'+i).text())]);
            } else {  
                d1.push([(parseInt($(this).find('et0'+i).text(),10))*1000,
                    parseFloat($(this).find('ed0'+i).text())]);
            }   
        }
        plotWithOptions();
    });

}

The XML file looks like this:

<energyDM>
  <edNum>305</edNum>
  <TMF>UTC </TMF>
  <pm339> 1.271</pm339><!-- pm339 max energy demand value -->
  <pm340>1325033716</pm340><!-- pm340 max energy demand occured time -->
  <ed0000> 0.282</ed0000>
  <et0000>1325545093</et0000>
  <ed0001> 0.283</ed0001>
  <et0001>1325544792</et0001>
  <ed0002> 0.284</ed0002>
  <et0002>1325544492</et0002>
  ...
  <ed0305> 0.284</ed0305>
  <et0305>1325544492</et0305>
</energyDM>

When the returned XML misses nodes, if I use Chrome to view the values, it shows something like:

  <ed0023> 0.283</ed0023>
  <et0023>1325538176</et0023>
  <ed0024> 0.281</ed0024>
  <et0024>1325537875</et0024>
  <ed0035> 0.281</ed0035>
  <et0035>1325534564</et0035>
  <ed0036> 0.280</ed0036>
  <et0036>1325534263</et0036>

And this does not always happen. If I keep refreshing the page, it may drop few nodes, then the whole thing comes up, etc. And it is not always the same nodes getting dropped either.

I’d appreciate any hints.

  • 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-30T03:09:15+00:00Added an answer on May 30, 2026 at 3:09 am

    As suggested by @MArk, The problem was with the XML generation. The processor from microchip which works out the XML file uses a stack which caused some bugs when multiple hits were made to the server simultaneously. When this happens, the subsequent interrupts were handled without completely taking care of the current action. This was found, and fixed and now the xml is good.

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

Sidebar

Related Questions

I have a working flot graph, showing dynamically from sql using ajax. My problem
I have two pages that use the flot jquery plugin, and they both work
I want my flot graph to update it's data on set intervals. I have
I've created an ajax driven flot line chart that I would like to have
I am trying to plot some data in Flot that should display x-axis in
I am working on a flot graph where i have a few data points
I have a CSV file that I would like to use as source data
I am trying to graph with Flot some data over time. The data being
I have a graph of memory use over time which looks like: I set
I have a very basic web page that uses flot to create a canvas

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.