Home Forums Chart Support Import issue: Module ‘”angular-charts”‘ has no exported member ‘CanvasJS’

Import issue: Module ‘”angular-charts”‘ has no exported member ‘CanvasJS’

Viewing 4 posts - 1 through 4 (of 4 total)
  • #44586

    Hi, for some reason starting today (there was no problems in the last 3 months) my imports of the class CanvasJS won’t work in Angular project. Could you please help me to sort out why and how to fix it or a workaround?
    I am importing it like that:

    import {
      CanvasJS,
      CanvasJSAngularChartsModule,
    } from '@canvasjs/angular-charts';

    \

    And then use it to create a container and rerender:

    this.chart = new CanvasJS.Chart('chartContainer', {
          theme: ChartConstants.THEME,
          animationEnabled: true,
          options: {
            scales: {
              y: {
                stacked: true,
              },
            },
          },
          title: {
            text: '',
          },
          axisY: {
            title: '',
            suffix: '',
          },
          toolTip: {
            shared: 'true',
          },
          legend: {
            cursor: ChartConstants.CURSOR,
          },
          data: currentOptions,
        });
        this.chart.render();

    Thanks in advance.

    • This topic was modified 2 months, 3 weeks ago by kkoroleva.
    • This topic was modified 2 months, 3 weeks ago by kkoroleva.
    • This topic was modified 2 months, 3 weeks ago by kkoroleva.
    #44591

    @kkoroleva,

    You can import CanvasJS from @canvasjs/charts package directly in this case. Please find the code-snippet below.

    import * as CanvasJS from '@canvasjs/charts';
    

    Please check out CanvasJS npm package from this link.


    Ananya Deka
    Team CanvasJS

    #44595

    @ananyadeka

    Thank you for the answer. Unfortunately, it is not working. But now both modules doesn’t work. I have installed the latest versions of both and tried to reinstall all node modules and recreate package-lock

    import issue with chart
    import issue with angular-chart

    #44601

    @kkoroleva,

    We don’t have CanvasJS Charts TypeScript definition as of now. However, charts seems to work fine with TypeScript as well. You can ignore the corresponding error by adding //@ts-ignore above the import statement as shown in the code-snippet below:

    //@ts-ignore
    import * as CanvasJS from '@canvasjs/charts';


    Ananya Deka
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.