[英]Draw a Line Chart with both solid and dotted line in it with angular nvd3js directive?
[英]Can we draw a Line Chart with both solid and dotted line in it?
在實時分析中,您可能希望明確說明,當天還沒有結束,當天的數據不完整。
因此,您可能希望繪制以虛線筆划連接最后一個和倒數第二個點的線。
這就是Mixpanel的工作方式。
可以使用Chart JS v2 pre-alpha來完成嗎?
是的,但你必須解決幾個問題
var lineChartData = {
labels: ['A', 'B', 'C', 'D', 'E', 'F', 'G'],
datasets: [{
label: "My First dataset",
data: [1, 8, 3, 4, 2, 3, 4],
borderColor: '#66f',
borderDash: [20, 30]
},{
label: "My First dataset",
data: [1, 8, 3, 4, 2, , ],
borderColor: '#66f',
}]
};
var ctx = document.getElementById("chart").getContext("2d");
var myChart = new Chart(ctx, {
type: "line",
data: lineChartData,
options: {
elements: {
line: {
fill: false
}
}
}
});
請注意,第一個數據集沒有將值設置為空白,第二個數據集有一個超出要求的額外值 - 這些有效地解決了幾個問題(包括https://github.com/nnnick/Chart.js/issues / 1284 )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.