Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
Remove SVG rendered path on Legend Item Click

This is my jsfiddle

I'm plotting the Arrow mark at the end of some series by rendering the path element. When I hide other legends arrow mark gets shifted, without removing rendered arrow mark.

I tried removing rendered elements using the below ways

  1. by using destroy method on the arrow mark series.
plotOptions: {
  series: {
   events: {
     legendItemClick: {
//svgElements are retrieved from called function which draws arrow mark
     svgElements.forEach((ele) => {
                  if(ele.d !== 'M 0 0')
                    ele.destroy();
                })
   }
  }
 }
}
  1. by using the remove method
svgElements.forEach((ele) => {
                  if(ele.d !== 'M 0 0')
                    ele.element.remove();
                })
  1. by using id on SVG
svgElements.forEach((ele) => {
                  if(ele.d !== 'M 0 0')
                    $('#legend4').remove();
                })
  1. by using safeRemoveChild method
svgElements.forEach((ele) => {
                  if(ele.d !== 'M 0 0')
                    ele.safeRemoveChild(ele.element);
                })

But none of them worked. Any suggestions will be helpful.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You don't need to remove the custom arrows, it is enough if you update their positions. For example:

if (series.customArrow) {
  series.customArrow.attr({
    d: path
  })
} else {
  series.customArrow = series.chart.renderer.path(path)
    .attr({
      fill: series.color
    })
    .add(series.group);
}

Live demo: https://jsfiddle.net/BlackLabel/wv41sqro/

API Reference: https://api.highcharts.com/class-reference/Highcharts.SVGElement

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!