2013-02-04 89 views
0

当我添加第二个serie时,我的highchart崩溃了铬。
无法看到Chrome的控制台调试.. :(
有没有人有一个想法?Highchart与多个Y轴碰撞

$(function() { 
    var chart; 
    $(document).ready(function() { 
     chart = new Highcharts.Chart({ 
      chart: { 
       renderTo: 'container', 
       type: 'line', 
       margin: [40,10,60,80], 
      }, 
      title: { 
       text: 'Temperature Today' 
      }, 
      xAxis: { 
       type: 'datetime',  
       dateTimeLabelFormats: { 
        day: '%H:%M' 
       }, 
       tickInterval: 3600 * 1000, 
       labels: { 
        rotation: -45, 
        align: 'right', 

        style: { 
         fontSize: '10px', 
         fontFamily: 'Verdana, sans-serif' 
        } 
       }, 
      }, 
      yAxis: { 
       title: { 
        text: 'Temperature' 
       }, 
       minorGridLineWidth: 0, 
       /* gridLineWidth: 0, */ 
       /* alternateGridColor: null */ 
      }, 
      tooltip: { 
       formatter: function() { 
         return ''+ 
         Highcharts.dateFormat('%H:%M', this.x) +': '+ this.y; 
       } 
      }, 
      plotOptions: { 
       spline: { 
        lineWidth: 4, 
        states: { 
         hover: { 
          lineWidth: 3 
         } 
        }, 
        marker: { 
         enabled: false, 
         states: { 
          hover: { 
           enabled: true, 
           symbol: 'circle', 
           radius: 3, 
           lineWidth: 1 
          } 
         } 
        }, 
       } 
      }, 
      series: [{ 
        name: 'Temperature', 
        data: temp, 
        type: 'line', 
        showInLegend: false, 
        pointInterval: 60 * 1000, 
        pointStart: Date.UTC(2006, 0, 1), 
         marker: { 
          enabled: false 
         }, 
        dashStyle: 'solid', 
        yAxis: 0, 
        xAxis: 0, 
        } , { 
        name: 'Humdity', 
        data: hum, 
        yAxis: 1, 
        xAxis: 0, 
        showInLegend: false, 
        type: 'line', 
      }], 
      navigation: { 
       menuItemStyle: { 
        fontSize: '6px' 
       } 
      } 
     }); 
    }); 

}); 
+0

它甚至崩溃上的jsfiddle – HyperDevil

回答

1

你只有一个yAxis,因此它打破了,因为你设置的第二个系列显示到第二个(是的,这就是yAxis: 1手段)

删除或创建第二yAxis

更新:。

  • 使用yAxis: 0将reffer第一个和1第二个。
  • 失踪,在jsfiddle的第36行}后。
  • 之前存储数据。

Demo

+0

我删除,它似乎仍然崩溃.. – HyperDevil

+0

@HyperDevil所以,对于一个更好的答案,你应该表现出'hum'。 –

+0

我在这里看不到任何活动另一个Y轴的东西吗?http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line -basic/ – HyperDevil