Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ const NOT_VISIBLE_COLOR = 'gainsboro';
type LegendProps = LegendOptions & {
series: TimeSeries[];
linesOptions?: LinesOptions;
onClickItem?: (sr: TimeSeries, idx: number) => void;
onPressItem?: (sr: TimeSeries, idx: number) => void;
};
function Legend({
series,
linesOptions,
onClickItem,
onPressItem,

enabled = true,

Expand Down Expand Up @@ -68,7 +68,7 @@ function Legend({
paddingBottom: itemPaddingBottom ?? itemPadding ?? 2,
},
]}
onPress={() => onClickItem?.(sr, i)}
onPress={() => onPressItem?.(sr, i)}
>
<View
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function LineChart({

const loaded = xScale !== null && yScale !== null && lineFunc !== null;

const onClickLegendItem = (sr: TimeSeries, idx: number) => {
const onPressLegendItem = (sr: TimeSeries, idx: number) => {
setState(dr => {
dr.series = dr.series.map((sr, i) =>
i !== idx ? sr : { ...sr, visible: !sr.visible }
Expand Down Expand Up @@ -114,7 +114,7 @@ function LineChart({
<Legend
series={state.series}
linesOptions={linesOptions}
onClickItem={onClickLegendItem}
onPressItem={onPressLegendItem}
{...legendOptions}
/>
</View>
Expand Down