Kefir
Kefir

Reputation: 1

Highcharts Add text to label

Here is my chart : www.jsfiddle.net/bs9cLff5

I want to add the percent directly on the chart. Example for team1 : I want to show 100% on the green.

Next, I would like to personalize the text in the label.

Team1 Good 100%

Become

Team1 'My text'

Is it possible?

Someone can help me please Thank you everybody :D

Upvotes: 0

Views: 361

Answers (2)

harsha217
harsha217

Reputation: 72

I can add to the previous answer, you can even define on click events for the label. It's very simple.

              ren.label('message', 10, 10)
                    .attr({
                      fill: 'red',
                      stroke: 'white',
                      'stroke-width': 2,
                      padding: 5,
                      cursor: 'pointer',
                      r: 5
                    })
                    .css({
                      color: 'white',
                      width: '100px'
                    })
                    // action on click
                    .on('click', function () {
                    });

Upvotes: 0

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

You can use renderer to add custom elements (like text) in the chart.

chart.renderer.text('any text', 140, 140)
        .css({
            color: '#4572A7',
            fontSize: '16px'
        })
        .add();

Upvotes: 1

Related Questions