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

  • Home
  • SEARCH
  • 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 9222833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:55:45+00:00 2026-06-18T03:55:45+00:00

I want to create a graph using Highcharts plugin and the data should be

  • 0

I want to create a graph using Highcharts plugin and the data should be parsed as an XML file.
The XML file data2.xml is,

<data>  
<row><t>1347559200</t><v>2.1600000000e+01</v></row> 
<row><t>1347562800</t><v>2.1504694630e+01</v></row> 
<row><t>1347566400</t><v>2.1278633024e+01</v></row> 
</data>

The HTML coding is,

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>line chart</title>
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="highcharts.js"></script>
<script src="exporting.js"></script>

<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
<script type="text/javascript">
$(document).ready(function(){

    options = {
      chart: {
          renderTo: 'container',
          type: 'spline'
      },
      title: {
          text: 'Temperatures'
      },
      subtitle: {
          text: 'An example of time data in Highcharts JS'
      },
      xAxis: {
          type: 'datetime',
          dateTimeLabelFormats: { // don't display the dummy year
              month: '%e. %b',
              year: '%b'
          }
      },
      yAxis: {
          title: {
              text: 'T (°C)'
          },
          min: 0
      },
      tooltip: {
          formatter: function() {
                  return '<b>'+ this.series.name +'</b><br/>'+
                  Highcharts.dateFormat('%e. %b', this.x) +': '+ this.y +' m';
          }
      },

      series: [{
          name: 'Temperature',
          data: []
      }]
    }

  $.ajax({
    type: "GET",
    url: "data2.xml",
    dataType: "xml",
    success: function(xml) {
      var series = {  data: []
                  };

      $(xml).find("row").each(function()
      {
          var t = parseInt($(this).find("t").text())*1000
          var v = parseFloat($(this).find("v").text())
          series.data.push([t,v]);
      });
      options.series.push(series);
    }
  });

  chart = new Highcharts.Chart(options);
});
  </script>
</body>
</html>

If I execute this code It opens fine in Internet Explorer and displays the result as

Result in Internet Explorer

When I open this file in Chrome it gives me the result as,

Result in Google chrome

with the error message:

XMLHttpRequest cannot load file:///C:/data2.xml. Origin null is not allowed by Access-    Control-Allow-Origin.

so that I used Tomcat server to run this. Though it displays the same chart image without the mentioned error message.

How to overcome this?? How can I display the chart in Google Chrome by fetching data from xml file by solving this issue??

  • 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-18T03:55:47+00:00Added an answer on June 18, 2026 at 3:55 am

    I got this working out..
    I just run this code by using Apache/Tomcat..

    I think the error I have made is that
    1. I have to save this file in .jsp format.
    2. add var to chart and options variable.
    3. Use this chart = new Highcharts.Chart(options); inside the success function.

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

Sidebar

Related Questions

I want to create a graph stacked column using Highcharts plugin with the data
I want to create a graph of items on a certain day using data
I want to create a Login through Facebook on a website using Graph API
I want to create a matrix representation for a graph algorithm using the least
I want to create events on behalf of the user using the Graph API.
I'm using the HighStock version of HighCharts to create a series of data in
I want to create a graph using JFreeChart and display it in a java
I am using webcharts3d to create a gauge graph for my webpage. I want
I want to create a graph using Jgraph, and later use that graph to
I want to create a graph with 31 days of data and then with

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.