score:2
Accepted answer
Just override the buildScale
method to mess around with the scale object once its created.
Preview
Script
Chart.types.HorizontalBar.extend({
name: "HorizontalBarAlt",
initialize: function(data){
var originalBuildScale = this.buildScale;
var chart = this;
chart.buildScale = function() {
var r = originalBuildScale.apply(this, arguments);
chart.scale.calculateBarHeight = function() {
return 10;
}
return r;
}
Chart.types.HorizontalBar.prototype.initialize .apply(this, arguments);
}
});
Fiddle - http://jsfiddle.net/2mtgsoy3/
score:1
You can set it inside options object.
var options =
{
scales:
{
yAxes: [
{
barPercentage: 0.3
}]
}
}
Source: stackoverflow.com
Related Query
- How to change Chart.js horizontal bar chart Width?
- chart js 2 how to set bar width
- How do I draw a vertical line on a horizontal bar chart with ChartJS?
- How to draw Horizontal line on Bar Chart Chartjs
- In Stacked horizontal bar chart how to remove the vertical line in Chart.js?
- ChartJS: how to make a bar chart with a horizontal guideline:
- Chartjs 3.x - How to duplicate X axis on both sides of horizontal bar chart with only 1 dataset?
- angular-chart.js doughnut chart : How do I change width of the arc of a doughnut?
- How to style a pie chart in chart js? I want to change the border color, border width and give them shadow
- How do I create a stacked horizontal bar chart with Chart.js in React?
- How to prevent empty bars from taking up width in Chart.js bar chart
- How to draw multiple color bars in a bar chart along a Horizontal Line using chart.js
- How to change the position of the tooltip for the Bar type chart in Chart.Js
- How can I change the background colors of a bar chart after it has been created?
- How to get bar chart width in pixel
- How to order a horizontal bar chart - chartJS & Chart.HorizontalBar.js
- How to make labels on both side from horizontal bar chart js
- Chart.js Bar Chart change width (not duplicated to bar width questions!)
- Chart JS horizontal bar chart width of bars and the chart
- How to change bar width individually in chartjs?
- How to change bar color on a angular-chart and chart js bar graph with multiple datasets?
- how to modify horizontal bar chart using chart js
- How to change width of the chart using Chart.js
- How to set percentage value by default on each bars in horizontal bar chart js
- How can I create a horizontal scrolling Chart.js line chart with a locked y axis?
- How to modify bar width in Chartjs 2 bar charts
- Horizontal stacked bar chart with chart.js
- Chart.js Bar Chart - how to chart bars from 0
- Horizontal bar chart in chart.js
- How to put rounded corners on a Chart.js Bar chart
More Query from same tag
- Chart.js data not initially loaded
- How to create a simple Gauge with ChartJS v3?
- Use fetch to get JSON Data for Chart JS
- Zoom Function For Chart.js
- Facing difficulty in opening a dialog from onClick event on a pie chart in angular 8 (using chart.js)
- ChartJS charts not generating within tabs
- HTML 5 chartjs not working as static file
- ChartJS, make the bars show correct percentage?
- How to create a custom tooltip for chartJS graph with data in JSON array in JavaScript?
- How to create Waterfall model chart using QuickChart?
- labelling the pop up Chart js
- How to commaize the data values provided to a chart in Chart.JS?
- Chart.js 2.0 Formatting Y Axis with Currency and Thousands Separator
- ChartJS horizontal label are 1-2px clipped
- Chart.js how to display multiple labels on multi bar stacked chart
- How can labels/legends be added for all chart types in chart.js (chartjs.org)?
- Not able to add elements to an array in typescript using chart.js and bootstrat charts
- Chartjs render only the last in loop (ionic)
- Can't pass data to chart.js graph
- Chartjs: Is it possible to hide the data labels on the axis but show up on the graph on hover?
- chart js: when all the values passed to data are zeros, nothing is showing
- Editing Chart.js legend template
- Dynamically Creating Json Array Javascript
- Chart.js time-based bar chart
- Canvas displays initially in Chrome but not in Firefox
- ChartJS Generate Date Format
- How can I keep my menu from moving other elements in the page?
- ChartJS: Is this horizontal stacked bar and line graph multiaxis chart even possible?
- Chart.JS fixing maximum and minumum to a location on screen
- chartjs-plugin-streaming + chartjs-plugin-zoom