score:11
note that there seems to be some changes going on. the actual configuration would depend on which v2.0 you are using.
for version 2.0.0-alpha
set categoryspacing
for the xaxes. you can do this globally
chart.defaults.bar.scales.xaxes[0].categoryspacing = 0
or you can do it by chart
...
scales: {
xaxes: [{
categoryspacing: 0
}],
...
fiddle - http://jsfiddle.net/beehe4eg/
for version 1.0.2
adjust the options barvaluespacing
and bardatasetspacing
to make the bars closer. this will automatically increase their width.
score:17
for me, trying 2.0 beta, what worked was to set the barpercentage on the xaxes scale option.
this is what i used:
var options = {
data: chartdata,
type: "bar",
options: {
scales: {
xaxes: [{ barpercentage: 0.5 }]
}
}
};
var chart = new chart(chartctx, options);
score:40
for version 2.4.0 barthickness - manually set width of each bar in pixels. if not set, the bars are sized automatically.
options = {
scales: {
xaxes: [{
barthickness : 73
}]
}
}
Source: stackoverflow.com
Related Query
- How to modify bar width in Chartjs 2 bar charts
- How do I make line charts overlay over bar charts in chartjs
- how to make chartjs columns smaller in width for bar chart?
- chart js 2 how to set bar width
- How to modify chartjs tooltip so i can add customized strings in tooltips
- chartjs : how to set custom scale in bar chart
- ChartJs how to get from mulitiple dateset which dataset bar is clicked
- ChartJs bar chart - keep bars left instead of equally spread across the width
- How to change the cursor to a pointer when I hover over a bar in a ChartJS bar chart?
- Why are these 2.9 ChartJS bar charts different?
- How to set a full length background color for each bar in chartjs bar
- How to draw Horizontal line on Bar Chart Chartjs
- How to fix bar width in chartjs?
- How to dynamically set ChartJs line chart width based on dataset size?
- How to add ChartJS code in Html2Pdf to view image
- ChartJS bar chart fixed width for dynamic data sets
- How to remove bars for those bars with zero value in Chartjs bar chart?
- How to make chartJs stacked bar always rounded when data is 0?
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- chartjs - how to set the order in which the different charts are displayed
- How to retain spacing between bars for two different bar charts in Chart.js 2
- Chartjs 3.x - How to duplicate X axis on both sides of horizontal bar chart with only 1 dataset?
- how to highlight bar in ChartJS with onkeyup Input
- How can I load multiple Chartjs charts with different data on the same page?
- How to generate chartjs charts to pdf using laravel?
- Chartjs tooltip anchor point position on bar charts
- Chart.JS: How can I only display data labels when the bar width is big enough for the text?
- Rounded corners on chartJS v.2 - bar charts (with negative values)
- How to set the chartjs bar graph scale to the highest value in the result data
- How to highlight single bar in bar chart using Chartjs
More Query from same tag
- Undefined x values in chart.js
- Position tooltip based on mouse position
- Chart.js Bar Chart - how to chart bars from 0
- HTML how block elements to not go over footer etc
- How to toggle between Custom tooltip and normal tooltip in chartjs and angular
- Chartjs tooltip anchor point position on bar charts
- how to use chartjs graph in a *ngFor loop
- ng2-charts access base chart object
- Modifying the X-Axis Labels of a Scatterplot in Chart.js 2
- How can I add vertical line and label for each point in Chart.js?
- JS Chart: do not merge duplicate x axis labels
- How to import Patternomaly into Ionic 2 project?
- How to json_encode associative php array to [{x: key1, y: value1}, {x: key2, y: value2}, ...]?
- Chart.JS Global Options
- How to externally trigger datalabels-plugin (active) - ChartJS
- Chart.js updating data
- How to set plural label values in chart.js
- how to use chart.js in angular 7
- Is it possible to fill particular portion between given start & end angle in pie chart in chart.js?
- Dynamic array javascript
- How to use Utils from Chartjs on Django
- how to show REALTIME chartjs of specific ID in mysql when click on corresponding marker on googlemap javascript
- Chartjs not reading data from vuex mapped state
- chart js stripline? like one from canvas
- Chart.js label color
- Extending Line Chart with custom line
- How to get data from JSON ReactJs
- How can I show percentages when hovering over my chart?
- Removing empty cells (rows) from csv file in javascript
- Getting dynamic data for chart.js from Django model