Home forums Using CanvasJS Zooming does not work in production environment

This topic contains 3 replies, has 2 voices, and was last updated by  yueming 5 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #15111

    yueming
    Member

    I use CanvasJS in electron. The zooming function works in development environment but not in production environment.

    I use https://github.com/chentsulin/electron-react-boilerplate.

    The example code is as below:

    import '../../third/canvasjs/canvasjs.min';
    
    const Chart = window.CanvasJS.Chart;
    
      chart = new Chart('chart2D1', {
        zoomEnabled: true,
        zoomType: 'xy',
        rangeChanged,
        backgroundColor: Const.Colors.white,
    ...
    #15121

    Suyash Singh
    Moderator

    @yueming,

    It seems like you haven’t defined rangeChanged, Check console if you are getting some error in the production environment. It would be helpful if you can share working code which reproduces the issue, so that we can look into it and help you to solve it.
    ___
    Suyash Singh
    Team CanvasJS

    #15122

    yueming
    Member

    Thanks. it is not about zoomEnabled. The example code is not complete.

    I have fixed this issue as a work around by importing canvasjs in the way below:

    if (process.env.NODE_ENV === 'development') {
      require('../../third/canvasjs/canvasjs.min');
    } else {
      require('../../third/canvasjs/canvasjs');
    }

    If the webpack makes bundle with canvasjs.min.js in production environment, this issue occurs.

    If the webpack makes bundle with canvasjs.js in production environment, it would be okay.

    I don’t know the specific reason.

    #15132

    yueming
    Member

    Thanks. I think it is an issue more involved with electron and reported it in electron project.

    https://github.com/chentsulin/electron-react-boilerplate/issues/991

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

You must be logged in to reply to this topic.