Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doughnut/Pie chart border radius (#8682)
* Arc with rounded ends implementation * End style option * Working border radius implementation for arcs * Linting * Fix bug introduced when converting to new border object * Fix bugs identified by tests * Arc border radius tests * Add test to cover small borderRadii * Reduce the weight of the arc border implementation * lint fix
- Loading branch information
Showing
12 changed files
with
273 additions
and
13 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
29 changes: 29 additions & 0 deletions
29
test/fixtures/controller.doughnut/borderRadius/scriptable.js
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,29 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
borderRadius: () => 4, | ||
}, | ||
] | ||
}, | ||
options: { | ||
elements: { | ||
arc: { | ||
backgroundColor: 'transparent', | ||
borderColor: '#888', | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions
32
test/fixtures/controller.doughnut/borderRadius/value-corners.js
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,32 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
borderRadius: { | ||
outerStart: 20, | ||
outerEnd: 40, | ||
} | ||
}, | ||
] | ||
}, | ||
options: { | ||
elements: { | ||
arc: { | ||
backgroundColor: 'transparent', | ||
borderColor: '#888', | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions
36
test/fixtures/controller.doughnut/borderRadius/value-large-radius.js
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,36 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
data: [60, 15, 33, 44, 12], | ||
// Radius is large enough to clip | ||
borderRadius: 200, | ||
backgroundColor: [ | ||
'rgb(255, 99, 132)', | ||
'rgb(255, 159, 64)', | ||
'rgb(255, 205, 86)', | ||
'rgb(75, 192, 192)', | ||
'rgb(54, 162, 235)' | ||
] | ||
}, | ||
] | ||
}, | ||
// options: { | ||
// elements: { | ||
// arc: { | ||
// backgroundColor: 'transparent', | ||
// borderColor: '#888', | ||
// } | ||
// }, | ||
// } | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Binary file added
BIN
+15.2 KB
test/fixtures/controller.doughnut/borderRadius/value-large-radius.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions
29
test/fixtures/controller.doughnut/borderRadius/value-small-number.js
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,29 @@ | ||
module.exports = { | ||
config: { | ||
type: 'doughnut', | ||
data: { | ||
labels: [0, 1, 2, 3, 4, 5], | ||
datasets: [ | ||
{ | ||
// option in dataset | ||
data: [0, 2, 4, null, 6, 8], | ||
borderRadius: 20 | ||
}, | ||
] | ||
}, | ||
options: { | ||
elements: { | ||
arc: { | ||
backgroundColor: 'transparent', | ||
borderColor: '#888', | ||
} | ||
}, | ||
} | ||
}, | ||
options: { | ||
canvas: { | ||
height: 256, | ||
width: 512 | ||
} | ||
} | ||
}; |
Binary file added
BIN
+13.3 KB
test/fixtures/controller.doughnut/borderRadius/value-small-number.png
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