-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a way to show both primary and secondary data on the tooltip #388
Comments
Hi @1mike12 👋 The
If the chart has secondaryData, the parameter Here's an example showing how to use the pointerConfig={{
pointerLabelComponent: (items,secondaryItem) => {
return (
<View
style={{
height: 120,
width: 100,
backgroundColor: '#282C3E',
borderRadius: 4,
justifyContent: 'center',
paddingLeft: 16,
}}>
<Text style={{color: 'lightgray', fontSize: 12}}>{2018}</Text>
<Text style={{color: 'white', fontWeight: 'bold'}}>
{items[0].value}
</Text>
<Text style={{color: 'lightgray', fontSize: 12, marginTop: 12}}>
{2019}
</Text>
<Text style={{color: 'white', fontWeight: 'bold'}}>
{secondaryItem.value}
</Text>
</View>
);
},
}} |
@Abhinandan-Kushwaha thanks for the quick response, I actually can't seem to get this working. I keep receiving undefined from the chart that I pasted above. The secondary line renders, but the label will crash the app since trying to access The other thing is that while trying to debug your changes and see what was happening, the entire chart stopped working for me because I receive the error.
Was everything working on your end? |
Never mind I wiped out the app and reinstalled a 2nd time and everything worked again. 🤷 just RN things. |
Describe the bug
Not really a bug, more a question / feature request.
pointerLabelComponent
exposes an array of datapoints I'm assuming indexed on each of the data arrays. But the data passed tosecondaryData
is not availableExpected behavior
I have a chart that shows depth on the main Y axis and a secondary Y on the right that will show arbitrary data, in this case, air pressure. It would be nice to be able to show both when hovering on the tooltip.
Screenshots
If applicable, add screenshots to help explain your problem.
The text was updated successfully, but these errors were encountered: