我有多个具有空值的数据集,但空值在图中是折线。因此,我使用Chart.types.Line.extend
重画了折线。一切正常,但我无法显示图例和自定义工具提示以及其他选项。
下面是我的示例代码:
var data = {
labels: ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"],
datasets: [
{ data: [12, 3, 2, 1, 8, 8, 2, 2, 3, 5, 7, 1] },
{ data: [12, 13, 2, 61, 18, 8, 2, null, null, 15, 17, 11] }
]
};
var ctx = document.getElementById("LineWithLine").getContext("2d");
Chart.types.Line.extend({
name: "LineWithLine",
draw: function () {
Chart.types.Line.prototype.draw.apply(this, arguments);
}
});
new Chart(ctx).LineWithLine(data, {
datasetFill : false,
});