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.
New weight option for pie and doughnut charts (chartjs#5951)
Add functionality to give pie & doughnut datasets a weight attribute, which affects the relative thickness of the dataset when there are multiple datasets in pie & doughnut charts. The default weight of each dataset is 1, providing any other numerical value will allow the pie or doughnut dataset to be drawn with a thickness relative to its default size. For example a weight of 2 will allow the dataset to be drawn double its typical dataset thickness. Note that the weight attribute will only affect a pie or doughnut chart if there is more than one visible dataset. Using weight on a pie or doughnut dataset when there is only one dataset on the chart will have no affect.
- Loading branch information
1 parent
4cf2488
commit ae92a2f
Showing
6 changed files
with
140 additions
and
4 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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"config": { | ||
"type": "doughnut", | ||
"data": { | ||
"datasets": [{ | ||
"data": [ 1, 1 ], | ||
"backgroundColor": [ | ||
"rgba(255, 99, 132, 0.8)", | ||
"rgba(54, 162, 235, 0.8)" | ||
], | ||
"borderWidth": 0 | ||
}, | ||
{ | ||
"data": [ 2, 1 ], | ||
"hidden": true, | ||
"borderWidth": 0 | ||
}, | ||
{ | ||
"data": [ 3, 3 ], | ||
"weight": 3, | ||
"backgroundColor": [ | ||
"rgba(255, 206, 86, 0.8)", | ||
"rgba(75, 192, 192, 0.8)" | ||
], | ||
"borderWidth": 0 | ||
}, | ||
{ | ||
"data": [ 4, 0 ], | ||
"weight": 0, | ||
"borderWidth": 0 | ||
}, | ||
{ | ||
"data": [ 5, 0 ], | ||
"weight": -2, | ||
"borderWidth": 0 | ||
}], | ||
"labels": [ "label0", "label1" ] | ||
}, | ||
"options": { | ||
"legend": false, | ||
"title": false | ||
} | ||
}, | ||
"options": { | ||
"canvas": { | ||
"height": 500, | ||
"width": 500 | ||
} | ||
} | ||
} |
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,52 @@ | ||
{ | ||
"config": { | ||
"type": "pie", | ||
"data": { | ||
"datasets": [ | ||
{ | ||
"data": [ 1, 1 ], | ||
"backgroundColor": [ | ||
"rgba(255, 99, 132, 0.8)", | ||
"rgba(54, 162, 235, 0.8)" | ||
], | ||
"borderWidth": 0 | ||
}, | ||
{ | ||
"data": [ 2, 1 ], | ||
"hidden": true, | ||
"borderWidth": 0 | ||
}, | ||
{ | ||
"data": [ 3, 3 ], | ||
"weight": 3, | ||
"backgroundColor": [ | ||
"rgba(255, 206, 86, 0.8)", | ||
"rgba(75, 192, 192, 0.8)" | ||
], | ||
"borderWidth": 0 | ||
}, | ||
{ | ||
"data": [ 4, 0 ], | ||
"weight": 0, | ||
"borderWidth": 0 | ||
}, | ||
{ | ||
"data": [ 5, 0 ], | ||
"weight": -2, | ||
"borderWidth": 0 | ||
} | ||
], | ||
"labels": [ "label0", "label1" ] | ||
}, | ||
"options": { | ||
"legend": false, | ||
"title": false | ||
} | ||
}, | ||
"options": { | ||
"canvas": { | ||
"height": 500, | ||
"width": 500 | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.