mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 20:29:12 +02:00
15d1056b53
When `barThickness: undefined|null` (default), we compute an optimal sample size based on the smallest tick interval reduced to prevent any bar to overlap (bar equally sized). Also added support for a special `barThickness: 'flex'` value (previous default) that globally arranges bars side by side to prevent any gap when percentage options are 1 (variable bar sizes).
42 lines
1.0 KiB
JSON
42 lines
1.0 KiB
JSON
{
|
|
"config": {
|
|
"type": "bar",
|
|
"data": {
|
|
"labels": ["2017", "2018", "2020", "2024", "2038"],
|
|
"datasets": [{
|
|
"backgroundColor": "#FF6384",
|
|
"data": [1, null, 3, 4, 5]
|
|
}]
|
|
},
|
|
"options": {
|
|
"responsive": false,
|
|
"legend": false,
|
|
"title": false,
|
|
"scales": {
|
|
"xAxes": [{
|
|
"type": "time",
|
|
"display": false,
|
|
"barPercentage": 1,
|
|
"categoryPercentage": 1,
|
|
"barThickness": "flex",
|
|
"ticks": {
|
|
"source": "labels"
|
|
}
|
|
}],
|
|
"yAxes": [{
|
|
"display": false,
|
|
"ticks": {
|
|
"beginAtZero": true
|
|
}
|
|
}]
|
|
}
|
|
}
|
|
},
|
|
"options": {
|
|
"canvas": {
|
|
"height": 256,
|
|
"width": 512
|
|
}
|
|
}
|
|
}
|