-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Maps] Remove client-side scaling of ordinal values #58528
[Maps] Remove client-side scaling of ordinal values #58528
Conversation
Pinging @elastic/kibana-gis (Team:Geo) |
x-pack/legacy/plugins/maps/public/layers/styles/color_utils.test.js
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_size_property.js
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_size_property.js
Show resolved
Hide resolved
@@ -34,22 +34,6 @@ export function isOnlySingleFeatureType(featureType, supportedFeatures, hasFeatu | |||
}, true); | |||
} | |||
|
|||
export function scaleValue(value, range) { |
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.
I still think we need to preserve this logic and snap NaN values to less then min so they have the same behavior and do not cause errors. Also, snapping values less then min and over max need to be preserved. When using aggregations to fetch min/max, there will be values greater than and less then min/max
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, agreed.
After discussion, we're moving this clamping to the actual mb-expression. This way, we do not need to retain this separate scaleValue
code-path. It has following template:
['max', ['min', ['to-number', [lookupFunction, fieldName]], maxValue], minValue], |
x-pack/legacy/plugins/maps/public/layers/styles/heatmap/heatmap_style.js
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/maps/public/layers/styles/heatmap/heatmap_style.js
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/maps/public/layers/styles/heatmap/heatmap_style.js
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_color_property.js
Outdated
Show resolved
Hide resolved
Here is an example data set to highlight the problem
On Master, the fill color is transparent with no value. That is the documented behavior for missing values. In this branch, fill color is incorrectly placed in middle of ramp, because zero is in the middle of 1 and -1, when there is no value. |
thx @nreese that example will be super helpful to work on resolving this. |
x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_style_property.js
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_color_property.js
Show resolved
Hide resolved
x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.js
Outdated
Show resolved
Hide resolved
…ck/kibana into maps/remove_ordinal_scaling
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 a great improvement and gets us one step closer to using vector tiles to display _search results. Thanks
lgtm
code review, tested in chrome
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Will wait to backport to 7.x until 7.7 branch is cut. This PR has no direct user impact, and there is no reason to merge this to a released branch without actual end-user benefits. |
This removes the rescaling of ordinal values to the [0,1] domain, and modifies the creation of the mapbox-style rules to use the actual RangeStyleMeta-data. This is an important prerequisite for Maps handling tile vector sources. For these sources, Maps does not have access to the raw underlying GeoJson and needs to use the stylemeta directly.
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
backport to 7.x: #61344 |
This removes the rescaling of ordinal values to the [0,1] domain, and modifies the creation of the mapbox-style rules to use the actual RangeStyleMeta-data. This is an important prerequisite for Maps handling tile vector sources. For these sources, Maps does not have access to the raw underlying GeoJson and needs to use the stylemeta directly.
Since 7.6, styles have access to the actual min-max for numerical values. Client-side scaling to the [0-1] range is no longer necessary to create a valid mb-style rule. Maps can use the actual min/max.
This PR is a prerequisite to support dynamic-styling on non-geojson vector-sources (e.g. .mvt vector tiles). In those instances, Maps cannot get the data-ranges by cycling over the result-set, rather Maps can access them through other means (e.g. metadata request for ES-backed data, TileJson-manifest inspection, manually inputs of users, ...).
This PR has no end-user impact.