Labels are cutoff when using chart js and chart annotation plug in to draw vertical line with label on top

487 Views Asked by At

I have created line chart using chart.js 4.2.1 and created vertical line using chartjs plugin annotation 2.2.1, I tried to show the label at top of vertical line. But the labels are cutoff.

enter image description here

But expectation should be labels need to be show at top of each vertical lines and below of each vertical lines. Sometimes a vertical line need to draw below the xaxis also

I have tried like this:

annotation: {
        type: "label",
        xValue: value // xPosition
        yValue: value // yPosition It is maximum of value from dataset
        content: "content",
        font: {
            size: 12
        },
        color: "#fff",
        padding: 0,
        position: "center,
        xAdjust: 20,
    };

actual expectation should be below enter image description here

0

There are 0 best solutions below