Home forums Using CanvasJS CanvasJS npm package for React

Tagged: 

This topic contains 5 replies, has 2 voices, and was last updated by  Indranil Deo 8 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #19753

    allie
    Member

    Wondering whether there are any CanvasJS npm package can be used for React+Webpack.
    Here we tried to install canvasjs from https://www.npmjs.com/package/canvasjs, but build failed with below info:
    ERROR in ./node_modules/canvasjs/src/charts/index.js
    Module parse failed: Unexpected token (1:7)
    You may need an appropriate loader to handle this file type.
    | export SplineChart from ‘../charts/spline’;
    | export ColumnChart from ‘../charts/column’;
    | export StackedColumnChart from ‘../charts/stacked_column’;
    @ ./node_modules/canvasjs/src/core/charts.js 40:0-61:25
    @ ./node_modules/canvasjs/src/main/index.js
    @ dll vendor

    #19761

    Indranil Deo
    Member

    @allie,

    The package mentioned above is not official but from a third party. We don’t have npm package as of now.

    ___________
    Indranil Deo,
    Team CanvasJS

    #19771

    allie
    Member

    Is there any solution for using CanvasJS in React+Webpack?

    #19781

    Indranil Deo
    Member

    @allie,

    Please download this sample project of integrating React+Webpack.

    Also, please take a look at this jsfiddle to integrate CanvasJS with React.

    ___________
    Indranil Deo,
    Team CanvasJS

    #19801

    allie
    Member

    Thanks for your sample, it was helpful for me.
    And could you also help provide solution for using CanvasJS in React+Webpack+Typescript, actually the check of Typescript could not support “new CanvasJS.Chart” without define “CanvasJS” first.

    #20160

    Indranil Deo
    Member

    @allie,

    We have just released v2.1 with module import/export with which you can easily integrate front-end framework like React, Angular, Vuejs, etc. Please refer to the release blog for more information. Do download the latest version from our download page and let us know your feedback.

    ___________
    Indranil Deo,
    Team CanvasJS

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

You must be logged in to reply to this topic.