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
Generator for discontinuous datestamped data #43
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This generator is used when you want to plot non-continuous datestamped data. For example, you might have data spanning three weeks, but you're missing data for the weekends, and you want to express that those data points are missing. If a queryset doesn't have a value for a particular date, then this generator yields a 'null'.
Natim
reviewed
Jun 6, 2019
Interesting work. Do you mind adding and example of how to use it as well as a couple of tests? |
Thanks! Will do. |
The docstring suggests that colors.next_color() should return a list, and that the internal `step` variable should be initialized to 0, rather than 1.
Since this feature utilizes data from a QuerySet, I needed to generate a fixture, and then load that into the database in order to implement a demo. To do this, I modified the Makefile with two extra commands.
cjohnson318
commented
Jun 6, 2019
cjohnson318
commented
Jun 6, 2019
Natim
reviewed
Jun 7, 2019
Natim
reviewed
Jun 7, 2019
Makefile
Outdated
.PHONY: demo | ||
demo-test: | ||
test -d demo/venv || virtualenv demo/venv | ||
demo/venv/bin/pip install -e demo |
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 is how you can fix your import hack.
Suggested change
demo/venv/bin/pip install -e demo | |
demo/venv/bin/pip install -e . demo |
Natim
reviewed
Jun 7, 2019
Natim
reviewed
Jun 7, 2019
Natim
reviewed
Jun 7, 2019
Thank you for your work on this, I am merging. |
Released in django-chartjs 1.4.0 |
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This generator is used when you want to plot non-continuous date-stamped data from a Django QuerySet. For example, you might have data spanning three weeks, but you're missing data for the weekends, and you want to express that those data points are missing.
In order to use this generator you would provide the start and end dates as either
datetime.date
objects, or strings with the formatyyyy-mm-dd
, the QuerySet of the model you're using, the name of the date attribute of the model, and the name of the value attribute of the model that you're interested in. If the QuerySet doesn't have a value for a particular date, then this generator yields a 'null'.