-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add 'click' functionality for Chart visualization #5662
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this out and it works quite well. Left a few comments for you.
Overall, can we make the link template to work like HTML links in the table visualisation? Although @@x1
works, it's more natural to use {{ column_name }}
.
This is especially true because hovering over the chart doesn't display a preview of the URL that will be visited. Thoughts?
I haven't found a reliable way to get value by column_name at the event handler point. (( |
Co-authored-by: Jesse <[email protected]>
First check finished with error had found something not related to the pull request changes. |
@ufedor , thanks for the PR! We've updated a lot of things now that we're Community-driven so - if you're still interested in getting this merged - would you mind rebasing off master to re-run the CI? We're trying to clean up our PR todo list, so if you're not interested, that's fine - we'll close the PR in about a week if we don't hear back. If you're interested in reopening the PR afterwards, we would also very much welcome that. |
Codecov Report
@@ Coverage Diff @@
## master #5662 +/- ##
==========================================
+ Coverage 60.77% 60.84% +0.06%
==========================================
Files 154 155 +1
Lines 12656 12714 +58
Branches 1721 1728 +7
==========================================
+ Hits 7692 7736 +44
- Misses 4739 4750 +11
- Partials 225 228 +3 |
@eradman @gabrieldutra Would either of you be up for reviewing this one? It's been rebased, and is passing our CI tests. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to work nicely.
This adds two new keys in visualization.options
enableLink
(bool)linkFormat
(text)
Look into adding viz-lib tests
Hi guys. Is there anything else I can help with? |
@ufedor Cool. Yep, there is. Eric has reviewed this PR and asked about a few adjustments. When you have time, please look over those and update things or discuss them further as makes sense. 😄 |
Hi guys. |
Looking at the test failures, at least some of them seem quite important to fix. For example, looking at the "backend-unit-tests" one, it has this:
That "no such file or directory" seems pretty weird though. Maybe it was a bad install during the test run? I'll re-run the failed tests, so we can hopefully figure out if it was just some weirdness with that test run, or if it was indeed showing a real problem. 😄 |
Hmmm, that test failure doesn't appear to be caused by this PR. Looks like it's coming from something else. Investigating... |
k. Fixed that failure that was causing our CI tests to fail for everyone. So, lets see what happens with the CI tests here now... 😄 |
CI tests are all passing after all. 😄 @eradman What do you reckon? |
@ufedor take a look at I don't think this needs extensive automated testing, but there should be a test that toggles the feature. |
Making link functionality disabled by default. Resolving comment https://github.com/getredash/redash/pull/5662/files/f05644e57cf950ab6449b14601efa48d2c0dd2ed#diff-01e68125197aba70fd7f2515976d9a4aadeb04c9056ee4f24da51d07e40c4a23
Change data-test values for "Enable click events" checkboxes to be more readable
Add check-on test for Chart.EnableClickEvents checkbox
@eradman , thank you for hint. |
@ufedor looks good overall, but one test failure to investigate |
Please help me to update test snapshot to pass frontend-unit tests... |
I'll look into this a bit later. This test is not failing for me locally. |
It looks like my local tests pass because Adding this regenerated file to this PR should fix the frontend test failure. |
All good! |
What type of PR is this? (check all applicable)
Description
I've added a small improvement: click event reaction for Chart visualiztion, opening template-based url with clicked point data substitutions. All the work is done by adding regular 'plotly_click' event handler.
It can be configured from the Visualization Editor. At the bottom of General tab I've added next additional params:
URL template
Every curve can be referenced using {{ @@x1 }} {{ @@y1 }} {{ @@x2 }} {{ @@y2 }} ... syntax:
axis with any curve number according to the Series config.
The first met curve X and Y values can be referenced by just{{ @@x }} {{ @@y }} syntax.
Any unresolved reference would be replaced with an empty string.
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)