score:0
Accepted answer
according to bootstrap's grid system, you have to define a .row
around both your .col-md-8
and .col
containers. next, remove the width: 30%
styles and everything will work properly, as you will see in this fiddle:
<div class="card-body">
<div class="row">
<div class="col-md-8">
<canvas id="chartcitas"></canvas>
</div>
<div class="col">
<div class="alert-wrap">
<div class="alert alert-success">
<i class="fas fa-medkit fa-2x"></i> <strong>citas totales:</strong> 964.00
</div>
<div class="alert alert-info">
<i class="fas fa-users fa-2x"></i> <strong>pacientes totales:</strong> 3.00
</div>
<div class="alert alert-warning">
<i class="fas fa-user-md fa-2x"></i> <strong>médicos totales:</strong> 25.00
</div>
<div class="alert alert-danger">
<i class="fas fa-hospital-alt fa-2x"></i> <strong>consultorios totales:</strong> 47.00
</div>
</div>
</div>
</div>
</div>
if you additionally want to optimized the mobile view, replace your .alert-wrap
by a .row
and set a <div class="col-6 col-md-12">
around your .alert
's as shown in this fiddle:
<div class="card-body">
<div class="row">
<div class="col-md-8 mt-3">
<canvas id="chartcitas"></canvas>
</div>
<div class="col mt-3">
<div class="row">
<div class="col-6 col-md-12">
<div class="alert alert-success">
<i class="fas fa-medkit fa-2x"></i> <strong>citas totales:</strong> 964.00
</div>
</div>
<div class="col-6 col-md-12">
<div class="alert alert-info">
<i class="fas fa-users fa-2x"></i> <strong>pacientes totales:</strong> 3.00
</div>
</div>
<div class="col-6 col-md-12">
<div class="alert alert-warning">
<i class="fas fa-user-md fa-2x"></i> <strong>médicos totales:</strong> 25.00
</div>
</div>
<div class="col-6 col-md-12">
<div class="alert alert-danger">
<i class="fas fa-hospital-alt fa-2x"></i> <strong>consultorios totales:</strong> 47.00
</div>
</div>
</div>
</div>
</div>
</div>
resulting in this mobile view and nearly the same desktop view as above:
Source: stackoverflow.com
Related Query
- How to align elements using a ChartBar from Chart.js and Alerts from Bootstrap 4?
- How to plot chart from external JSON and format X-AXIS to show time using Chart.JS?
- How to take data from an API and create a chart on that using Chart.js and Angular 8?
- How to save Chart JS charts as image without black background using blobs and filesaver?
- Chart js: how can I align the legend and the title
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How to create a gantt chart using Chart.js and populate dates?
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- Grouped Bar Chart from mySQL database using ChartJS and PHP
- How to get chart from data points (arrays) with inconsistent time intervals and chart.js?
- How to make aspecific API call from within a Line Chart class in ReactJS using react-chartjs-2?
- How do I customize y-axis labels and randomly pick the value from the data range for x-axis in Chart js
- How to export a chart in Excel and PDF format using Chart.js
- How to update a chart using VueJS and ChartJS
- how to increase space between legend and chart in chartjs (ng2charts ) using angular
- How to get Data from API to display chart using chartjs in Vuejs
- How do you set x and y axis and Title for a line chart using charts.js?
- How to displays item names from the database using a monthly or yearly chart PHP MySQL
- How to remove all gridlines and ticks all lines in lines chart in javascript taken from cdn)
- How to remove old chart and append new chart to div using chartjs
- How to plot a line chart which has both the start and points outside the canvas area using Chart.js
- How to show symbols after the label and before the numeric value using chart.js Bar chart in Angular
- How to start the chart from specific time and offest hour and then show the data on chart from target datetime in chartjs
- How do i have a single Chart.vue component instead of different chart components and then display charts from it by changing id of the API
- I am using chart js to draw a chart. I did everything right but i don't know why the x axis and y axis label is not comming in chart. code below
- how to draw Line chart using chart.js and datalabels should be shown
- How to parse a Chart using data from a nested object in ChartJS
- How to set the data of chart in angular which is taken from the backend nodejs api that is store in mongodb and showing on the html page
- How to achieve a mixed chart of 'horizontal' bars and line chart using Chart.js?
- how to display table from chart js data in canvas.js using java script .?
More Query from same tag
- Chart.js line chart looking as area chart with smooth lines but not sharp
- Chart.js 2.9.4 - howto set a margin for axes min\max and time axis label separation
- How to disable click in graph ChartJS
- ChartJs in endless loop
- React - Display Chart when button is clicked
- Printing chartjs tooltips
- How to create an angular 7 component?
- Beginner in JS,Stuck with ChartJS and multiple filters and ways to display
- issue with legend boxes in ChartJS
- Update the Chartjs push data with ajax
- how to pass function variable from one file to another in react
- Responsive Chart.js Canvas barplot height?
- laravel query builder with conditions
- Trouble using utcoffset with Chart.js
- How to increase the ghap between catergories or labels react-chartjs-2
- The expected type comes from property 'XAxes' and 'yAxes' which is declared here on type '_DeepPartialObject<{ [key: string]:
- Chart.js legend style
- ChartJS Zoom Granularity
- Performance issue, what causes it?
- Chart JS pass in custom data for points
- Custom alphanumerical values in chart.js?
- hide dataset by default using Chart.js and a custom script
- chart.js draw custom grid lines
- Updating chart.js with array index 0 doesn't work
- How to remove percentage calculation on top of bar in ng2-chart bar chart
- Populating javascript chart with Razor model data
- Legend on chart.js
- First implementation - Chart object seems to be incomplete
- How do I present progress in an Angular bar chart?
- ng2 scatter chart how to put labels in x axis