-
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
Histogram #4426
base: master
Are you sure you want to change the base?
Histogram #4426
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.
Thanks, @deecay! I'm sure this will make some people very happy :-)
Considering this is less likely to be used alongside other chart types, how about we create a dedicated visualization type for it with its own settings tab? I think it will reduce confusion on how to use it and what are the options that are available.
Could you advise what level of separation from chart visualization is necessary? For example, I have added |
@arikfr Why do you think that histogram series cannot be used with other series types? Brief googling found pictures like this one: |
@kravets-levko it looks like a line representation of the histogram. Can you think of a real use case? @deecay do you have a use case for mixing them? |
@arikfr The curved line over histograms are density curves, which is a fairly common companion of the bar-histogram. The curve is a different representation of the same data set. I can't think of any other chart type mix to be honest. |
The most important part is to have a dedicated interface for the Histogram visualization. The implementation can still share code with charts if it makes sense and/or makes code simpler. |
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.
Hi @deecay! Can you please resolve conflicts - I'd like to review it once more, and I guess we'll merge it. Thanks!
Resolved conflict and incorporated your point on utility function. One thing I could not resolve is the issue around automatic update of the BinSize and BinStart. When an input value for these two inputs gets deleted in the editor, it should redraw the chart with default value but it doesn't. I've played around with debounce but I couldn't get it to work. Any help would be welcomed. |
Thank you @deecay! I'll check the issue with inputs, hope there's nothing serious. One more thing I'd like to revive in this discussion - having a new Histogram visualization vs. Histogram chart type (within existing Chart viz) - what's your point on this? |
On chart types: Ideally, we could refactor the code so that adding a new plotly-based visualization can be done with relatively small effort, avoiding duplicate code. This PR, the existing Chart viz method, has just +100 lines of code, with almost no duplicate code. So this is my preferred method for now. If you could show me and example and/or mentor me, I might be able to see things differently. Eager to hear your thoughts. |
placeholder="Auto" | ||
data-test="Chart.XAxis.BinSize" | ||
defaultValue={options.binSize} | ||
onChange={binSize => onOptionsChange({ binSize: cleanNumber(binSize) })} |
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.
@kravets-levko using toNumber() from AxisSettings resolves the non-updating issue mentioned earlier. Should I move the toNumber function as a common function and use it here?
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.
yes, sounds good
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.
Done in f1a8fe6
This feature is so close to completion, I can feel it. :) |
Any ETA on this? |
Currently only merging fixes directly related to the V10 beta. We will pipeline this for merge after the V10 release next month. |
Any updates on this |
would be great if this would make it into a release! |
Thanks for the ping! Will aim to merge and include this in V11 this summer. |
@susodapop Any news on this PR? This would be a great feature |
@susodapop yeah just wanted to bump this too! |
Bump. This feature would be very useful. |
@deecay , 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, as well as updating merge conflicts? 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. |
Yeah, this looks like it'd be really useful. Hopefully it gets rebased. 😄 |
@deecay do you have time to rebase this change? There are quite a few conflicts, but all of them appear to be easy to resolve |
Codecov Report
@@ Coverage Diff @@
## master #4426 +/- ##
==========================================
+ Coverage 61.07% 61.10% +0.03%
==========================================
Files 157 158 +1
Lines 12834 12883 +49
Branches 1747 1753 +6
==========================================
+ Hits 7838 7872 +34
- Misses 4755 4765 +10
- Partials 241 246 +5 |
@guidopetri @justinclift |
Awesome! 😄 @eradman Any interest in reviewing this PR? |
Yes, I'll take this change for a test drive |
I ran into some trouble with larger data sets on Chrome and Firefox. With as few as 500 entries both browsers would spin at 90% CPU for several minutes. Now that I spent some time with this I feel that the "binning" function should be more generic. In SQL we can bin values in may ways. For example this bins by powers of 2 WITH series AS (
SELECT
power(2, series-1)::int AS lo,
power(2, series)::int AS hi
FROM generate_series(0, 10) AS series
)
SELECT count(files), lo || '-' || hi AS range
FROM dir_stats
JOIN series ON (files >= series.lo AND files < series.hi)
GROUP BY series, lo, hi
ORDER BY lo This could be easily adapted to date ranges, range categories, and so on. A bar chart works fine, except that I do not believe that Redash supports multiple series per graph yet, so perhaps this is the feature we should focus on. Secondarily, binning options could be added, but I feel that would be somewhat complicated to support multiple scales and data types. |
Does the CPU spin for test deployed instance too? (2000 entries) |
I seem to have no trouble with that demo. I'll try rebuilding my dev environment to see if this is repeatable |
Tried cleaning my test env ( What do the rest of you think? My thoughts:
|
I think it is. And I think I've found the reason for the high CPU usage. This problem happens when the X-axis data is specified as, or looks like, a date. In these cases plotly treats x-axis as I will look into what I can do with date binning. (your thought #3) |
I have added some features.
|
@eradman @justinclift Could you review it please? |
What type of PR is this? (check all applicable)
Description
New visualization: Histogram by Plotly
No tests ready yet.
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
Example1: https://deploy-preview-4426--redash-preview.netlify.com/queries/270#493
Example2: https://deploy-preview-4426--redash-preview.netlify.app/queries/224#955