I'm new to javascript coding in general and I'm having some issues with creating an angular chart using a custom xml file. I'm using x2js to convert my xml file to json in order to be used in the data for the chart. In my plnkr, I created an angular service, incorporating x2js to convert my xml file.
In the app.js
file, I called back the function in the service and parsed the data into the pieces required for the chart data. I'm not sure if I did this correctly, but one problem may lie with the parseInt()
function in the value
element. I included this parse function because I noticed there may be quotes around my data values, which can interfere with the data format required for the chart library. $scope.dataOne
and $scope.dataTwo
are my two sets of data that I want to use to create two different graphs.
Note: I used a krispo's template from plnkr, and expanded on it to include the things I need in my code. I also used this documentation if needed.
There seems to be an error somewhere in my code. I didn't parse all of the data, only enough to create two pairs of data to test the chart. Nothing is showing up.
Any help would be greatly appreciated, as I am new to programming, having only worked with python before.
Edit: It's alive(in the plnkr)! The xml must have been converted properly, because now the selection menu above the chart appears with the series from the xml data. However the chart doesn't appear. I've hit a road block because when I try opening the file in my browser to find where my error is, it gives me the following error:
XMLHttpRequest cannot load file:///C:/Users/Nicholas/Desktop/logixdata/new%20website/newchart/data.xml.
Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
and this:
Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///C:...the path...'.
at Error (native)
I'm getting closer to the solution, but I've narrowed it down to somewhere in the DataSource.get().success(function(data){
segment of code in the app.js
file.