-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow the user to create bar charts in the DAD #130
Conversation
fobi_custom/plugins/form_elements/fields/intercept/own_or_rent/fobi_form_elements.py
Show resolved
Hide resolved
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.
Very fun to play with this, and this PR accomplishes a lot! A couple comments big and small below.
# the UIDs of Fobi form elements that can sensibly be turned into charts. | ||
|
||
# "Count" types represent a single numeric value, and will be displayed as a median. | ||
COUNT_TYPES = [ |
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 made a float field and submitted 3 values:
Here's the chart it made me:
What I'd expect to see here is a chart with an X axis of response values and a Y axis of how many times that response was submitted. Is there any case where an integer question would show anything other than a bar chart with a single bar? The single median value doesn't do much as a bar chart for me, and would be better displayed as a single number.
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.
The use case I'm thinking of here is specifically one where the user wants to compare the median of a survey to the medians of past surveys (not currently possible, but planned in #102). In that case, the chart would show a series of bars that are comparable.
Showing the count of each response seems dangerous to me since it's basically a free-response question and we could wind up with hundreds of slightly different responses. A variation of that approach might be to bin the data in some way and compare distributions, but then we'd have to know up front what the bins are, or bin them by e.g. quantiles and risking having quantiles that don't make sense if the data are very close together.
This seems like a case where a box plot could be a good compromise: in the single-survey case it would at least give a sense of the distribution of the answers, and in the multiple-survey case it would allow for more detailed comparisons. What do you think?
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.
All makes sense! I can't quite picture the UI for #102 yet, but I'm comfortable leaving this question open until you get to that issue. For single surveys a box or scatter plot makes sense to me.
d33c671
to
7098a0c
Compare
@beamalsky I believe I addressed all your comments -- once tests pass, this should be ready for a second look! |
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.
78549e9
to
cbab07b
Compare
Overview
Closes #96, closes #97
Add logic for displaying bar charts for surveys in the data analysis designer.
Demo
Notes
There's officially enough data processing logic in the DAD (particularly in
charts.js
) that it would make sense for us to have tests. I didn't want to have to add the task of configuring a whole JavaScript test runner to the scope of this PR, so I opened up #131 instead.Testing Instructions
gender_observational
)Collected data
view, try making charts for each question type and confirm that they look right