Skip to content

feat(dashboards): Create HeatMapWidgetVisualization component#114916

Merged
gggritso merged 17 commits intomasterfrom
georgegritsouk/logs-762-create-heatmapwidgetvisualization-component
May 7, 2026
Merged

feat(dashboards): Create HeatMapWidgetVisualization component#114916
gggritso merged 17 commits intomasterfrom
georgegritsouk/logs-762-create-heatmapwidgetvisualization-component

Conversation

@gggritso
Copy link
Copy Markdown
Member

@gggritso gggritso commented May 5, 2026

Before having Heat Map support in Explore, one must have a Heat Map component to put into Explore! This is that widget. This is an MVP, it doesn't even have any features aside from plotting that mostly works. What it does have is:

  • plotting! It totally plots
  • types that are aligned with the new heat map data endpoint that's coming soon
  • enough files to work with (a story, some fixtures, etc.)

e.g.,

Screenshot 2026-05-05 at 2 49 04 PM

This component follows a very similar structure to how the time series, and categorical visualization widgets work. They declare a Plottable interface that the visualization component can plot, and each plottable kind (in this case, just HeatMap) works against that interface. There's a decent chance that we'll support other heat map plottables if we want to show percentiles on the same chart.

This is working from @marthalyndon's generous #114616 which spiked this feature a while back. Thank you Martha!

I also had to update BaseChart because it was dropping its visualMap prop on the floor mysteriously!

The BaseChart component is extended with a visualMap prop passthrough since ECharts heat maps require a visual map for color mapping. The HeatMapPlottable interface is intentionally separate from the existing Plottable interface since heat maps have fundamentally different axes (X, Y, Z) compared to time series (X, Y).

This is pretty raw for now, we'll be coming back to think through the colour palette and so on.

Closes LOGS-762

gggritso and others added 3 commits May 5, 2026 16:41
This prop was passed in, but never actually given to ECharts, so it was
pointless!
Fix Zstep range calculation (was Zmin+Zmax, should be Zmax-Zmin),
remove duplicate PlottableTimeSeriesValueType from heatMap.tsx, and
remove unused LOADING_PLACEHOLDER export from settings.

Refs LOGS-762
Co-Authored-By: Claude <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 5, 2026

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.45%

gggritso and others added 2 commits May 5, 2026 17:04
These files aren't consumed by any production entry point yet. Add a
temporary knip entry point exception until the widget is integrated
into Explore.

Refs LOGS-762
Co-Authored-By: Claude <noreply@anthropic.com>
HeatMapValueType is only used internally within types.tsx, so it
doesn't need to be exported. Fixes knip unused-export violation.

Refs LOGS-762
Co-Authored-By: Claude <noreply@anthropic.com>
@gggritso
Copy link
Copy Markdown
Member Author

gggritso commented May 6, 2026

@cursor review

Comment thread static/app/components/charts/baseChart.tsx Outdated
Comment thread static/app/views/dashboards/widgets/heatMapWidget/plottables/heatMap.tsx Outdated
Comment thread static/app/views/dashboards/widgets/heatMapWidget/heatMapWidgetVisualization.tsx Outdated
gggritso and others added 6 commits May 6, 2026 16:58
Replace the piecewise color mapping with a two-visualMap setup:
a piecewise map that makes z=0 buckets fully transparent via opacity,
and a continuous map that interpolates across HEATMAP_COLORS for all
non-zero values. This avoids hardcoded step boundaries and produces
smooth color gradients.

Refs LOGS-762
Co-Authored-By: Claude <noreply@anthropic.com>
Pass scale through to the plottable via plotting options instead of
post-processing series data in the visualization component. The
HeatMap class now handles the log1p transform in toSeries when
scale is 'log', keeping data transformation in the plottable layer
where it belongs.

Refs LOGS-762
Co-Authored-By: Claude <noreply@anthropic.com>
…-762-create-heatmapwidgetvisualization-component
Remove the second huge fixture, it's not that useful.
gggritso and others added 2 commits May 6, 2026 17:57
The `visualMap` prop on BaseChart was placed after the `...options`
spread, meaning an undefined `visualMap` would overwrite any
`visualMap` set through `options`. Pass it through `options` instead.

Co-Authored-By: Claude <noreply@anthropic.com>
@gggritso
Copy link
Copy Markdown
Member Author

gggritso commented May 6, 2026

@cursor review

The piecewise visualMap had overlapping pieces at value 0: one piece
targeted exactly 0 with opacity 0, while another used min: 0 (>=0)
with opacity 1. ECharts has inconsistent behavior with overlapping
piece boundaries, which could cause zero-value cells to render opaque.
Using gt: 0 (strictly greater than) removes the ambiguity.
@gggritso
Copy link
Copy Markdown
Member Author

gggritso commented May 7, 2026

@cursor review

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b1d4f84. Configure here.

@gggritso gggritso requested a review from a team May 7, 2026 14:02
@gggritso gggritso requested a review from nsdeschenes May 7, 2026 14:02
@gggritso gggritso marked this pull request as ready for review May 7, 2026 14:02
@gggritso gggritso requested review from a team as code owners May 7, 2026 14:02
Copy link
Copy Markdown
Contributor

@nsdeschenes nsdeschenes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some quick questions, but everything is looking good 👍

Comment thread knip.config.ts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True but that's c'est-la vie for ya

Comment on lines +21 to +24
/**
* Experimental! Specify the Z-axis scale type. Logarithmic scales can be much more useful for values with a high range.
*/
scale?: 'linear' | 'log';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering how this PR, impacts/interacts with this?

If we enable one but not the other, would it cause a broken UX?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question! The backend PR adds support for log yAxis which has to be done on the backend, and this is experimental support for log zAxis which I think is easier to do on the frontend, but I'm not sure, it was just faster to do it here as a test

return [
item.xAxis,
item.yAxis,
scale === 'log' && typeof zValue === 'number' ? Math.log1p(zValue) : zValue,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to be doing log stuff on the API side, if I'm understanding this PR right.

Would we be better off migrating the calculations that are happening here to be on the API side? So we don't have a mismatch between datasets 👀

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that might be better on the API side but I'm not confident yet, and it's easier to iterate on this on the frontend for now. There's a decent chance we don't even use log, but something else instead, I have a whole ticket to take a look at this problem space

Comment thread static/app/views/dashboards/widgets/heatMapWidget/heatMapWidgetVisualization.tsx Outdated
The tuple type [HeatMap, ...HeatMapPlottable[]] already guarantees the
first element is a HeatMap, so the runtime .find() + non-null assertion
was unnecessary.
BaseChart uses echarts/core (tree-shakeable) and only registers grid,
graphic, toolbox, and brush. The heatmap chart type and visualMap
component were only available because the old HeatMapChart in
tagsHeatMap.tsx registers them globally as a side effect. Adding
explicit imports removes this latent dependency.
@gggritso
Copy link
Copy Markdown
Member Author

gggritso commented May 7, 2026

@cursor review

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a5acd27. Configure here.

@gggritso gggritso merged commit c89a4b1 into master May 7, 2026
71 checks passed
@gggritso gggritso deleted the georgegritsouk/logs-762-create-heatmapwidgetvisualization-component branch May 7, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants