2015-10-16 154 views
1

在我的代码中,我在图表导航过程中加载了很多文件,但是我想包括诸如zoomType和hover以及mousever在一些特定文件中的feathure。例如,我通过读取sample.json文件来更改图表的zoomType ='x'。如何在Highchart中更改zoomType状态?

$(function() { 
     var chart; 
     var options = { 
       chart : { 
         type : 'polygon', 
         renderTo : 'container', 
         zoomType:'' 
       }, 
       title : { 

         text : '' 
       }, 
       credits: { 
      enabled: false 
     }, 



      $.getJSON('sample.json', function(data) { 
       options.series=data; 
       options.chart.zoomType='x'; /*including zoom feature only for sample.json file*/ 
       var chart = new Highcharts.Chart(options); 
      }); 

但是这段代码不起作用。我该如何解决这个错误?

+2

祈祷告诉你的是你的错误。或者我们可以通过在心里调试你的代码来推断它! –

+2

你是什么意思改变zoomtype? –

+1

我编辑了我的问题。 – logicstar

回答

2

See the working demo

我设置为默认系列“X”和zoomtype“Y”的下一个JSON数据(当你点击加号图标),看你以前的代码和演示在plunker链接

$("#container").html("<div style='style:margin:0 auto'>Loading Data</div>") ; 
    $.getJSON('data10.json', function(data) { 
    options.series=data; 
    options.chart.zoomType='x'; 
    chart = new Highcharts.Chart(options); 


});