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

Make brush send events #5663

Merged
merged 3 commits into from
Aug 22, 2018
Merged

Make brush send events #5663

merged 3 commits into from
Aug 22, 2018

Conversation

betodealmeida
Copy link
Member

I added a new option to time series, allowing the time brush (range filter) to send the selection to other charts:

screen shot 2018-08-17 at 2 51 12 pm

Demo:

brush_events_dashboard

@@ -179,7 +179,7 @@ export const visTypes = {
expanded: true,
controlSetRows: [
['color_scheme'],
['show_brush', 'show_legend'],
['show_brush', 'send_time_range', 'show_legend'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we rarely use 3 elements in the same row, but I think it works in this case:

screen shot 2018-08-17 at 2 51 12 pm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkboxes tend to look bad when combined to other controls, I'm not sure how to fix that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you convert Show Range Filter into another checkbox?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kristw Show Range Filter has yes|no|auto options ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. I see. Thanks @mistercrunch
I would recommend having both checkboxes on another line then.

@@ -363,6 +363,13 @@ export default function nvd3Vis(slice, payload) {
throw new Error('Unrecognized visualization for nvd3' + vizType);
}

if (isTruthy(fd.show_brush) && isTruthy(fd.send_time_range)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: I've seen !!foo used in places as an isTruthy not sure if there are pros/cons but we should aim at consistency throughout the codebase. Not sure if eslint rules may exist for this. @williaster what you think?

@@ -363,6 +363,13 @@ export default function nvd3Vis(slice, payload) {
throw new Error('Unrecognized visualization for nvd3' + vizType);
}

if (isTruthy(fd.show_brush) && isTruthy(fd.send_time_range)) {
chart.focus.dispatch.on('brush', (event) => {
const timeRange = event.extent.map(d => d.toISOString().slice(0, -1)).join(' : ');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would raise if we ever supported focus on non-time xAxis. Can we make sure that d is a date as a condition to trigger the event?

@codecov-io
Copy link

codecov-io commented Aug 18, 2018

Codecov Report

Merging #5663 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5663      +/-   ##
==========================================
- Coverage   63.49%   63.48%   -0.02%     
==========================================
  Files         360      360              
  Lines       22889    22895       +6     
  Branches     2549     2551       +2     
==========================================
  Hits        14534    14534              
- Misses       8340     8346       +6     
  Partials       15       15
Impacted Files Coverage Δ
superset/assets/src/explore/visTypes.jsx 57.14% <ø> (ø) ⬆️
superset/assets/src/explore/controls.jsx 45.92% <ø> (ø) ⬆️
superset/assets/src/visualizations/nvd3_vis.js 8.83% <0%> (-0.11%) ⬇️
.../assets/src/SqlLab/components/TabbedSqlEditors.jsx 90.99% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a4b70d...f0ce40b. Read the comment docs.

if (extent.some(d => d.toISOString === undefined)) {
return;
}
const timeRange = extent.map(d => d.toISOString().slice(0, -1)).join(' : ');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make sure d is a date here as we may support non-date xAxis in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check that in line 369, by looking for the existence of the toISOString method.

@mistercrunch mistercrunch merged commit 2a8cd43 into apache:master Aug 22, 2018
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Aug 22, 2018
* Make brush send events

* Make sure object is date

* Send event only on brushend

(cherry picked from commit 2a8cd43)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Aug 22, 2018
* Make brush send events

* Make sure object is date

* Send event only on brushend

(cherry picked from commit 2a8cd43)
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
* Make brush send events

* Make sure object is date

* Send event only on brushend
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants