2013-07-08 100 views
1

我使用Highcharts 3饼图,当我导出为图像时,生成的图表正在丢失一些数据标签。我该如何解决(解决方法)?饼图:图像导出切断标签

PS:使用highcharts服务器:export.hightcarts.com

问候

[更新]

小值上产生的图像png文件切断。但在打印预览中可以。

new Highcharts.Chart({ 
    chart: { 
     renderTo: 'chart', 
     type: 'pie' 
    }, 
    title: { 
     text: 'My Chart title' 
    }, 
    plotOptions: { 
     pie: { 
      showInLegend: true, 
      dataLabels: { 
       enabled: true, 
       formatter: function() { 
        return '<b>' + this.point.name + '</b>: ' + Math.round(this.point.total * this.point.percentage/100); 
       } 
      } 
     } 
    }, 
    series: [{ 
     type: 'pie', 
     name: 'Series name', 
     data: [ 
      ["Lorem", 88], 
      ["Lorem ipsum", 4], 
      ["Praesent nibh nulla", 12], 
      ["Lorem ipsum dolor sit amet", 66], 
      ["Praesent fringilla suscipit molestie", 30], 
      ["Donec at lectus at nulla viverra lobortis", 11], 
      ["Class aptent taciti sociosqu ad litora", 87], 
      ["Mauris vulputate sem id arcu volutpat fermentum", 149], 
      ["Vestibulum faucibus lectus", 113], 
      ["Pellentesque habitant morbi tristique", 7], 
      ["Etiam lacinia mi suscipit", 92], 
      ["Proin semper risus in lacus semper", 9], 
      ["Fusce id faucibus massa", 99], 
      ["Suspendisse", 4], 
      ["Quisque quis lectus et turpis laoreet", 101] 
     ] 
    }], 
    exporting: { 
     enabled: true 
    } 
}); 

的jsfiddlehttp://jsfiddle.net/6afyH/1/

+0

重现问题上的jsfiddle,请。 –

+0

http://jsfiddle.net/6afyH/1/ – rogeriolino

回答

6

这是因为Highcharts没有检测到容器的width

您可以修复,通过在exporting选项添加选项sourceWidth

exporting: { 
    enabled: true, 
    sourceWidth: 900 
} 

似乎sourceWidth采取初步width所以如果图表是在页面加载截断一点点,这将是除非您在选项中指定它,否则在导出时也是如此。

我更新的jsfiddle给你这个工作的一个例子:http://jsfiddle.net/6afyH/2/