apexcharts / ng-apexcharts

ng-apexcharts is an implementation of apexcharts for angular. It comes with one simple component that enables you to use apexcharts in an angular project.
MIT License
310 stars 78 forks source link

Unable to update annotations dynamically #222

Closed QuentinReyn closed 1 year ago

QuentinReyn commented 1 year ago

Hello everyone,

I'm currently trying to display a min/max annotation on my timeseries chart. It includes two dynamics annotations to do this.

The min/max value is refreshed whenever the zoomEvent is called. So the annotations are updated after a zoom event. And I'm updating them like this :

setAnnotations1(min, max) {
    let newAnnotation: ApexAnnotations = {
      yaxis: [
        {
          y: max,
          label: {
            text: "Max temp : " + max,
            style: {
              background: "black"
            }
          },
          strokeDashArray: 0,
        },
        {
          y: min,
          label: {
            text: "Min temp : " + min,
            style: {
              background: "black"
            }
          },
          strokeDashArray: 0,
        }
      ]
    }
    this.chartOptions1.annotations = newAnnotation;
  }

But unfortunately the annotations aren't refreshed on the chart view. It looks like I need to re-render the chart to get the new annotations, does anyone know if it's possible in a first place to have dynamic annotations ?

Thanks