How can I get the title of an image to use it as Data in HighCharts
How can I get the title of an image to use it as Data in HighCharts
Hi,
I'm trying to get the Datas in my Datatable to use it my in HighCharts but I have images in some columns, I want to get the title of the images to use it as Datas name in my HighCharts chart.
I tried this :
table
.column(2, { search: 'applied' })
.data()
.each(function (val) {
if (counts[val]) {
counts[val] += 1;
} else {
counts[val] = 1;
}
});
// And map it to the format highcharts uses
return $.map(counts, function (val, key) {
var key = $('img').attr('title');
return {
name: key,
y: val,
};
});
My chart is displayed but not the title of my images.
This question has an accepted answers - jump to answer
Answers
Its hard to say with actually seeing what you have. What does the variable
counts
contain? Can you post a snippet of the data?If its the
img
tag maybe you need something like this:If you still need help please post a link to your page or a test case showing an example of your data.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Thank you @kthorngren