-
Notifications
You must be signed in to change notification settings - Fork 122
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
fix(heatmap): compute nice legend items from color scale #1273
Merged
markov00
merged 17 commits into
elastic:master
from
markov00:2021_07_28-heatmap_fix_legend
Aug 16, 2021
Merged
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
1131677
fix(heatmap): correct legend items
markov00 6640781
Merge branch 'master' into 2021_07_28-heatmap_fix_legend
markov00 8b6fdc9
Merge remote-tracking branch 'upstream/master' into 2021_07_28-heatma…
markov00 487e63f
test: add vrts
markov00 61b1dd2
fix: dedup legend ticks based on formatted labels
markov00 6b4f627
test: update VRT with removed duplicate
markov00 e500773
refactor: cleanup visibility implementation
markov00 0d1053e
refactor: cleanup domain and colors objects codes
markov00 494d41f
refactor: rename color scale ticks to start bands
markov00 a5e571a
Merge branch 'master' into 2021_07_28-heatmap_fix_legend
markov00 4f650bb
Merge branch 'master' into 2021_07_28-heatmap_fix_legend
markov00 f19f14b
fix: replace >= sign and minor fixes
markov00 a70509f
Merge branch 'master' into 2021_07_28-heatmap_fix_legend
markov00 4228efc
refactor: improved code readibility
markov00 53c27fe
Merge branch '2021_07_28-heatmap_fix_legend' of github.com:markov00/e…
markov00 783d463
refactor: refactor band array to colorThresholds
markov00 d113aa3
Merge branch 'master' into 2021_07_28-heatmap_fix_legend
markov00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file modified
BIN
+68 Bytes
(100%)
...ual-tests-for-all-stories-heatmap-alpha-basic-visually-looks-correct-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-74.3 KB
(42%)
...sts-for-all-stories-heatmap-alpha-categorical-visually-looks-correct-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+53.7 KB
...tests/__image_snapshots__/heatmap-test-ts-heatmap-color-scale-linear-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.8 KB
...sts/__image_snapshots__/heatmap-test-ts-heatmap-color-scale-quantile-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.9 KB
...sts/__image_snapshots__/heatmap-test-ts-heatmap-color-scale-quantize-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40 KB
...ts/__image_snapshots__/heatmap-test-ts-heatmap-color-scale-threshold-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { common } from '../page_objects/common'; | ||
|
||
describe('Heatmap color scale', () => { | ||
it('quantile', async () => { | ||
await common.expectChartAtUrlToMatchScreenshot( | ||
'http://localhost:9001/?path=/story/heatmap-alpha--categorical&globals=backgrounds.value:transparent;themes.value:Light&knob-color scale=quantile&knob-ranges=auto&knob-colors=green, yellow, red', | ||
); | ||
}); | ||
it('quantize', async () => { | ||
await common.expectChartAtUrlToMatchScreenshot( | ||
'http://localhost:9001/?path=/story/heatmap-alpha--categorical&globals=backgrounds.value:transparent;themes.value:Light&knob-color scale=quantize&knob-ranges=auto&knob-colors=green, yellow, red', | ||
); | ||
}); | ||
it('threshold', async () => { | ||
await common.expectChartAtUrlToMatchScreenshot( | ||
'http://localhost:9001/?path=/story/heatmap-alpha--categorical&globals=backgrounds.value:transparent;themes.value:Light&knob-color scale=threshold&knob-ranges=10000, 40000&knob-colors=green, yellow, red', | ||
); | ||
}); | ||
|
||
it('linear', async () => { | ||
await common.expectChartAtUrlToMatchScreenshot( | ||
'http://localhost:9001/?path=/story/heatmap-alpha--categorical&globals=backgrounds.value:transparent;themes.value:Light&knob-color scale=linear&knob-ranges=0, 10000, 25000, 50000, 100000&knob-colors=green, yellow, red, purple', | ||
); | ||
}); | ||
}); |
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 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 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 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 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 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
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.
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.
Minor: this to me would be an easier read:
Also, should it be named
hasFilteredValue
or some such?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 semantics of it suggests that it returns true if at least one value falls within min/max (or min/Infinity), so maybe,
hasKeptValue
orhasRetainedValue
is a better name. Words like keep/retain or eliminate are less ambiguous than filter; I never know if filtering refers to the kept part or the eliminated part 😄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 robert, this looks way batter e500773
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.
Nice change, thanks! Minor (not worth a change unless you're planning further pushes anyway):
visibilityFilterRanges
is a bit long and doesn't give away its secret, may it be shorter/clearer? Not 100% sure of the meaning, something likevisibleRanges
orshownRanges
orrangesToShow
?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.
To clarify,
visibilityFilterRanges
doesn't tell if what's inside are included or the opposite, eliminated. Unfortunately, the wordfilter
is vague about what's kept and what's shed. It doesn't help that there's some compounding of name ambiguity, eg. what does "deselected" mean indeselectedTicks
anddeselectedDataSeries
, deselected from what?Maybe eventually these words could be positive, ie. a list of selected/retained ticks rather than exclusions. Also,
ON_TOGGLE_SERIES_VISIBILITY
(or whatever the meaning) instead ofON_TOGGLE_DESELECT_SERIES
; avoidance of a negative, and more meaning than "select"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.
You are right Robert, I've revisited the code, and correct the naming 4228efc
I've looked more into the details and the naming was also flipped.
The
deselected...
is another story and we can chat about that in the future.