Closed nandorojo closed 3 years ago
Yeah, I think this is a good idea. The at
prop currently is the index of the data (not the timestamp (x) or value (y) values). I guess you would have to approach this from two angles:
at
prop provides – i.e. specifying an index,y
value.To implement both approaches, I think specifying an object to at
like you mentioned may be a good idea. I'm not too fond of creating a breaking change this early in the library, so maybe the interface could look like:
type At = number | { index: number; value?: never } | { index?: never, value: number }
x
to index
to be compatible with the current implementation,y
to value
so it mirrors to the schema of the input data
,LOL wait, dw, just looked at your PR.
Haha yeah I kept the same API to avoid a breaking change.
Looks like we had the same idea with index and value too. That became clear to me once I started coding it.
Currently, the
at
prop forLineChart.HorizontalLine
uses an x value. However, you should be able to set ay
value here instead.Take the case of Robinhood. The horizontal line doesn't correspond to any data point on the chart. Instead, it represents the previous day's trading price. This is important for day-to-day growth comparisons.
What if we amend the
HorizontalLine
'sat
prop to take either anx
or ay
?