Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-apexcharts Angular 16 - Cannot read properties of undefined (reading 'dataURI') #288

Open
Tfasesa opened this issue Oct 25, 2023 · 0 comments

Comments

@Tfasesa
Copy link

Tfasesa commented Oct 25, 2023

No encuentra referencia del objeto apexchart "undefined",
En el componente:
import {
ApexAxisChartSeries,
ApexChart,
ChartComponent,
ApexDataLabels,
ApexPlotOptions,
ApexResponsive,
ApexXAxis,
ApexLegend,
ApexFill,
NgApexchartsModule
} from "ng-apexcharts";
import * as ApexCharts from 'apexcharts'

@component({
selector: 'app-grafica1',
standalone: true,
imports: [ NgApexchartsModule,
...

...
@ViewChild('chart') mychar: ChartComponent;
...
..
this.chartOptions = {
series: [
..
this.mychar.dataURI().then(function (e) {
....

Html:
<apx-chart #chart
[series]="chartOptions.series"
[chart]="chartOptions.chart"
[dataLabels]="chartOptions.dataLabels"
[plotOptions]="chartOptions.plotOptions"
[responsive]="chartOptions.responsive"
[xaxis]="chartOptions.xaxis"
[legend]="chartOptions.legend"
[fill]="chartOptions.fill"
[colors]="chartOptions.colors"
>

Error:
ERROR TypeError: Cannot read properties of undefined (reading 'dataURI')

Package
"apexcharts": "^3.44.0",
"ng-apexcharts": "^1.8.0",
"@angular/cli": "~16.1.0",

El gráfico se presenta sin problemas, funciona bien la parte visual, pero al exportar desde script con la función dataURI presenta problema

Agradezco puedan ayudarme con el error

@Tfasesa Tfasesa changed the title ng-apexcharts Angular 16 ng-apexcharts Angular 16 - Cannot read properties of undefined (reading 'dataURI') Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant