Label in markline


#1

Hi, I used the vertical mark line from this answer: Histogram mark line I try to add the label but only a number appears there, I want to add a custom label on the top of the line, any ideas?


#2

Sure thing, you could use formatter option to get a custom label.
So the code updated in the link you provide will be this:

...
let lines = cf.MarkLine()
                .data([
                    {"xAxis": pos, "label": { "formatter": "Your custom label here", "position": "end" } }
                ]);
...

With formatter key in label option, you specify your custom label and with position key, you specify the position for the label. In this specific case, the markerline is drawn from bottom to top, so the end position will be the top of the marker line.