score:0

Turns out highcharts lets you add a class to the label.

var label = this.renderer.label(
     footnote_text, //str
     10,  //x
     200, //y
     'rect', //shape
     1, //anchorX
     1, //anchorY
     1, //useHTML
     1, //baseline
     'deleteme' //className
)

I've added a class name deleteme and then used jQuery to delete it:

$('.highcharts-deletme').remove();

score:1

Another (and general) solution is to store generated label in a variable:

var myLabel; // define label
$('#container').highcharts({
    chart: {
       events: {
          load: function () {
              myLabel = this.renderer.label( ... ).add();
          },
          redraw: function () {
              if(myLabel) {
                    myLabel.destroy();
              }
              myLabel = this.renderer.label( ... ).add();
          }
       }
    }
});

It will be faster, than using jQuery to find items by classes.


Related Query

More Query from same tag