Add dataLabel to Area chart in Highcharts.js

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

Answers:

Answer

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.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.