在单个流程图上显示点数据集和线数据集?
当一个系列是一组点,一个系列是一条线时,如何在同一个图表中显示两个数据系列?
我见过这样的线系列示例,但是复杂的因素是我想在同一个图表上显示数据点和数据线。
这似乎是一个非常常见的用例 - 基本上我想显示散点图及其最佳拟合线。
目前我有
var options = {
series: {
lines: {
show: false
},
points: {
show: true
},
lines: {
show: true
}
},
grid: {
hoverable: true,
},
yaxis: {
min: 0,
max: 1100000,
font: 'Georgia'
},
xaxis: {
min: 10,
max: 480,
font: 'Georgia'
}
};
var plot = $.plot($("#placeholder"),
[{
data: scatterdata,
color: 'dodgerblue',
}], options);
var line = $.plot($("#placeholder"),
[{
data: linedata,
color: 'black',
}], options );
但这只显示第二组数据,而不是两者。
How can I display two data series in the same flot graph, when one series is a set of points, and one is a line?
I've seen examples of line series like this, but the complicating factor is that I'd like to display data points and a data line on the same graph.
This seems like quite a common use case - basically I want to display a scatter graph along with its line of best fit.
Currently I have
var options = {
series: {
lines: {
show: false
},
points: {
show: true
},
lines: {
show: true
}
},
grid: {
hoverable: true,
},
yaxis: {
min: 0,
max: 1100000,
font: 'Georgia'
},
xaxis: {
min: 10,
max: 480,
font: 'Georgia'
}
};
var plot = $.plot($("#placeholder"),
[{
data: scatterdata,
color: 'dodgerblue',
}], options);
var line = $.plot($("#placeholder"),
[{
data: linedata,
color: 'black',
}], options );
But this only displays the second set of data, not both of them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想做这样的事情(一次指定一个数据集,并带有选项):
生成:
You want to do something like this (specify the data sets one at a time, with options):
Produces: