0

I have a graph with yearly series like "2023, 2024, 2025, 2025 forecast".

In the legend, I would like to hide the last item (i.e. 2025 forecast), but the serie to remain printed. How can I remove it from the legend, either when the legend is being built, or afterwards?


Things tried so far:

A) Setting the series explicitely when creating the legend didn't worked for me.

myChart.addLegend(300, 40, 600, 20, "left", [2023, 2024, 2025]);

B) Attempting to access last element of existing legend to remove it, I could not find how to reach the last item (serie or shape?) to detach it from the legend or alter its CSS style.

myChart.addLegend(300, 40, 600, 20);

myLegend = myChart.legends[0];
console.log(myLegend.series);
// Then, what to do?

// Tried and not working
//myShapes = myLegend.shapes[0];
//console.log(myShapes);

I found this thread, but I am lost with the complexity of the answer, and I am even not sure that it is relevant for what I want to achieve.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.