-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add temporal line chart annotations #402
Open
khasinski
wants to merge
8
commits into
ankane:master
Choose a base branch
from
khasinski:add-annotations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
I've added the ability to override colors, even though it requires extending Here is an example of that (to be put in a rails initializer) class CustomAnnotations < Blazer::Annotations
def call(result)
min, max = result.rows.map(&:first).minmax
super + weekends(min, max)
end
private
def weekends(min, max)
(min.to_date..max.to_date).select(&:on_weekend?).each_slice(2).map do |weekend|
{
min_date: weekend[0],
max_date: weekend[1].end_of_day,
label: "", # Empty labels are not rendered
color: "#FAFAFA",
}
end
end
end
Blazer.annotations = CustomAnnotations Results in (notice that it works with existing annotations): |
Annotations are lines and boxes that show up on line charts with time axis. They can be used to mark events and periods.
dd40653
to
7350520
Compare
dgmora
added a commit
to dgmora/blazer
that referenced
this pull request
Feb 16, 2025
# for free
to join this conversation on GitHub.
Already have an account?
# 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.
I'd like to propose an annotations mechanism which allows overlaying data on top of the line charts with a temporal axis.
The main use case is to keep a log of events (whether they are points in time or ranges) and to see the effect of those events on multiple metrics we track in Blazer. A good example would be to track deployments, a marketing campaign duration or holidays and overlay them on top of revenue or visits data.
Here is an example:
blazer.yml
Result

Developed together with @twratajczak
Fixes #403