score:8
Accepted answer
for those having a similar issue. I needed to make the data com_passed and com_failed as an array instead of an integer like so.
var com_passed = rows[rows.length-2]["# Common Passed"];
var com_failed = rows[rows.length-2]["# Common Failed"];
var ctx = document.getElementById("common_chart");
ctx.height = 50;
var historicalChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["Passed", "Failed"],
datasets: [
{
data: [com_passed],
label: "Passed",
fillColor: "red"
},
{
data: [com_failed],
label: "Failed",
fillColor: "green"
}
]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero:true,
responsive: false,
maintainAspectRatio: true
}
}]
}
}
});
Source: stackoverflow.com
Related Query
- Chart.js - Draw bar chart with multiple labels
- How do I draw a vertical line on a horizontal bar chart with ChartJS?
- Chart JS : Getting issue with draw bar chart
- How to draw multiple color bar in a bar chart using chart.js
- How to add labels on top of the chart bar with Chart.js 2
- Chart.js how to display multiple labels on multi bar stacked chart
- Draw multiple chart in one page with Chart.js
- How to draw multiple color bars in a bar chart along a Horizontal Line using chart.js
- how to write labels along with data on top and bottom of each stack in bar chart
- How to know which bar is clicked on chart.js bar chart with multiple data?
- Chart.js Draw a Stacked Bar Chart with Limit Line
- Show the latest labels in a bar chart with React.js using react-chartjs
- Bar chart with two sets of labels in Quickchart
- Draw stacked horizontal bar chart with Average line using ChartJS
- Chart.js manipulate each bar in chart with different labels
- Chart Js Stacked Bar Chart with Multiple levels or categories
- hiding x-axes labels with 0 values on a bar chart
- How to change bar color on a angular-chart and chart js bar graph with multiple datasets?
- combo bar line chart with multiple grouped/stacked datasets
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- ChartJS - Draw chart with label by month, data by day
- Horizontal stacked bar chart with chart.js
- Vertical stacked bar chart with chart.js
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- How to display Line Chart dataset point labels with Chart.js?
- Chart.js Mixed Bar and Line chart with different scales
- Chart.js v2 is there a way to draw bar chart horizontally?
- How to display inline values in a stacked bar chart with Chart.js?
- ChartJS bar chart with legend which corresponds to each bar
- How to display data labels outside in pie chart with lines in ionic
More Query from same tag
- Update a chartjs by javascript function
- Chart.JS - Set fixed X and Y axis values in time chart?
- Change size of a specific point on a line chart in Chart.js
- Chart.js how to remove final label on chart
- Undefined values in chart.js from json
- Setting ChartJS plugin on vue-chartjs not working
- How to Create Single line bubble Chartjs chart?
- How to realize a discontinuous section (jumps) in a continuous line plot with Chart.js?
- how can i reset chartjs object all instances and recreate it from scratch?
- Chart.js - Fill Text only appearing when hovering over one part of the doughnut
- Add a text as tooltip for each point on a line chart
- How to add color to text using pluginService for Chart.js?
- Can not update bar chart values in Chart.js 2.0.0 alpha3
- Average 2 Keys in ChartJS
- chart.js not working in browser with django. no error for template and static folder setting
- Cannot access a variable declared outside a For loop (Javascript)
- How to manipulate different charts by angular
- how to add Thousand separator in pie chart tooltips of charts.js
- pie chart in php with mysql data using chart.js
- How to enable zoom plugin using Chart JS?
- chartjs creating data array dynamically
- display vertical axis label in line chart using chart.js
- Is it possible to display the yAxis as a percentage without modifying my datasets for a Line chart?
- Chartjs change the specific label color in x axis in callback function
- charts.js won't show legend and on chart descriptions
- Apply/Register conflicting plugins to different charts
- My point annotation in Chart.js 3.3.2 won't render in my Django template. Making a realtime graph of temperature for my wood-fired pizza oven
- Chart.js bar chart change the label position X-axis
- Chartjs charts drawing with the same colour after update
- Have all label in Chartjs be at fixed positions