开发者

Jquery - Flot, How can I only show points and not lines?

Okay to get started I am using Jquery-Flot to plot a radial graph I have found a plug in to create a spider graph see API here:

http://www.jumware.com/Includes/jquery/Flot/Doc/JQuery.Flot.spider.html

Now it works all nicely bar the fact I dont want to show 开发者_Python百科the lines that connect the points. Usually with:

points: { show: true}, lines: { show: false}

but when using the spider plugin it seems to ignore this setting. Am I doing something wrong here or is it a case of when using this plugin I have to show lines?


Working example at:

http://jsfiddle.net/WAscC/2/


Code:

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();

Update One

editing lineWidth: 0, connectionWidth: 0 to any number seems to have no affect at all on the graph.


How can I only show points and not lines?


Add connection: { width: 0 } to spider options:

spider: {
   active: true,
   connection: { width: 0 }, // add this line
   legs: {
       data: ["", "", "", "", ""],
       legScaleMax: 1,
       legScaleMin: 0.8
   },
   spiderSize: 0.9
}

Documentation states that option should be: connectionWidth: 0, but that seems to have changed, as seen from the 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.

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜