ChartJS only starts the chart when I change the page zoom

1

People, for some reason my graph made in chartJS 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 notebook. Here is 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 do not think it's the case how they are filled. Does it have to do with the div that surrounds the chartjs canvas?

Thank you!

    
asked by anonymous 05.08.2017 / 02:55

0 answers