Highcharts add ellipsis for long data

杀马特。学长 韩版系。学妹 提交于 2019-12-12 03:38:56

问题


In the below link , left and right side data is not showing properly, I want to adjust pie chart in center and add ellipsis for visible data.

jsfiddle url :

http://jsfiddle.net/f0bqnba3

Image :

Code:

$(function () {
    Highcharts.chart('container', {
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
            type: 'pie'
        },
        title: {
            text: 'Browser market shares January, 2015 to May, 2015'
        },
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                    style: {
                        color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                    }
                }
            }
        },
        series: [{
            name: 'Brands',
            colorByPoint: true,
            data: [{
                name: 'National Institute of Information Technology and science laboratory',
                y: 56.33
            }, {
                name: 'Chrome',
                y: 24.03,
                sliced: true,
                selected: true
            }, {
                name: 'Firefox',
                y: 10.38
            }, {
                name: 'Safari',
                y: 4.77
            }, {
                name: 'Opera',
                y: 0.91
            }, {
                name: 'National Institute of Proprietary or Undetectable',
                y: 0.2
            }]
        }]
    });
});

回答1:


set width for lables in plot options

plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
                style: {
                    width: '100px'
                },
                enabled: true,
                color: '#000000',
                maxStaggerLines:1,                    
                connectorColor: '#000000',
                format: '<b>{point.name}</b>: {point.percentage:.1f} %'                   

            },
        }
    },

Your Fork fiddle



来源:https://stackoverflow.com/questions/41889231/highcharts-add-ellipsis-for-long-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!