patrykandpatrick / vico

A light and extensible chart library for Android.
https://patrykandpatrick.com/vico/wiki
Apache License 2.0
2.07k stars 125 forks source link

Cant get Data form chartValues when Market Clicked - v2.0.0-alpha.28 #854

Closed keyvanNorouzi closed 3 weeks ago

keyvanNorouzi commented 3 weeks ago

How to reproduce

val labelFormatter: CartesianMarkerValueFormatter =
    CartesianMarkerValueFormatter { context, targets -> 

// want x from chart value formater to show in market popup context.chartValues.model.extraStore.getOrNull(ExtraStore.Key<List>()) }

it gets null

Observed behavior

get null from market value formater

Expected behavior

get X value from chart formater

Vico version(s)

2.0.0-alpha.27

Android version(s)

14

Additional information

if I use Gson().toJson(context.chartValues.model.extraStore) I cant see data in Json format, but I cant get data from cahrtValues

Gowsky commented 3 weeks ago

Hi @keyvanNorouzi. You can't create an ExtraStore.Key instance at the ExtraStore.getOrNull function call, as it will never work. Keys are compared by instance. You can learn more about the keys in the wiki.

Gowsky commented 3 weeks ago

Also, you don't need ExtraStore to obtain the information about marked entries. Information on the marked entries is in targets.