简体   繁体   English

HighCharts项目符号图表标签显示在顶部可能吗?

[英]HighCharts Bullet Chart label show on top Possible?

I want to show the label of this bullet chart in the top of the chart instead left side.Is it possible? 我想在图表的顶部而不是左侧显示此项目符号的标签,这可能吗? Here is the code, 这是代码,

Highcharts.chart('container2', {
    xAxis: {
        categories: ['<span class="hc-cat-title">Profit</span><br/>%']
    },
    yAxis: {
        plotBands: [{
            from: 0,
            to: 20,
            color: '#666'
        }, {
            from: 20,
            to: 25,
            color: '#999'
        }, {
            from: 25,
            to: 100,
            color: '#bbb'
        }],
        labels: {
            format: '{value}%'
        },
        title: null
    },
    series: [{
        data: [{
            y: 22,
            target: 27
        }]
    }],
    tooltip: {
        pointFormat: '<b>{point.y}</b> (with target at {point.target})'
    }
});

Here is the bullet chart. 这是项目符号图表。 I want to show my Label Profit to the top of the chart. 我想将我的标签利润显示在图表的顶部。

在此处输入图片说明 you can also see jsfiddle: Bullet chart 您还可以看到jsfiddle:项目符号图

You can use the dataLabels property with the right options: 您可以将dataLabels属性与正确的选项一起使用:

series: [{
    data: [{
        dataLabels: {
            enabled: true,
            format: '<span class="hc-cat-title">Profit</span>',
            align: 'left',
            y: 40,
            inside: true
        },
        y: 275,
        target: 250
    }]
}]

Live demo: http://jsfiddle.net/BlackLabel/rxkt43o7/ 现场演示: http : //jsfiddle.net/BlackLabel/rxkt43o7/

API Reference: https://api.highcharts.com/highcharts/series.column.data.dataLabels API参考: https//api.highcharts.com/highcharts/series.column.data.dataLabels

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM