s.bhadkaria Posted September 18, 2013 Report Share Posted September 18, 2013 I am trying a very simple example and trying to set JSON data to setDataSource. SetDataSource is throwing some javascript errors. Below is the code var chart1; function loadLineChart111() { chart1 = new cfx.Chart(); chart1.getData().setSeries(2); chart1.getAxisY().setMin(500); chart1.getAxisY().setMax(2000); var series1 = chart1.getSeries().getItem(0); var series2 = chart1.getSeries().getItem(1); series1.setGallery(cfx.Gallery.Lines); series2.setGallery(cfx.Gallery.Bar); var data = [ { "Month": "Jan", "Bikes": 1800, "Parts": 1300 }, { "Month": "Feb", "Bikes": 1760, "Parts": 900 }, { "Month": "Mar", "Bikes": 1740, "Parts": 970 }, { "Month": "Apr", "Bikes": 1750, "Parts": 1010 }, { "Month": "May", "Bikes": 1810, "Parts": 1070 }, { "Month": "Jun", "Bikes": 1920, "Parts": 1180 } ]; chart1.setDataSource(data); var divHolder = document.getElementById('ChartDiv'); chart1.create(divHolder); } please let me know if i am missing something Thanks Saurabh ChartFX_PrintPage.zip Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted September 18, 2013 Report Share Posted September 18, 2013 Your code works fine in our tests, can you describe the HTML page hosting this code (e.g. the scripts you are including), browsers used, and the errors you receive? JuanC WindowsApplication3.zip Quote Link to comment Share on other sites More sharing options...
0 s.bhadkaria Posted September 18, 2013 Author Report Share Posted September 18, 2013 Hi thanks for the reply. The html page (result.aspx) where the chart needs to be shown is actually loaded using ajax. (might be causing the issue). The jchartfx javascript library is actually on the parent.aspx page. Library includes Looks like the ajax is causing the issue. Thanks Saurabh Quote Link to comment Share on other sites More sharing options...
0 s.bhadkaria Posted September 18, 2013 Author Report Share Posted September 18, 2013 I m using AJAX to load the Chart container div inside a parent page (its a single page application - url doesnot change). Below is the error that I am getting in Chrome. Uncaught TypeError: Object function (){ var o = new Object(); for (var property in this) { if (typeof (this[property]) == 'object') { if (this[property] != null) o[property] = this[property].clone(); else o[property] = null; } else o[property] = this[property]; } return o; } has no method 'SB' Please help me to understand the issue. Note : It works in chrome or FF when I dont use Ajax to load the page. Thanks Saurabh Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted September 18, 2013 Report Share Posted September 18, 2013 You might have to show a small sample page so that we can try to help you. That function that is crashing does not seem to be part of our scripts. JuanC Quote Link to comment Share on other sites More sharing options...
Question
s.bhadkaria
I am trying a very simple example and trying to set JSON data to setDataSource.
SetDataSource is throwing some javascript errors.
Below is the code
var chart1;
function loadLineChart111() {
chart1 = new cfx.Chart();
chart1.getData().setSeries(2);
chart1.getAxisY().setMin(500);
chart1.getAxisY().setMax(2000);
var series1 = chart1.getSeries().getItem(0);
var series2 = chart1.getSeries().getItem(1);
series1.setGallery(cfx.Gallery.Lines);
series2.setGallery(cfx.Gallery.Bar);
var data = [
{ "Month": "Jan", "Bikes": 1800, "Parts": 1300 },
{ "Month": "Feb", "Bikes": 1760, "Parts": 900 },
{ "Month": "Mar", "Bikes": 1740, "Parts": 970 },
{ "Month": "Apr", "Bikes": 1750, "Parts": 1010 },
{ "Month": "May", "Bikes": 1810, "Parts": 1070 },
{ "Month": "Jun", "Bikes": 1920, "Parts": 1180 }
];
chart1.setDataSource(data);
var divHolder = document.getElementById('ChartDiv');
chart1.create(divHolder);
}
please let me know if i am missing something
Thanks
Saurabh
ChartFX_PrintPage.zip
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.