我试图为每个系列设置图表选项,但我没有运气。在这个例子中,我希望看到系列“不保留”#39;和'主持人'作为点,系列'不保持趋势'和主机趋势'作为线条。实际结果仅为分数。我做错了什么?
drawPoints: "true",
colors: [ "orange", "blue", "black", "violet" ],
strokeWidth: 0,
series: {
'Hosts trend': {
strokeWitdh: 1,
pointSize: 0
},
'Not kept trend': {
strokeWitdh: 1,
pointSize: 0
}
}
答案 0 :(得分:0)
你有三个问题导致你的问题:
connectSeparatedPoints: true
参数。"Date,Not kept,Hosts,Not kept trend,Hosts trend\n"+
所以你的完整代码应该是这样的:
g = new Dygraph(
// containing div
document.getElementById("dr1"),
"Date,Not kept,Hosts,Not kept trend,Hosts trend\n"+
"2014-03-31, , , 73, 6\n"+
"2014-04-01, 50, 10, , \n"+
"2014-04-02, 63, 11, , \n"+
"2014-04-03, 120, 12, , \n"+
"2014-04-04, 55, 20, , \n"+
"2014-04-05, 60, 22, , \n"+
"2014-04-06, 63, 25, , \n"+
"2014-04-07, 52, 24, , \n"+
"2014-04-14, , , 46, 46\n",
// options
{
xRangePad: 10,
yRangePad: 10,
title: "Promises not kept",
// legend options
legend: "always",
labelsDiv: "dr1_labels",
labelsSeparateLines: "true",
connectSeparatedPoints: true,
drawPoints: "true",
colors: [ "orange", "blue", "black", "violet" ],
strokeWidth: 0,
series: {
'Hosts trend': {
strokeWidth: 1,
pointSize: 0
},
'Not kept trend': {
strokeWidth: 1,
pointSize: 0
}
}
}
);
以下是您更新的 FIDDLE