2014-02-09 43 views
0

我想有一天vs時間分配的情節。我有一些unix時間值。我只需要在X軸和Y軸上繪製它們,使得X軸上的星期幾(例如星期一,Tuseday等)和Y軸上的時間(例如(2:24,13:40等))。我曾嘗試使用日期時間類型。但我想我錯過了一些東西。天與散點圖上的時間

這是我試圖做:

 data=[["Saturday", 1390723133.57414], ["Sunday", 1390803027.3852], ["Monday", 1390862581.18321], ["Monday", 1390830748.67335], ["Wedneday", 1391015403.93726], ["Wedneday", 1391006992.20059], ["Sunday", 1390804961.8415]] 

     $('#container').highcharts({ 
      chart: { 
       type: 'scatter', 
       zoomType: 'xy' 
      }, 
      title: { 
       text: 'test' 
      }, 

      xAxis: { 
       title: { 
        enabled: true, 
        text: 'Day of the week' 
       }, 
       startOnTick: true, 
       endOnTick: true, 
       showLastLabel: true, 

      }, 
      yAxis: { 
       title: { 
        text: 'Time of the day' 
       }, 
       type: 'datetime', 

      }, 
      legend: { 
       layout: 'vertical', 
       align: 'left', 
       verticalAlign: 'top', 
       x: 100, 
       y: 70, 
       floating: true, 
       backgroundColor: '#FFFFFF', 
       borderWidth: 1 
      }, 
      plotOptions: { 
       scatter: { 
        marker: { 
         radius: 5, 
         states: { 
          hover: { 
           enabled: true, 
           lineColor: 'rgb(100,100,100)' 
          } 
         } 
        }, 
        states: { 
         hover: { 
          marker: { 
           enabled: false 
          } 
         } 
        } 
       } 
      }, 
      series: [{ 
       name: '', 
       color: 'rgba(223, 83, 83, .5)', 
       data: data 


      }] 
     }); 
    }); 
}); 
+0

這可能是有用的:http://stackoverflow.com/questions/21227847/how-to-pass-time-in-highcharts/21268457#21268457 – jlbriggs

回答

0

你需要分析你的數據,以正確的格式,因爲在數據數組,你需要有時間戳或數字,而不是天/字符串作爲你。