在我的dygraphs图表中,我有一个已推断的系列。我想对外推部分进行不同的着色,但还没有找到办法。
我怀疑某种方式不存在(因为我在文档中发现的颜色只是每个系列的颜色),但是如果有方法,如何在中途改变数据系列的颜色吗
答案 0 :(得分:0)
你是对的 - 没有办法改变Dygraphs中数据系列的一部分颜色。但是可以使用单独的系列来完成外推数据,如下所示:
[
[1, 0, null],
[2, 2, null],
[3, 4, null],
[4, 6, 6],
[5, null, 8],
[6, null, 10],
[7, null, 12],
[8, null, 14],
]
var g = new Dygraph(
document.getElementById("g"), [
[1, 0, null],
[2, 2, null],
[3, 4, null],
[4, 6, 6],
[5, null, 8],
[6, null, 10],
[7, null, 12],
[8, null, 14],
], {
colors: ['green', 'red'],
labels: ['x', 'normal', 'extrapolated'],
strokeWidth: 3,
title: 'different series for extrapolated data'
});

<script src="http://dygraphs.com/dygraph-dev.js"></script>
<div id="g"></div>
&#13;