2014-01-12 62 views
0

如何使我的圖表從2010年開始或更具體地從日期開始02-02-2010, 我製作此圖表但我不知道如何繼續http://jsfiddle.net/P87XF/2/如何製作高度圖堆疊條形圖從特定日期開始

$(function() { 
    $('#container').highcharts({ 
     chart: { 
      type: 'bar' 
     }, 
     title: { 
      text: 'Stacked bar chart' 
     }, 
     xAxis: { 
      categories: ['John'] 
     }, 
     yAxis: { 
      type: 'datetime', 
      dateTimeLabelFormats: { 
       day: '%d-%m-%Y' 
      }, 

      title: { 
       text: 'Total fruit consumption' 
      } 
     }, 
     legend: { 
      backgroundColor: '#FFFFFF', 
      reversed: true 
     }, 
     plotOptions: { 
      bar:{ 
       stacking: 'normal', 
       pointInterval: 24 * 3600 * 1000 
      } 
     }, 
      series: [{ 
      name: 'Manager', 
      data: [Date.UTC(2014, 20, 01)] 
     }, { 
      name: 'Developer', 
      data: [Date.UTC(2012, 20, 01)] 
     }, { 
      name: 'Tester', 
      data: [Date.UTC(2010, 20, 01)] 
     }] 
    }); 
}); 

回答

1

對於我來說,理解堆疊日期的目的有點困難嗎?我覺得很奇怪,所以我已禁用堆疊和使用列範圍類型,這裏是現場效果:http://jsfiddle.net/P87XF/3/

$(function() { 
    $('#container').highcharts({ 
     chart: { 
      inverted: true, 
      type: 'columnrange' 
     }, 
     title: { 
      text: 'Stacked bar chart' 
     }, 
     xAxis: { 
      categories: ['John'] 
     }, 
     yAxis: { 
      min: Date.UTC(2010, 1, 2), 
      type: 'datetime', 
      dateTimeLabelFormats: { 
       day: '%d-%m-%Y' 
      }, 

      title: { 
       text: 'Total fruit consumption' 
      } 
     }, 
     legend: { 
      backgroundColor: '#FFFFFF', 
      reversed: true 
     }, 
     plotOptions: { 
      bar:{ 
       //stacking: 'normal', 
       //pointInterval: 24 * 3600 * 1000 
      } 
     }, 
      series: [{ 
      name: 'Manager', 
      data: [[Date.UTC(2010, 1, 2), Date.UTC(2014, 20, 01)]] 
     }, { 
      name: 'Developer', 
      data: [[Date.UTC(2010, 1, 2), Date.UTC(2012, 20, 01)]] 
     }, { 
      name: 'Tester', 
      data: [[Date.UTC(2010, 1, 2), Date.UTC(2010, 20, 01)]] 
     }] 
    }); 
}); 
+0

謝謝你,這就是我想要的 –

相關問題