Skip to content
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

BarChart: Check if there is a series under cursor. #814

Merged
Merged
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 @@ -75,6 +75,7 @@ export class InteractionController extends React.Component<InteractionController
const value = this.getValueFromEvent(x, part);
if (!TimeRange.isTimeRange(value)) return;
const series = this.getSeriesFromEvent(y, part);
if (series === null) return;
const datum = this.findDatumByValue(value);
const hover = createHover(series.plywoodKey(), datum);
const { hover: oldHover } = this.state;
Expand All @@ -94,6 +95,7 @@ export class InteractionController extends React.Component<InteractionController
if (!TimeRange.isTimeRange(value)) return;
this.setState({ hover: null });
const series = this.getSeriesFromEvent(y, part);
if (series === null) return;
const { saveHighlight, model } = this.props;
const { reference } = model.continuousSplit;
const values = List.of(new DateRange(value));
Expand All @@ -117,7 +119,7 @@ export class InteractionController extends React.Component<InteractionController
if (part !== "body") return null;
const { layout: { segment: { height: seriesHeight } }, model: { series } } = this.props;
const index = Math.floor(y / seriesHeight);
return series.get(index);
return series.get(index) || null;
}

interaction(): Interaction | null {
Expand Down