【问题标题】:HighCharts-Removing the padding for a bar chartHighCharts-去除条形图的填充
【发布时间】:2013-01-26 11:54:07
【问题描述】:

我正在使用条形图(带有百分比堆叠)构建进度条,并希望删除容器中的空格/填充,并仅保留条形图容器中没有任何填充/边距空间。

有没有办法做到这一点?

Fiddle

代码:

$(function () {
    var chart;
    $(document).ready(function () {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'bar'
            },
            legend: {
                enabled: false,
            },
            title: {
                text: ''
            },
            xAxis: {

                lineWidth: 0,

                labels: {
                    enabled: false
                },
                minorTickLength: 0,
                tickLength: 0
            },
            yAxis: {
                min: 0,
                title: {
                    text: ''
                },
                lineWidth: 0,
                gridLineWidth:0,
                lineColor: 'transparent',
                labels: {
                    enabled: false
                },
                minorTickLength: 0,
                tickLength: 0
            },
            tooltip: {
                enabled: false
            },
            plotOptions: {
                bar: {
                    stacking: 'percent'

                },
                 series: {
            pointPadding: 0,
            groupPadding: 0,       
        }
            },

            series: [{
                name: 'max',
                data: [40],
                color: 'white'
            }, {
                name: 'current',
                data: [60],
                color: 'green'
            }]
        });
    });

});

【问题讨论】:

    标签: css highcharts


    【解决方案1】:

    您可以简单地删除边距:

    chart: {
        renderTo: 'container',
        ....
        margin: 0
    }
    

    见:http://jsfiddle.net/gRYGn/4/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-09
      • 1970-01-01
      • 1970-01-01
      • 2016-01-15
      • 2015-07-13
      • 1970-01-01
      相关资源
      最近更新 更多