Home Forums Chart Support Small chart inside a Bootstrap modal in Angular

Small chart inside a Bootstrap modal in Angular

Viewing 2 posts - 1 through 2 (of 2 total)
  • #44764

    I am working on an Angular application and I have a chart that is displayed inside a Bootstrap modal. The problem is that the chart looks small when the modal is opened, and only when you click on an index of the chart, it takes the defined size.

    #44765

    @bettovenn,

    CanvasJS Chart automatically sets the width and height of the chart according to container’s dimensions. When the container’s dimension is not specified it takes up the default width & height(500px X 400px).

    Also, in bootstrap, since the modal is not displayed initially, chart takes the default values. To solve this issue, you can render the chart when the shown.bs.modal event is fired.

    $('#chartModal').on('shown.bs.modal', function () {
            chart.render();
    });

    null

    Please take a look at this JSFiddle.

    Sachin Bisht
    Team CanvasJS

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

You must be logged in to reply to this topic.