2015-09-13 21:39:51 +00:00
|
|
|
/*
|
|
|
|
* legend.js v0.2.0
|
|
|
|
* License: MIT
|
|
|
|
*/
|
2013-09-03 03:35:51 +00:00
|
|
|
function legend(parent, data) {
|
|
|
|
parent.className = 'legend';
|
|
|
|
var datas = data.hasOwnProperty('datasets') ? data.datasets : data;
|
|
|
|
|
|
|
|
datas.forEach(function(d) {
|
|
|
|
var title = document.createElement('span');
|
|
|
|
title.className = 'title';
|
|
|
|
title.style.borderColor = d.hasOwnProperty('strokeColor') ? d.strokeColor : d.color;
|
|
|
|
title.style.borderStyle = 'solid';
|
|
|
|
parent.appendChild(title);
|
|
|
|
|
|
|
|
var text = document.createTextNode(d.title);
|
|
|
|
title.appendChild(text);
|
|
|
|
});
|
|
|
|
}
|