Chartjs only starts the chart when I zoom in on the page

Asked

Viewed 51 times

1

Guys, for some reason my chartJS chart only shows the data when I press Ctrl+shift+i to open the console or when I change the page zoom, which is not very interesting for a user.

I’m testing on my laptop. Here’s the code:

 <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
          <div class="dashboard_graph">

            <div class="row x_title">
              <div class="col-md-6">
                <h3>Network Activities</h3>
              </div>
              <div class="col-md-6">

              </div>
            </div>

            <div class="col-md-9 col-sm-9 col-xs-12">
              <canvas id="myChart" width="400" height="400"></canvas>
            </div>

            <div class="clearfix"></div>
          </div>
        </div>

      </div>


var myChart = new Chart(ctx, {
     type: 'bar',
     data: {
         labels: horizontal,
         datasets: [{
             label: '# of Votes',
             data: vertical,
             backgroundColor: backgroundColor,
             borderColor: borderColor,
             borderWidth: 1
         }]
     },
     options: {
         scales: {
             yAxes: [{
                 ticks: {
                     beginAtZero:false
                 }
             }]
         }
     }
 });

I omitted the chartJs variables because I don’t think it comes down to how they are filled in. Does it have to do with the div that wraps the chartjs canvas?

Thank you!

  • Post the css of this html possibly on it has some "@media screen" causing it.

  • I don’t know anything about Chartjs, but have you ever tried to put that "beginAtZero" to "true" instead of false? Just a guess anyway.

  • @inovapixel yes. Does not change anything.

  • @Rafaelsalomão I will look and stand

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.