react-native-graph icon indicating copy to clipboard operation
react-native-graph copied to clipboard

Can't import AxisLabel

Open davydspotnana opened this issue 3 years ago • 3 comments

Thanks for this module, animation works very well!

Can you also add an AxisLabel component, that you mention in a README file?

davydspotnana avatar Apr 30 '22 20:04 davydspotnana

This might help you, so you can create your own: https://github.com/margelo/react-native-graph/issues/3

skeie avatar May 01 '22 10:05 skeie

@skeie : Can you show the code of how you created your label?

Angelk90 avatar May 06 '22 13:05 Angelk90

Something like this @Angelk90 :

function AxisLabel() {
    const x =
        (INDEX_OF_YOUR_MAX_OR_MIN_VALUE / LENGTH_OF_YOUR_POINTS_ARRAY) *
        GRAPH_WIDTH;

    return (
        <View style={{ transform: [{ translateX: Math.max(x - 22, 5) }] }}>
            <Text color='darkPurple'>
                {YOUR_MAX_OR_MIN_VALUE}
            </Text>
        </View>
    );
}

skeie avatar May 14 '22 07:05 skeie

Will close this, as the example from @skeie should be enough to make it work :)

chrispader avatar Sep 12 '22 16:09 chrispader