Skip to content

Commit

Permalink
feat(heatmap): add rotation in heatmap debug state (#2594)
Browse files Browse the repository at this point in the history
* feat(heatmap): add rotation in heatmap debug state

* Update api.md file
  • Loading branch information
mariairiartef authored Jan 29, 2025
1 parent 2d4b650 commit 9047bd2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/charts/api/charts.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,8 @@ export interface DebugStateAxis {
// (undocumented)
position: Position;
// (undocumented)
rotation?: number;
// (undocumented)
title?: string;
// (undocumented)
values: any[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const getDebugStateSelector = createCustomCachedSelector(
// vertical lines
gridlines: (heatmapViewModel?.gridLines?.x ?? []).map((line) => ({ x: line.x1, y: line.y2 })),
...(xAxisTitle ? { title: xAxisTitle } : {}),
rotation: heatmap.xAxisLabel.rotation,
},
],
y: [
Expand Down
1 change: 1 addition & 0 deletions packages/charts/src/state/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface DebugStateAxis {
y: number;
x: number;
}[];
rotation?: number;
}

/** @public */
Expand Down
3 changes: 3 additions & 0 deletions storybook/stories/heatmap/6_label_rotation.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const Example: ChartsStory = (_, { title, description }) => {
};
const useCategoricalDataset = boolean('Use categorical data', false);
const dataset = useCategoricalDataset ? ECOMMERCE_DATA : DATA_1.data;
const debugState = boolean('Enable debug state', true);

return (
<Chart title={title} description={description}>
<Settings
Expand All @@ -42,6 +44,7 @@ export const Example: ChartsStory = (_, { title, description }) => {
brushAxis="both"
theme={{ heatmap }}
baseTheme={useBaseTheme()}
debugState={debugState}
/>
<Heatmap<{ x: number | string; y: string; value: number }>
id="heatmap2"
Expand Down

0 comments on commit 9047bd2

Please sign in to comment.