Reputation: 14442
I am using the data.js plugin for highcharts. Using their basic demo I have created my own test version using our .NET generated table. The documentation on this is very sparse (essentially it is what is in data.src.js). I am getting errors that it is sending in data values as strings (HC error #14). I am not entirely sure how to modify the code to make it work with my simple table.
Here is my js code:
$(function () {
$('#container').highcharts({
data: {
table: document.getElementById('ctl00_Main_content_ucDashboard_ctl00_ctl11_ctl02_lstData_tblData')
},
chart: {
type: 'column'
}
});
});
Additional info:
It appears that the issue is that my table cells contain span
tags encapsulating the values. I have no control over those tags and are there for presentation.
Upvotes: 0
Views: 111
Reputation: 6837
The <span>
tags within the table are the problem. Try this:
$(function () {
$('#container').highcharts({
data: {
table: $('#ctl00_Main_content_ucDashboard_ctl00_ctl11_ctl02_lstData_tblData').clone(true).find('span').replaceWith(function() { return this.innerHTML; }).end()[0]
},
chart: {
type: 'column'
},
title: {
text: ''
}
});
});
(you could also simply remove the span tags from where ever they are coming from)
Upvotes: 1