2011-08-25 119 views
2

我使用Highcharts创建图表:Highcharts缩放图形问题

http://dev.speechlink.co.uk/David/sixthiteration/home.php

然而,当缩放,似乎砍图表关闭右侧的一部分......我不完全确定为什么..?

这里是我的代码:

的jQuery:

chart = new Highcharts.Chart({ 
     chart: { 
     renderTo: 'summarycontainer', 
     }, 
     credits: { 
     enabled: false 
     }, 
     exporting: { 
     enabled: false 
     }, 
     title: { 
     text: 'No. Entries Submitted This Month', 
     style: { 
      fontSize: 10 
     } 
     },  
     xAxis: {   
     lineWidth: 1, 
     lineColor: '#999999', 
     title: { 
      text: 'x-axis' 
     } 
     }, 
     yAxis: { 
     title: { 
      text: 'y-axis' 
     }, 
    labels: { 
     y: 2 
    }, 
    lineWidth: 1, 
     lineColor: '#999999', 
     gridLineWidth: 1, 
     gridLineColor: '#eaeaea', 
     startOnTick: false, 
     showFirstLabel: false 
     }, 
     tooltip: { 
     shared: true    
     }, 
     legend: { 
     enabled: false 
     }, 
     plotOptions: { 
     }, 
     series: [{ 
     type: 'scatter', 
     name: '', 
     data: [10, 20, 10, 20, 2, 3, 1, 9], 
     lineColor: '#f6a828', 
     color: '#418ed6' 
     }], 
    }); 
}); 

而在我的HTML,我有一个div容器:

<div id = "summarycontainer" style="width: 250px; height: 250px"></div> 

回答

1

在你上面的代码有:

data: [10, 20, 10, 20, 2, 3, 1, 9], 

并且在页面源中是:

data: [10, 20, 10, 20, 2, 3, 1], 

也许你认为剧情会在最后一个点上打出点?

编辑: 地址:categories: ['', '']xAxis

xAxis: {   
     categories: ['', ''], 
     lineWidth: 1, 
     lineColor: '#999999', 
     title: { 
      text: 'x-axis' 
     } 
     }, 

在我看来存在highcharts的错误。

编辑2:

进行格式化工具提示使用(下面是唯一的例子!):

tooltip: { 
     formatter: function() { 
        return '<b>'+ this.series.name +'</b><br/>'+ 
       this.x +': '+ this.y +'°C'; 
     } 
     }, 
+0

嗨感谢你答复。所以我添加了你的建议,它确实阻止了最后一个关闭点的图形,但它为前两个点留下了我的工具提示?关于页面源代码,我搞乱了代码 - 这不是错误。 – user906568

+0

编辑答案:) –