chartjs / chartjs-plugin-annotation

Annotation plugin for Chart.js
MIT License
603 stars 325 forks source link

Usage as CDN #800

Closed YorozuyaDev closed 1 year ago

YorozuyaDev commented 2 years ago

We are trying to use this plugin and ChartJS from a CDN, but we are not able to draw the box, and no errors are reported. My code looks correct, since it works on the demo enviroment, but I paste anyway. Thanks in advance

HTML Code:

<html>
  <body>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-annotation/2.0.1/chartjs-plugin-annotation.min.js">
    </script>
    <script src="app.js"></script>
 </body>
</html>

Config

plugins: {
        autocolors: false,
        annotation: {
          annotations: {
            box1: {
              type: 'box',
              xMin: 1,
              xMax: 9,
              yMin: 1,
              yMax: 4,
              backgroundColor: 'transparent'
            },
            label1: {
              type: 'label',
              xValue: 2,
              yValue: 4.5,
              backgroundColor: 'transparent',
              content: ['Fase latente'],
              font: {
                size: 18
              }
            }
          }
        }
      },
stockiNail commented 2 years ago

@YorozuyaDev can you provide a sample (or whole chart configuration and data) to reproduce the issue, maybe using the data of environment where it doesn't work?

stockiNail commented 1 year ago

Closing as outdated, feel free to re-open with the requested additional info.