javascript - Highcharts : How to align pie chart positions to right or left corner of the container

标签 javascript svg highcharts

如何将 highcharts 中的饼图与容器中的右端或左端对齐?我注意到 center:[] 属性使用百分比工作,但在调整容器大小时遇到​​一些位置问题。请检查下面的 fiddle 链接。

fiddle

Highcharts.chart('container', {
chart: {
    plotBackgroundColor: null,
    plotBorderWidth: null,
    plotShadow: false,
    type: 'pie'
},
title: {
    text: 'Browser market shares in January, 2018'
},
tooltip: {
    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
    pie: {
        allowPointSelect: true,
        cursor: 'pointer',
        dataLabels: {
            enabled: false
        },
        showInLegend: true
    }
},
series: [..]

});

最佳答案

您可以为图表使用样式 属性。请看附件示例:

chart: {
    plotBackgroundColor: null,
    width: 200,
    height: 300,
    type: 'pie',
    style: {
        'float': 'right'
    }
},

现场演示:https://jsfiddle.net/BlackLabel/2at3g47f/

API 引用:https://api.highcharts.com/highcharts/chart.style

关于javascript - Highcharts : How to align pie chart positions to right or left corner of the container,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51943462/

相关文章:

events - Highcharts - 触发 legendItemClick 事件

javascript - 当图表具有不同宽度时,同步 HighCharts 不起作用

javascript - jQuery SVG 嵌套组

javascript - 验证输入仅包含数字和点后的小数

javascript - 使用自动分页器时 jQuery 动画的问题

javascript - 为以后的 Javascript 保存参数

javascript - HTML 中的 SVG 文件

svg - 如何在 svg 中右对齐多个左对齐的 <tspan>?

javascript - 自动刷新javascript而不加载整个页面

javascript - Uncaught ReferenceError : $ is not defined?