2015-02-24 26 views
0

我正在使用Highchart繪製我的數據圖表。我已經看到date range選擇器在這個圖表中,但我使用的是Area Graph,但範圍選擇器不在此。以下是我的代碼。範圍選擇器是高圖的圖表

jQuery('#weenat_statr_chart').highcharts({ 

       title: { 
        text: chart_title 
       }, 

       xAxis: { 
        type: 'datetime' 
       }, 

       yAxis: { 
        title: { 
         text: null 
        } 
       }, 

       tooltip: { 
        crosshairs: true, 
        shared: true, 
        valueSuffix: unit_value 
       }, 

       legend: { 
       }, 
, 
       rangeSelector: { 
        buttonTheme: { // styles for the buttons 
         fill: 'none', 
         stroke: 'none', 
         'stroke-width': 0, 
         r: 8, 
         style: { 
          color: '#039', 
          fontWeight: 'bold' 
         }, 
         states: { 
          hover: { 
          }, 
          select: { 
           fill: '#039', 
           style: { 
            color: 'white' 
           } 
          } 
         } 
        }, 
        labelStyle: { 
         color: 'silver', 
         fontWeight: 'bold' 
        }, 
        selected: 1 
       },    
       series: [{ 
        name: unit_name, 
        data: averages, 
        zIndex: 1, 
        marker: { 
         fillColor: 'white', 
         lineWidth: 2, 
         lineColor: Highcharts.getOptions().colors[0] 
        } 
       }, { 
        name: '<?php echo __("Range","test-plugin"); ?>', 
        data: ranges, 
        type: 'arearange', 
        lineWidth: 0, 
        linkedTo: ':previous', 
        color: Highcharts.getOptions().colors[0], 
        fillOpacity: 0.3, 
        zIndex: 0 
       }] 
      }); 

js fiddle url

請幫助我如何使用日期範圍與區域圖。 謝謝。

+0

你可以提供一個現場演示樣http://jsfiddle.net – 2015-02-24 10:05:33

+0

@RaeenHashemi這裏是jsfidle http://jsfiddle.net/73sox4ws/ http://jsfiddle.net/gh/get/jquer y/1.9.1/highslide-software/highcharts.com/tree/master/samples/stock/demo/basic-line/ – 2015-02-24 10:08:42

回答

1

這是因爲rangeSelectorHighStock,而不是highcharts。所以,你需要你的腳本改爲:

<script src="http://code.highcharts.com/stock/highstock.js"></script> 

並添加StockChart字功能創建圖表:

$('#container').highcharts('StockChart', { ... }); 

下面是更新fiddle

+0

不,這完全不是答案。正如我在我的問題中已經告訴過的那樣,它是用於股票圖表的,但我正在使用面積圖,請注意。 – 2015-02-24 10:19:29

+0

那又如何?除了它有一個你可以禁用的導航器,它是一樣的。 yAxis與你可以改正的是相反的。標記不顯示沒有懸停,也可以修復 - http://jsfiddle.net/73sox4ws/3/現在什麼?都好? – 2015-02-24 10:31:08

+0

是的...非常感謝你的工作。只有一點你能告訴我哪些參數是需要在圖表上顯示氣泡的。我無法在圖表上看到氣泡。謝謝 – 2015-02-24 10:45:06