Estoy tratando de cargar la anotación del gráfico dinámico que creo después de recibir datos de la base de datos y probé todas las opciones posibles, pero de alguna manera el gráfico se carga pero no las anotaciones.
chart.js versión = v2.9.4 chart-plugin-annotation.min.js versión = 0.5.7
Función en JS que se ejecuta cuando se reciben datos de db:
function DrawChart(timeLabelList, unitsProducedList, goalList){ if(draw_the_chart != null) draw_the_chart.destroy(); Chart.defaults.global.defaultFontColor = 'white'; var ctx = document.getElementById('draw_the_chart').getContext("2d"); draw_the_chart = new Chart(ctx, { type: 'line', //plugins: [ChartAnnotation], data: { labels: timeLabelList, datasets: [ { label: 'Goal', yAxisID: 'A', data: goalList, //backgroundColor: chartColumnColorBlueSolid, borderColor: chartColumnColorGreenSolid, borderWidth: 2, pointStyle: 'star' }] }, options: { annotation: { annotations: [ { id: "a-line-1", type: "line", mode: "vertical", scaleID: "y-axis-0", value: "1", borderColor: "red", borderWidth: 2 } ] }, legend: { position: 'bottom', display: true, }, elements: { line: { tension: 0 } }, scales: { xAxes: [{ stacked: true, type: 'time', time: { unit: 'hour' }, }], yAxes: [{ stacked: false, id: 'A', type: 'linear', position: 'right', }] }, } }); }Intenté todas las formas posibles de registrarme y también diferentes formas de usar el complemento, pero no tuve suerte al trazarlo. Incluso usé las últimas versiones de CDN pero no tuve suerte.
¿Alguien puede ayudar con eso?
¡Gracias!