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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:38:57+00:00 2026-05-27T12:38:57+00:00

i am trying to render jqplot graph by fetching data by Ajax xml. $.ajax({

  • 0

i am trying to render jqplot graph by fetching data by Ajax xml.

  $.ajax({
        type: "POST",
        url: "/ajaxXML.jsp",
        data: ({cmd: "report"}),
        dataType: "xml",
        success: function(xml) {
                var data= new Array();
                $(xml).find('graph').each(function(){
                var points = new Array()
                var x = $(this).attr('x');
                var y = $(this).attr('y');
                points.push(x);
                points.push(y);
                data.push(points);
            });

            plotGraph(data);

        }
    });             


function plotGraph( data){
     var line1=[['11-01-11',2052], ['11-02-11',2205], ['11-03-11',1910], ['11-04-11',2085], ['11-05-11',2261],  ['11-06-11',1714],  ['11-07-11',3123], ['11-08-11',3369], ['11-09-11',3515], ['11-10-11',3380], ['11-11-11',3476], ['11-12-11',3954], ['11-13-11',2799], ['11-14-11',3166], ['11-15-11',2932] ,['11-16-11',3289]];
     alert(data);
     alert(line1);
  $.jqplot('chart1', [data], {
        title:'Margin vs Date',
        axes:{
            xaxis:{
                renderer:$.jqplot.DateAxisRenderer
            },
            yaxis:{autoscale:true}
        },
        series:[{lineWidth:4}]

      });
}

the xml looks like

     <graphs>
       <graph x="11-28-2011" y="48973"></graph>
       <graph x="11-29-2011" y="41981"></graph>
        <graph x="11-30-2011" y="45562"></graph>
       <graph x="12-01-2011" y="82437"></graph>
         <graph x="12-02-2011" y="83979"></graph>
       <graph x="12-03-2011" y="64444"></graph>
   </graphs>

but some how this strategy is not working only the x axis is populated with no data points or y axis on graph.

however when i try to see the sample data i.e line1 it works even though the data fetchced by ajax call is almost similar

  • 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-27T12:38:57+00:00Added an answer on May 27, 2026 at 12:38 pm

    When you parse the xml your y values are pushed into the array as strings not integers. Try:

    $(xml).find('graph').each(function(){
      var points = new Array()
      var x = $(this).attr('x');
      var y = $(this).attr('y');
       points.push(x);
       points.push(parseInt(y)); //modified line!
       data.push(points);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to render some data from a large XML using XSLT. The
I am trying to render a complex XML document as webpage(FF only) using a
Trying to render a list, each of which has an ajax form to get
I'm trying to render XML+XSL 2.0 in browser, returning .xml pages with application/xml content
Im trying to render a django template from a database outside of djangos normal
I am trying to render a user control into a string. The application is
I am trying to render a model in Direct3D using DrawIndexedPrimitives . However, I
I'm trying to render a bit of text using Core Graphics APIs and I'm
I'm trying to render a colored cube after rendering other cubes that have textures.
I am trying to render about 100,000 - 80 column records through FOP and

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.