score:3
you use css id(#)
selector, but you have class(.)
es on your div's. change class
es to ids.
<div id="bar">
<label for="mychart">
bar chart title <br />
<canvas id="mychart" width="300" height="250"></canvas>
</label>
</div>
<div id="pie">
<label for="mypiechart">
pie chart title<br />
<canvas id="mypiechart" width="250" height="250"></canvas>
</label>
</div>
or change style's selectors to classes (use .
).
.bar {
position: absolute;
left: 0px;
right: 0px;
bottom: 0px;
top: 0px;
}
.pie {
position: absolute;
left: 500px;
right: 0px;
bottom: 0px;
top: 0px;
}
example
#bar {
position: absolute;
left: 0px;
right: 0px;
bottom: 0px;
top: 0px;
}
#pie {
position: absolute;
left: 500px;
right: 0px;
bottom: 0px;
top: 0px;
}
<div id="bar">
<label for="mychart">
bar chart title <br />
<canvas id="mychart" width="300" height="250"></canvas>
</label>
</div>
<div id="pie">
<label for="mypiechart">
pie chart title<br />
<canvas id="mypiechart" width="250" height="250"></canvas>
</label>
</div>
Source: stackoverflow.com
Related Query
- what is wrong with my code ? java script chart position
- react-chartjs-2 line chart with time on X-axes with multiple data sets plotted wrong
- My chart won`t live update - done in Chart.js and Java Script
- Problem with script src for Chart.js. The CDN for Chart.js funtions fine, so my code is ok. Somehow I'm not linking the file correctly
- how to display table from chart js data in canvas.js using java script .?
- Position of the x-axis labels is not in sync with the line chart data points
- How to make dynamic chart with the next view? What libraries allows to customise exactly this like in my design?
- How can I create a horizontal scrolling Chart.js line chart with a locked y axis?
- Chartjs random colors for each part of pie chart with data dynamically from database
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- How to prevent first/last bars from being cut off in a chart with time scale
- ChartJS - Draw chart with label by month, data by day
- Horizontal stacked bar chart with chart.js
- line chart with {x, y} point data displays only 2 values
- Vertical stacked bar chart with chart.js
- Display line chart with connected dots using chartJS
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- Chart.js - line chart with two yAxis: "TypeError: yScale is undefined"
- How to fix chart Legends width-height with overflow scroll in ChartJS
- How to display Line Chart dataset point labels with Chart.js?
- chart js how to fill legend box with colour
- Chart.js Mixed Bar and Line chart with different scales
- chart.js Line chart with different background colors for each section
- How do I draw a vertical line on a horizontal bar chart with ChartJS?
- reactive chart with chart.js in meteor
- chartjs: How to plot multi-line chart with irregular intervals
- Problem for display a chart with Chart.js and Angular
- How to display inline values in a stacked bar chart with Chart.js?
- Chart.js - Draw bar chart with multiple labels
- Show X axis on top and bottom in line chart rendered with Chart.js 2.4.0
More Query from same tag
- VueJS + Chartjs - Chart only renders after code change
- Javascript chart one number step
- How to change position of label of y-axes in chartjs?
- Create Chart.js pie chart data from PHP
- How to set same borderColor and backgroundColor in chartjs javascript
- Print multiple Primefaces Chart.js
- Chart Js clickable bar
- How do I prevent the scale labels from being cut off in chartjs?
- Labels (category type) on left and right of bar chart using chart.js?
- Doughnut spacing
- chartjs-plugin-zoom: get currently visible values when the page first loads
- Am using Chart.js and am trying to list the attendances for the last 7 days
- Rails dual axis using Chartkick and chart js
- How Export an Editable Chart with content to PPT and Excel
- Render Chartjs on hidden DIV
- Chart won't draw. Returning a string value not a Number value - Meteor - Chartjs
- Pagination in Bar chart using ChartJS
- Charts js. How to pass datasets use a select dropdown by angular instead jquery
- Drawing a doughnut chart with columns inside to represent hourly stats in chart.js
- Populate chart.js from data table / SQL result set
- Angular, Chart.js animation inside mat-tab
- Canvas width/height not updating on internet explorer
- How to display a progress over time in one horizontally stacked bar with chartjs
- how to add multi X axis custom line in chart js
- ChartJS, Primeng, Gap first and end of line chart
- Access a chart in a different function
- Get last 6 month name in Array for Chartjs
- How can I add multiple datasets into my dropdown menu and keep it as dynamic as it is right now?
- Chart.Js how to hide datapoints with "0" value in Stacked Bar Chart
- End x-axis on last data point (scatter plot) for x,y numeric values