javascript
chart js
i want to change label in static to dynamic
var doctorwisebar = document.getElementById("doctorwise_collection");
window.DoctorBar = new Chart(doctorwisebar, {
type: "bar",
defaultFontFamily: 'sans-serif',
data: {
labels: result[0],
datasets: [{
label: 'Label 2',
data: result[2],
backgroundColor: ['#181A19'],
"maxBarThickness": 30,
},
{
label: 'Label 1',
data: [result[3]],
backgroundColor: ['#FBD404'],
"maxBarThickness": 30,
},],
},
options: {
// indexAxis: 'y',
responsive: true,
scales: {
x: {
stacked: true,
ticks: {
font: {
size: 11,
}
}
},
y: {
stacked: true,
}
},
}
});
Output
d
i want to change label in static to dynamic
Was this helpful?
Similar Posts
- Bar chart with circular shape from corner in Chart.js
- Create bar chart in Chart.js
- Create line chart in Chart.js
- Create pie chart in Chart.js
- Assign fixed width to the columns of bar chart in Chart.js
- Assign a fixed height to chart in Chart.js
- Add a title to the chart in Chart.js
- Use image as chart datasets background Chart.js