高图:phantomjs导出图像丢失的标签 [英] Highcharts: phantomjs export image missing labels

查看:71
本文介绍了高图:phantomjs导出图像丢失的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图表是一个堆叠的条形图,要求在实际的条形上带有数据标签.

My chart is a stacked bar chart with requirements to have data labels on the actual bars.

in浏览器版本可以正常工作,因此具有相应的数据标签,但是导出的图像没有这些标签.

The in browser version is working perfectly featuring the data labels accordingly, however the exported image does not have them.

这是我的代码:

{
  colors: ['#0EAC55','#91C855','#F3BA0E','#F39595','#F30E0E'],
       chart: {
                type: 'bar',
                height: 195
            },
            credits: {
            enabled: false
            },
            title: {
                text: ''
            },
            xAxis: {
                categories: ['Category 1', 'Category 2', 'Category 3'],
            },
             tooltip: {
                valueSuffix: '%'
            },
            yAxis: {
                min: 0,
                title: {
                    text: ''
                },
                max: 100,
                opposite: true,
            },
            legend: {
                backgroundColor: '#FFFFFF'
            },

            plotOptions: {
                series: {
                    stacking: 'percent',
                    groupPadding: 0,
                    dataLabels: {
                    enabled: true,
                    color: '#000000'

                    }
                }
            },
                series: [{"name":"5","legendIndex":5,"data":[41.1,44.2,60.2]},{"name":"4","legendIndex":4,"data":[42.9,38.4,25.2]},{"name":"3","legendIndex":3,"data":[12.2,12,8.8]},{"name":"2","legendIndex":2,"data":[3.3,5,3]},{"name":"1","legendIndex":1,"data":[1,1,3.3]}]
    }

我正在使用phantomjs服务器生成图像,因为这些图像需要在服务器端生成. http://www.highcharts.com/component/content/article/2-articles/news/56-improved-image-export-with-phantomjs/

I am using the phantomjs server to produce images as these need to be generated on the server side. http://www.highcharts.com/component/content/article/2-articles/news/56-improved-image-export-with-phantomjs/

推荐答案

我遇到了同样的问题.我尝试了上面的所有选项.将所有animation选项设置为false,将所有defer选项设置为false,但这并不能帮助我解决问题.

I had the same problem. I tried all options above. Set all animation options to false, all defer options to false, but it didn't help me to solve the problem.

最后,我在 github.com 上发现了一个问题.这是 HighCharts 的错误.我使用的是Highcharts4.0.1版本.

Finally I found an issue on github.com. And it was a bug of HighCharts. I was using 4.0.1 version of Highcharts.

因此,解决方案是,如果上述建议不起作用,则将highcharts文件更新为最新版本.

So, the solution is just to update your highcharts file to the lastest version if the suggestions above didn't work.

我的示例代码可以在 jsfiddle 上找到.

My sample code can be found on jsfiddle.

这篇关于高图:phantomjs导出图像丢失的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆