2015-08-26 46 views
1

我有這樣的功能:我怎樣才能把一條條碼放在一塊地圖上?

flotLinea:function(tareas){ 

var self = this; 


var options = { 

     legend: { 

       position:"nw", 

       }, 

     lines: 
       { 
        show: true, 
        fill: true 
       }, 
     points: 
       { 
        show: true 
       }, 
     xaxis: 
       { 
        mode: "time", 
        minTickSize: [0, "day"], 
        timeformat: "%d/%m/%y" 
       }, 
     yaxis: 
       { 
        min: 0, 
        tickSize:10, 
        tickDecimals: 0, 
       }, 

    }; 
    console.info(tareas); 
    $.plot("#grafico",tareas,options); 
}, 

功能打印:

enter image description here

怎樣纔可以有線條一起?或者更接近..

我需要的是這樣的:

enter image description here

我不想線之間這麼大的空間

回答

0

你沒有發佈功能,只有設置通過。

問題是兩個數據集在同一個圖表上使用,並且您的x軸數據有間隙。您需要將藍線陣列x軸數據保留一個月。

所以沒有看到你的代碼,讓我們假設你有以下的僞代碼爲你的藍線:

[[19-8-15, 40],[20-8-15, 50],[21-8-15, 50],etc...] 

第一個元素需要被左移:

[[18-8-15, 40],[19-8-15, 50],[20-8-15, 50],etc...] //<==== months now one less 

爲了實現這一目標,您需要使用時間戳,然後減去一個月內的秒數,並將其反覆應用到您的藍色系列。

發佈你創建數據的函數,我們將從那裏開始...

相關問題