好的开始我正在使用 Jquery-Flot 绘制径向图我找到了一个插件来创建蜘蛛图请参阅此处的 API:
http://www.jumware.com/Includes/jquery/Flot/Doc/JQuery.Flot.spider.html
现在一切正常,除非我不想显示连接点的线。 通常与:
points: { show: true}, lines: { show: false}
但是当使用 spider 插件时,它似乎忽略了这个设置。我在这里做错了什么,还是在使用这个插件时我必须显示线条?
工作示例:
代码:
function EveryOneSec() {
var d1 = [[0, 10], [1, 20], [2, 80], [3, 70], [4, 60]];
var d2 = [[0, 30], [1, 25], [2, 50], [3, 60], [4, 95]];
var d3 = [[0, 50], [1, 40], [2, 60], [3, 95], [4, 30]];
var options = {
series: {
spider: {
active: true,
legs: {
data: ["", "", "", "", ""],
legScaleMax: 1,
legScaleMin: 0.8
}, spiderSize: 0.9
}
}, grid: {
hoverable: false,
clickable: false,
tickColor: "rgba(0,0,0,0.2)",
mode: "radar"
}
};
data = [{
label: "",
data: d1,
spider: {
show: true,
lineWidth: 0
}
}, {
label: "",
data: d2,
spider: {
show: true,
lineWidth: 0
}
}, {
label: "",
data: d3,
spider: {
show: true,
lineWidth: 0
},
points: { show: true},lines: { show: false }
}];
$.plot($("#RadialPlot"), data, options);
}
EveryOneSec();
更新一
编辑 lineWidth: 0,
connectionWidth: 0
到任何数字似乎都对图表没有任何影响。
如何只显示点而不显示线?
最佳答案
添加 connection: { width: 0 }
到 spider options:
spider: {
active: true,
connection: { width: 0 }, // add this line
legs: {
data: ["", "", "", "", ""],
legScaleMax: 1,
legScaleMin: 0.8
},
spiderSize: 0.9
}
Documentation声明该选项应为:connectionWidth: 0
,但从 source for the actual plugin 中可以看出,这似乎已发生变化:
function drawspiderConnections(ctx,cnt,serie,c,fill) {
var pos,d;
ctx.beginPath();
ctx.lineWidth = serie.spider.connection.width; // this is the line
// etc.
}
关于javascript - Jquery - Flot,如何只显示点而不显示线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3262371/