Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

256
Visualizações
Use Angular highchart in angular lib

I'm creating angular lib and I want to use highcharts-angular + highchart but the problem that I face that while I am using it just get ERROR TypeError: Cannot read properties of undefined (reading 'chart')

DashboardComponent.html:4 ERROR TypeError: Cannot read properties of undefined (reading 'chart')
   at Object.get [as chart] (system.src.js:457)
   at HighchartsChartComponent.updateOrCreateChart (highcharts-chart.component.ts:51)
   at HighchartsChartComponent.wrappedUpdateOrCreateChart (highcharts-chart.component.ts:43)
   at HighchartsChartComponent.ngOnChanges (highcharts-chart.component.ts:30)
   at checkAndUpdateDirectiveInline (core.js:23630)
   at checkAndUpdateNodeInline (core.js:30761)
   at checkAndUpdateNode (core.js:30723)
   at debugCheckAndUpdateNode (core.js:31350)
   at debugCheckDirectivesFn (core.js:31314)
   at Object.eval [as updateDirectives] (DashboardComponent.html:17)

and here the undefined error in highchart lib

 updateOrCreateChart() {
   if (this.chart && this.chart.update) {
     this.chart.update(this.options, true, this.oneToOne || false);
   } else {
     this.chart = (this.Highcharts as any)[this.constructorType || 'chart'](
       this.el.nativeElement,
       this.options,
       this.callbackFunction || null
     );

     // emit chart instance on init
     this.chartInstance.emit(this.chart);
   }
 }

my HTML Code

  <highcharts-chart
                            class="area-chart"
                            [Highcharts]="Highcharts"
                            [options]="chartOptions"
                          ></highcharts-chart>

my TS code

Highcharts: typeof Highcharts = Highcharts;
  constructorType = 'chart';
  chartOptions: Highcharts.Options = {
    exporting: {enabled: false},
    title: {
      text: ''
    },
    tooltip: {
      pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
    },
    plotOptions: {
      pie: {
        dataLabels: {
          enabled: true,
          style: {
            fontWeight: '300'
          }
        }
      }
    },
    series: [{
      type: 'pie',
      name: 'Time share',
      data: [
        ['Front yard', 10.38],
        ['Closet', 26.33],
        ['Swin pool', 51.03],
        ['Like a boss', 4.77],
        ['Barking', 3.93]
      ]
    }]
  };
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda