2010-07-16 42 views
1

好上手,我使用jQuery的海軍報繪製一個輻射圖我已經找到了一個插件來創建一個蛛網圖看API這裏:Jquery - Flot,我怎樣才能只顯示點而不是線?

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

現在的作品都很好地扎其實我不想顯示連接點的線。 通常有:

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

但使用蜘蛛插件時,似乎忽略此設置。我在這裏做錯了什麼,或者是使用這個插件的情況下,我必須顯示線?


工作示例在:

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


代碼:

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到任何數字似乎都沒有影響。


我該如何顯示點而不是線?

+0

張望了一下打與腳本...如果你忽略了蜘蛛選項它的作品...有趣... – 2010-07-16 06:25:26

+0

哪些蜘蛛選項,因爲在沒有插件的情況下將它作爲一個普通的flot? – Sphvn 2010-07-16 06:27:52

+0

我的意思是整個'spider:'-section ... – 2010-07-16 06:29:40

回答

2

添加connection: { width: 0 }蜘蛛選項:

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. 

} 
+0

我試圖在下面的spiderSize添加,沒有工作:S的確如你所做的那樣,謝謝你,先生。 – Sphvn 2010-07-16 06:34:36

相關問題