feat: add hover and color-scale support to DensityMapbox#415
Closed
jqnatividad wants to merge 1 commit into
Closed
feat: add hover and color-scale support to DensityMapbox#415jqnatividad wants to merge 1 commit into
jqnatividad wants to merge 1 commit into
Conversation
Extend the DensityMapbox trace with the hover, data-array, and color-control attributes it was missing relative to the plotly.js densitymapbox reference: - hover/text: text, hovertext, hoverinfo, hovertemplate, hovertemplatefallback, hoverlabel - data/misc: ids, meta, customdata, uirevision, below - color: colorscale, autocolorscale, reversescale, showscale, colorbar, coloraxis The FieldSetter derive generates the scalar and *_array builder setters (e.g. hover_text/hover_text_array), so per-point hover text and shared colorscales are now expressible. Existing fields are unchanged. Extends the serialize_density_mapbox test to cover the new keys. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Closing this. On reflection, adding hover/color-scale to #416 adds a |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in 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.
Summary
DensityMapboxpreviously exposed only a small subset of the plotly.jsdensitymapboxattributes — notably no hover configuration and no color-scale controls — so a density heatmap could not show per-point hover text or a custom/reversed colorscale + colorbar.This PR adds those attributes, following the existing
FieldSetterconventions and mirroring the field/type/serde choices already used byScatterMapboxandChoroplethMap. All existing fields are untouched, so the change is purely additive.Closes #413.
What changed
Added
Option<T>fields toDensityMapbox:text,hovertext,hoverinfo,hovertemplate,hovertemplatefallback,hoverlabelcolorscale,autocolorscale,reversescale,showscale,colorbar,coloraxisids,meta,customdata,uirevision,belowThe
FieldSetterderive generates both scalar and_arraysetters (e.g.hover_text/hover_text_array), so per-point hover text and shared colorscales are now expressible. The two dead commented-outcolor_continuous_*placeholder lines were removed. Theserialize_density_mapboxunit test is extended to cover the new keys.Out of scope (intentionally not changed)
radiusstaysOption<u8>(scalar). plotly.js allows number or array; widening toDim<_>is a breaking change to the existing setter and left as a follow-up.zoomandlinefields are not validdensitymapboxtrace attributes (zoom belongs onlayout.mapbox.zoom); removing them would be breaking, so they're left for a separate cleanup.Testing
cargo test -p plotly—serialize_density_mapboxpasses with the new keys.cargo clippy --features all -- -D warnings -A deprecated— clean.cargo +nightly fmt --all -- --check— clean.🤖 Generated with Claude Code