From 84fd5058bd57d0def3c97009f0670a164368a4ef Mon Sep 17 00:00:00 2001 From: Abhinandan Kushwaha Date: Mon, 1 Nov 2021 21:46:22 +0530 Subject: [PATCH] Fixed strokeWidth issue for Pie and Donut charts --- package.json | 2 +- src/PieChart/index.tsx | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7c15c2f..1b60d03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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.", "main": "src/index.tsx", "files": [ diff --git a/src/PieChart/index.tsx b/src/PieChart/index.tsx index cf4434b..e700d05 100644 --- a/src/PieChart/index.tsx +++ b/src/PieChart/index.tsx @@ -194,6 +194,18 @@ export const PieChart = (props: propTypes) => { ctx.fillStyle = backgroundColor; 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.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 **********************/ if (showText) {