forked from chartjs/Chart.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement equally sized bars (chartjs#4994)
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).
- Loading branch information
1 parent
54c6a35
commit 777c503
Showing
27 changed files
with
586 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
bower.json | ||
*.log | ||
*.swp | ||
*.stackdump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ globals: | |
rules: | ||
# Best Practices | ||
complexity: 0 | ||
max-statements: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"config": { | ||
"type": "bar", | ||
"data": { | ||
"labels": ["2017", "2018", "2019", "2024", "2025"], | ||
"datasets": [{ | ||
"backgroundColor": "rgba(255, 99, 132, 0.5)", | ||
"data": [1, null, 3, 4, 5] | ||
}] | ||
}, | ||
"options": { | ||
"responsive": false, | ||
"legend": false, | ||
"title": false, | ||
"scales": { | ||
"xAxes": [{ | ||
"type": "time", | ||
"offset": true, | ||
"display": false, | ||
"barPercentage": 1, | ||
"categoryPercentage": 1, | ||
"barThickness": 128, | ||
"ticks": { | ||
"source": "labels" | ||
} | ||
}], | ||
"yAxes": [{ | ||
"display": false, | ||
"ticks": { | ||
"beginAtZero": true | ||
} | ||
}] | ||
} | ||
} | ||
}, | ||
"options": { | ||
"canvas": { | ||
"height": 256, | ||
"width": 512 | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions
42
test/fixtures/controller.bar/bar-thickness-flex-offset.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"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", | ||
"offset": true, | ||
"display": false, | ||
"barPercentage": 1, | ||
"categoryPercentage": 1, | ||
"barThickness": "flex", | ||
"ticks": { | ||
"source": "labels" | ||
} | ||
}], | ||
"yAxes": [{ | ||
"display": false, | ||
"ticks": { | ||
"beginAtZero": true | ||
} | ||
}] | ||
} | ||
} | ||
}, | ||
"options": { | ||
"canvas": { | ||
"height": 256, | ||
"width": 512 | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"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 | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"config": { | ||
"type": "bar", | ||
"data": { | ||
"labels": ["2016", "2018", "2020", "2024", "2030"], | ||
"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, | ||
"maxBarThickness": 8, | ||
"ticks": { | ||
"source": "labels" | ||
} | ||
}], | ||
"yAxes": [{ | ||
"display": false, | ||
"ticks": { | ||
"beginAtZero": true | ||
} | ||
}] | ||
} | ||
} | ||
}, | ||
"options": { | ||
"canvas": { | ||
"height": 256, | ||
"width": 512 | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.