-
Notifications
You must be signed in to change notification settings - Fork 32
Gradient Coloring Option for Feature Metadata #484
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
base: master
Are you sure you want to change the base?
Changes from 22 commits
61f49b2
1f26583
dd2cfe6
20b369a
6172f36
a3a1fe4
3a69861
ca591ba
86ef3cf
f2920c5
a4052df
84d5b4a
8836260
1431e2c
743a32e
a90871c
305aa47
d5426f6
bf3f5fd
aba2aa7
942f5b0
9bd5961
6033e11
1472ee4
25ac9bd
0add7c7
8206de8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,14 +179,15 @@ define(["jquery", "underscore", "util"], function ($, _, util) { | |
| "svg" | ||
| ); | ||
| containerSVG.setAttribute("width", "100%"); | ||
| containerSVG.setAttribute("height", "100%"); | ||
| containerSVG.setAttribute("height", "80%"); | ||
|
kwcantrell marked this conversation as resolved.
|
||
| containerSVG.setAttribute("style", "display: block; margin: auto;"); | ||
| // just kinda plop the combined SVG code into containerSVG's HTML | ||
| containerSVG.innerHTML = totalHTMLSVG; | ||
| this._container.appendChild(containerSVG); | ||
| if (this._missingNonNumericWarningShown) { | ||
| var missingText = this.getMissingNonNumericWarning(); | ||
| var warningP = document.createElement("p"); | ||
| warningP.innerText = Legend.CONTINUOUS_MISSING_NON_NUMERIC_WARNING; | ||
| warningP.innerText = missingText.full; | ||
| warningP.classList.add("side-panel-notes"); | ||
| // All legends have white-space: nowrap; set to prevent color | ||
| // labels from breaking onto the next line (which would look | ||
|
|
@@ -542,6 +543,7 @@ define(["jquery", "underscore", "util"], function ($, _, util) { | |
| // But first, let's add a warning about missing / non-numeric values if | ||
| // needed. | ||
| if (this._missingNonNumericWarningShown) { | ||
| var missingText = this.getMissingNonNumericWarning(); | ||
| // We use a hanging baseline to add some extra vertical space | ||
| // between the gradient minimum value and the warning text. This | ||
| // seems to look nice. | ||
|
|
@@ -551,9 +553,9 @@ define(["jquery", "underscore", "util"], function ($, _, util) { | |
| '" y="' + | ||
| (gradientTopY + gradientHeight + Legend.HALF_LINE_HEIGHT) + | ||
| '" dominant-baseline="hanging">' + | ||
| Legend.CONTINUOUS_MISSING_NON_NUMERIC_WARNING_SHORT + | ||
| missingText.short + | ||
| "</text>\n"; | ||
| texts.push(Legend.CONTINUOUS_MISSING_NON_NUMERIC_WARNING_SHORT); | ||
| texts.push(missingText.short); | ||
| } | ||
| _.each(texts, function (text) { | ||
| maxLineWidth = Math.max( | ||
|
|
@@ -742,6 +744,28 @@ define(["jquery", "underscore", "util"], function ($, _, util) { | |
| }; | ||
| }; | ||
|
|
||
| Legend.prototype.setMissingNonNumericWarning = function ( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works -- and I'm OK with merging it in as is, as long as the other changes I've suggested here are addressed -- but I think we could probably structure this code more clearly. To me, it is confusing that the I propose we restructure this so that the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, this was a fairly lazy solution. The goal was to modify the existing code as little as possible hence why it defaults to the barplot messages.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of adding a special parameter, I will make Legend an abstract class and add SampleFeatureColoringLegend and BarplotLegend that will inherit it. This will also make it a lot easier to change the behavior of the different legend types. |
||
| full, | ||
| short = null | ||
| ) { | ||
| this.continuousMissingNonNumericWarning = full; | ||
| this.continuousMissingNonNumericWarningShort = short; | ||
| }; | ||
|
|
||
| Legend.prototype.getMissingNonNumericWarning = function () { | ||
| var missingText = { | ||
| full: Legend.CONTINUOUS_MISSING_NON_NUMERIC_WARNING, | ||
| short: Legend.CONTINUOUS_MISSING_NON_NUMERIC_WARNING_SHORT, | ||
| }; | ||
| if (this.hasOwnProperty("continuousMissingNonNumericWarning")) { | ||
| missingText.full = this.continuousMissingNonNumericWarning; | ||
| } | ||
| if (this.hasOwnProperty("continuousMissingNonNumericWarningShort")) { | ||
| missingText.short = this.continuousMissingNonNumericWarningShort; | ||
| } | ||
| return missingText; | ||
| }; | ||
|
|
||
| // Shown at the bottom of continuous legends in the page when some values | ||
| // in a continuous field can't be represented on a gradient | ||
| Legend.CONTINUOUS_MISSING_NON_NUMERIC_WARNING = | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.