【问题标题】:Highcharts polar label textoverflowHighcharts极地标签textoverflow
【发布时间】:2019-10-02 17:21:03
【问题描述】:

尝试在 highcharts 7.2.0 中配置极坐标图时,我无法将图表配置为始终在 xAxis 上显示标签。当图表不是极坐标图时,xAxis.labels.styles.textOverflow = 'none' 的配置属性可以正常工作。下面的 jsfiddle 显示如果 xAxis 上的标签与另一个标签发生碰撞,它们将自动被删除。我正在寻找配置极坐标图来做与折线图相同的事情。当 chart.polar: true 被移除时,您可以看到带有相互重叠标签的折线图。 https://jsfiddle.net/y6xor7ac/3/

Highcharts.chart('container', {

    chart: {
    // comment this line to show line graph working correctly
        polar: true
    },

    title: {
        text: 'Highcharts Polar Chart'
    },

    subtitle: {
        text: 'Also known as Radar Chart'
    },

    pane: {
        startAngle: 0,
        endAngle: 360
    },

    xAxis: {
        tickInterval: 45,
        min: 0,
        max: 360,
        overflow: 'allow',

        labels: {
            style: {
            textOverflow: 'none'
            },
          format: '{value}° super long text to make it overlap super long text to make it overlap super long text to make it overlap  '
        }
    },

    yAxis: {
        min: 0,
        overflow: 'allow',
        stackLabels: {
        allowOverlap: true
        }
    },

    plotOptions: {
        series: {
            pointStart: 0,
            pointInterval: 45
        },
        column: {
            pointPadding: 0,
            groupPadding: 0
        }
    },

    series: [{
        type: 'column',
        name: 'Column',
        data: [8, 7, 6, 5, 4, 3, 2, 1],
        pointPlacement: 'between'
    }, {
        type: 'line',
        name: 'Line',
        data: [1, 2, 3, 4, 5, 6, 7, 8]
    }, {
        type: 'area',
        name: 'Area',
        data: [1, 8, 2, 7, 3, 6, 4, 5]
    }]
});

【问题讨论】:

    标签: highcharts


    【解决方案1】:

    您可以使用内部allowOverlap 属性:

    xAxis: {
        ...
    
        labels: {
            allowOverlap: true,
            ...
        }
    },
    

    现场演示: https://jsfiddle.net/BlackLabel/1rkz9sfp/

    API 参考: https://api.highcharts.com/highcharts/xAxis.labels

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-21
      • 1970-01-01
      • 2022-10-07
      • 1970-01-01
      • 2013-10-03
      • 2013-06-18
      • 1970-01-01
      • 2016-01-29
      相关资源
      最近更新 更多