wuxudong / react-native-charts-wrapper

a react native charts wrapper (support android & iOS)
2.43k stars 657 forks source link

Center text in markers #918

Open JohnBerd opened 1 year ago

JohnBerd commented 1 year ago

*Do read files under `lib/` before reporting issues, you can find all the config there, all of them are straightforward.**

Expected Behavior

Text should be in center of the marker

Actual Behavior

Text is at the left

Screenshots

Capture d’écran 2022-11-14 à 21 02 53

Steps to Reproduce the Problem

Create a chart with markers

Specifications

JohnBerd commented 1 year ago

I don't have time at the moment for making a PR, but it seems like values are not declared in the typescript part even they are read in the Swift code, here is my patch. center should be the default value as it is in the Android side.

diff --git a/node_modules/@types/react-native-charts-wrapper/index.d.ts b/node_modules/@types/react-native-charts-wrapper/index.d.ts
index 48e804a..2fcb5a5 100755
--- a/node_modules/@types/react-native-charts-wrapper/index.d.ts
+++ b/node_modules/@types/react-native-charts-wrapper/index.d.ts
@@ -4,7 +4,7 @@
 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

 import { Component } from 'react';
-import { ViewProps, NativeSyntheticEvent, processColor } from 'react-native';
+import { NativeSyntheticEvent, processColor, ViewProps } from 'react-native';

 export type EasingType =
     | 'Linear'
@@ -195,6 +195,7 @@ export interface ChartBase extends ViewProps {
         markerColor?: Color | undefined;
         textColor?: Color | undefined;
         textSize?: number | undefined;
+        textAlign?: 'auto' | 'justify' | 'center' | 'left' | 'right'
     } | undefined;

     highlights?: Array<{

So the marker props can take a textAlign value.