Added multi-pointer support to Line and Area Charts

This commit is contained in:
Abhinandan-Kushwaha 2022-04-24 17:36:22 +05:30
parent 41c5919874
commit 9b76a74fc5
3 changed files with 37 additions and 5 deletions

28
App.js
View File

@ -670,6 +670,19 @@ const App = () => {
{value: -6, label: 'Wed'}, {value: -6, label: 'Wed'},
{value: 30, label: 'Thu'}, {value: 30, label: 'Thu'},
]; ];
const barData3 = [
{
value: 15,
label: 'Mon',
},
{value: 10, label: 'Tue'},
{value: -3, label: 'Wed'},
{value: 20, label: 'Thu'},
{value: -6, label: 'Wed'},
{value: 20, label: 'Thu'},
{value: -6, label: 'Wed'},
{value: 20, label: 'Thu'},
];
const sdata = [ const sdata = [
{ {
@ -1229,7 +1242,13 @@ const App = () => {
<LineChart <LineChart
// width={200} // width={200}
// height={300} // height={300}
pointerConfig={{}} pointerConfig={{
activatePointersOnLongPress: true,
pointerColor: 'green',
pointer3Color: 'red',
pointer2Color: 'orange',
hidePointer2: true,
}}
// isAnimated // isAnimated
// rotateLabel // rotateLabel
// barWidth={32} // barWidth={32}
@ -1240,9 +1259,12 @@ const App = () => {
// data2={lineData2} // data2={lineData2}
data={barData} data={barData}
data2={barData2} data2={barData2}
data3={barData3}
hideDataPoints hideDataPoints
color2='red' color2="red"
// curved color3="green"
thickness3={3}
curved
// initialSpacing={90} // initialSpacing={90}
// stackData={stackData} // stackData={stackData}
// horizontal // horizontal

View File

@ -276,7 +276,12 @@ type Pointer = {
height?: number; // default: 0 height?: number; // default: 0
width?: number; // default: 0 width?: number; // default: 0
radius?: number; // default: 5 radius?: number; // default: 5
color?: ColorValue; // default: 'red' pointerColor?: ColorValue; // default: 'red
pointer1Color?: ColorValue; // default: 'red
pointer2Color?: ColorValue; // default: 'red
pointer3Color?: ColorValue; // default: 'red
pointer4Color?: ColorValue; // default: 'red
pointer5Color?: ColorValue; // default: 'red
pointerComponent?: Function; // default: null pointerComponent?: Function; // default: null
showPointerStrip?: boolean; // default: true showPointerStrip?: boolean; // default: true
pointerStripWidth?: number; // default: containerHeight pointerStripWidth?: number; // default: containerHeight
@ -290,6 +295,11 @@ type Pointer = {
pointerVanishDelay?: number; // default: 150 pointerVanishDelay?: number; // default: 150
activatePointersOnLongPress?: boolean; // default: false activatePointersOnLongPress?: boolean; // default: false
activatePointersDelay?: number; // default: 150 activatePointersDelay?: number; // default: 150
hidePointer1?: boolean; // default: false
hidePointer2?: boolean; // default: false
hidePointer3?: boolean; // default: false
hidePointer4?: boolean; // default: false
hidePointer5?: boolean; // default: false
}; };
``` ```

View File

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