Skip to content

Commit

Permalink
only show less then and greater then in legend when values will be ou…
Browse files Browse the repository at this point in the history
…tside of std range
  • Loading branch information
nreese committed Dec 5, 2019
1 parent ccabd81 commit 820888f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ export class StylePropertyLegendRow extends Component {
return !this.props.style.isDynamic() || !this.props.style.isComplete() || !this.props.style.getField().getName();
}

_formatValue = (value, prefix) => {
_formatValue = value => {
if (!this.state.hasLoadedFieldFormatter || !this._fieldValueFormatter || value === EMPTY_VALUE) {
return value;
}

return this.props.style.isFieldMetaEnabled() ? `${prefix} ${this._fieldValueFormatter(value)}` : this._fieldValueFormatter(value);
return this._fieldValueFormatter(value);
}

render() {
Expand All @@ -87,11 +87,18 @@ export class StylePropertyLegendRow extends Component {
}

const header = style.renderHeader();

const min = this._formatValue(_.get(range, 'min', EMPTY_VALUE));
const minLabel = this.props.style.isFieldMetaEnabled() && range && range.isMinOutsideStdRange ? `< ${min}` : min;

const max = this._formatValue(_.get(range, 'max', EMPTY_VALUE));
const maxLabel = this.props.style.isFieldMetaEnabled() && range && range.isMaxOutsideStdRange ? `> ${max}` : max;

return (
<StyleLegendRow
header={header}
minLabel={this._formatValue(_.get(range, 'min', EMPTY_VALUE), '<')}
maxLabel={this._formatValue(_.get(range, 'max', EMPTY_VALUE), '>')}
minLabel={minLabel}
maxLabel={maxLabel}
propertyLabel={getVectorStyleLabel(style.getStyleName())}
fieldLabel={this.state.label}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ export class VectorStyle extends AbstractStyle {
min,
max,
delta: max - min,
isMinOutsideStdRange: stats.min < stdLowerBounds,
isMaxOutsideStdRange: stats.max > stdUpperBounds,
};
}
}
Expand Down

0 comments on commit 820888f

Please sign in to comment.