Add dataLabel to Area chart in Highcharts.js

2019-02-26 06:01发布

I want to add a data label to specific point in the 'Area' chart. I'm using 'Highchart' for making graph. I want a data label in chart design as following image. What should I try ? I tried dataLabel defined in 'line' chart but it applies dataLabel to each point in the chart. I want it to be applied for specific point. Also, it should not show value of that point as a dataLabel but it should show series.name on that point. enter image description here

1条回答
▲ chillily
2楼-- · 2019-02-26 06:31

For the relevant point in your data use the object notation and enabled data labels. You can use format and formatter to display the desired information.

Example of your series would be:

series: [{
    name: 'My series name',
    data: [5, 10, 30, 100, 200, 300, 600,
        { 
            y: 900, 
            dataLabels: {
               enabled: true,
               format: '{series.name}'
            }
        },
        700, 400, 100]
}]

Or see this more elaborate JSFiddle example.

查看更多
登录 后发表回答