Iam trying to create a box in my chart but it don’t work as expacted. Can anyone look at the code below? (btw: great tool!!!)
{
“type”: “bar”,
“data”: {
“labels”: [“A”, “B”, “C”],
“datasets”: [{
“data”: [10, 20, 30],
“backgroundColor”: “lightblue”
}]
},
“options”: {
“annotation”: {
“annotations”: [{
“type”: “box”,
“drawTime”: “afterDatasetsDraw”,
“xScaleID”: “x-axis-0”,
“yScaleID”: “y-axis-0”,
// Vi setter xMin/xMax til en verdi litt høyere enn siste kategori for å plassere boksen til høyre.
“xMin”: 2.5,
“xMax”: 2.5,
// y-verdien settes til et høyt nivå (her 30) slik at den havner øverst.
“yMin”: 30,
“yMax”: 30,
“backgroundColor”: “rgba(0, 0, 0, 0)”,
“borderWidth”: 0,
“label”: {
“enabled”: true,
“content”: “Din tekstblokk”,
// “center” plasserer labelen i boksen, men vi kan justere med xAdjust og yAdjust:
“position”: “center”,
“xAdjust”: 10,
“yAdjust”: -20
}
}]
}
}
}