Fixed strokeWidth issue for Pie and Donut charts

This commit is contained in:
Abhinandan Kushwaha 2021-11-01 21:46:22 +05:30
parent 9ab5f45584
commit 84fd5058bd
2 changed files with 25 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "react-native-gifted-charts", "name": "react-native-gifted-charts",
"version": "0.1.14", "version": "0.1.15",
"description": "The most complete library for Bar, Line, Area, Pie and Donut charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.", "description": "The most complete library for Bar, Line, Area, Pie and Donut charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
"main": "src/index.tsx", "main": "src/index.tsx",
"files": [ "files": [

View File

@ -194,6 +194,18 @@ export const PieChart = (props: propTypes) => {
ctx.fillStyle = backgroundColor; ctx.fillStyle = backgroundColor;
ctx.fill(); ctx.fill();
// Stroke at the end again
ctx.moveTo(
radius + initialValue + shiftX,
radius + initialValue + shiftY,
)
ctx.lineTo(
radius + initialValue + shiftX,
radius + initialValue + shiftY,
);
ctx.stroke();
} }
/*************************************************************************************/ /*************************************************************************************/
@ -221,6 +233,18 @@ export const PieChart = (props: propTypes) => {
ctx.fillStyle = dataItem.color || colors[i++ % 8]; ctx.fillStyle = dataItem.color || colors[i++ % 8];
ctx.fill(); ctx.fill();
// Stroke at the end again
ctx.moveTo(
radius + initialValue + shiftX,
radius + initialValue + shiftY,
)
ctx.lineTo(
radius + initialValue + shiftX,
radius + initialValue + shiftY,
);
ctx.stroke();
/************************* Displaying Text Labels **********************/ /************************* Displaying Text Labels **********************/
if (showText) { if (showText) {