Skip to content
Open

Gauge #672

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
f97880f
Initial gauge component setup - copied and renamed bullet files
BradyShimanek Oct 7, 2025
7ace04d
Make gauge appear in Storybook with Bullet graph
JarekSmith Oct 9, 2025
58581f5
Found things we need to ask questions about
danimanderson Oct 10, 2025
6678a60
adding case for gauge on chartSpecBuilder.ts
danimanderson Oct 11, 2025
491fdd8
Began adding Signals
BradyShimanek Oct 24, 2025
711440d
Messed with the signals
danimanderson Oct 24, 2025
c51e8f6
Progress on Mark
danimanderson Oct 24, 2025
1b92348
Working on Mark Util
danimanderson Oct 24, 2025
8a8668e
Marks Util Progress
danimanderson Oct 24, 2025
14cc5e3
Marks Util Progress
danimanderson Oct 24, 2025
dd128de
Mark Updates
danimanderson Oct 24, 2025
d1b0c90
Adding Needle Rule Mark.
danimanderson Oct 24, 2025
084003f
Fixed paranthesis
danimanderson Oct 24, 2025
b9ba2c3
Got gauge to render
BradyShimanek Oct 24, 2025
565b2fc
Removed some comments
BradyShimanek Oct 24, 2025
42d2cc2
Stinking # symbols
danimanderson Oct 24, 2025
a3385dd
WIP: gauge work
danimanderson Oct 24, 2025
ebe0bb5
Fixing the color problems.
danimanderson Oct 24, 2025
2c4a186
Added data-driven basics, color scheme corrections, and flexible props
BradyShimanek Oct 28, 2025
1952a76
Fixed the filler arc to have the one straight edge
danimanderson Oct 28, 2025
38cff11
Remove `track` from gaugeSpec
JarekSmith Oct 30, 2025
83cee9f
Touched up currVal to be dynamic
BradyShimanek Oct 31, 2025
a370f90
making the minimalistic skeleton for the gauge
danimanderson Nov 6, 2025
b0bb8e6
Simpler implementation
danimanderson Nov 7, 2025
73cab9c
Cleaned up basic Gauge
BradyShimanek Nov 7, 2025
31dd0e7
Deleting a comment
danimanderson Nov 7, 2025
77d4b35
Make gauge appear in Storybook with Bullet graph
JarekSmith Oct 9, 2025
51c2924
Merge branch 'simple-implementation' of https://github.com/danimander…
JarekSmith Nov 7, 2025
f2f64ce
feat: Add simple gauge
JarekSmith Nov 7, 2025
d50c666
feat: Add simple gauge
JarekSmith Nov 7, 2025
b1efcae
Modified Basic Gauge Props
BradyShimanek Nov 12, 2025
4981a62
Stashing to get rid of it
danimanderson Nov 12, 2025
5f069a8
Made gauge tests for data util and mark util.
danimanderson Nov 12, 2025
156746a
Fixed gaugeSpecBuilder test
danimanderson Nov 13, 2025
e5f2f0c
Implement Gauge.test.tsx
JarekSmith Nov 13, 2025
95734fc
Remove unnecessary imports
JarekSmith Nov 13, 2025
09f6ead
Create skeleton for optional needle
danimanderson Nov 14, 2025
11ec94f
Trash
danimanderson Nov 14, 2025
ce4e44d
Implement basic needle
danimanderson Nov 14, 2025
c8f33a2
Fix needle and implement needle hole. aka needhole
danimanderson Nov 19, 2025
824a0da
Implement skeleton target goal line
danimanderson Nov 19, 2025
544d333
Race to see who fixes X2 and Y2 for TargetLine first. Good luck
danimanderson Nov 21, 2025
977b0fd
Fixed it. I won -Dani
danimanderson Nov 21, 2025
e2abec1
Temp color for target line
danimanderson Nov 21, 2025
bdc0848
Make the target line change color depending on colorScheme
danimanderson Nov 21, 2025
54532f0
Add dynamic label
danimanderson Nov 24, 2025
a784373
Implement percentage option
danimanderson Nov 24, 2025
7834fe5
Dynamic color for labels
danimanderson Nov 24, 2025
5833aab
Add start and end caps to gauge
JarekSmith Nov 25, 2025
3707385
Adjust x/y calculations
JarekSmith Nov 25, 2025
898da76
Removed backgroundArc stroke to match design
JarekSmith Nov 25, 2025
6749600
Adding stories
danimanderson Nov 25, 2025
9c96edc
Fix gaps between caps and backgroundArc
JarekSmith Nov 25, 2025
cf99380
Add Full and Empty stories
JarekSmith Nov 25, 2025
b60007d
Calculate x/y from endAngle for endCap
JarekSmith Nov 25, 2025
8edb8a9
Arranged stories to show dynamic labeling in a better way
danimanderson Nov 25, 2025
f7851e5
Make the text bigger
danimanderson Nov 25, 2025
58a9590
Implement basic performance range gauge variation
BradyShimanek Nov 27, 2025
241e56e
adding strokes on the three colored gauge
danimanderson Nov 27, 2025
b084aa3
Implement *correct* gaps @danimanderson -_-
BradyShimanek Nov 27, 2025
02ae29f
Merge branch 'target-line-implementation' into endcaps
JarekSmith Nov 27, 2025
4c5edaf
Merge branch 'three-color-gauge' into endcaps
JarekSmith Nov 27, 2025
23df341
Implement three color rounded edges
JarekSmith Nov 27, 2025
0cc3c0a
Merge branch 'label-implementation' into endcaps
JarekSmith Nov 27, 2025
09b1d0f
Merge label with endcaps and three color gauge
JarekSmith Nov 27, 2025
776cc7d
Fixing tests
H-bot-hash Dec 3, 2025
fec35c8
Adding tests
H-bot-hash Dec 3, 2025
aa4220a
Adding more tests
H-bot-hash Dec 3, 2025
9ccd5a6
Adding signal tests
H-bot-hash Dec 5, 2025
c0bc461
Add default setting for showPerformanceRanges
danimanderson Dec 5, 2025
68e18af
Updating documentation
H-bot-hash Dec 5, 2025
ccefd89
Fix performance ranges not rendering + added values for it's test.
BradyShimanek Dec 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"chalk": "4.1.2",
"clean-webpack-plugin": "^4.0.0",
"concurrently": "^8.0.0",
"cross-env": "^7.0.3",
"cross-env": "^10.1.0",
"css-loader": "^7.1.2",
"eslint": "^8.29.0",
"eslint-config-prettier": "^9.0.0",
Expand Down Expand Up @@ -175,5 +175,6 @@
"React",
"Spectrum",
"Charts"
]
],
"dependencies": {}
}
5 changes: 5 additions & 0 deletions packages/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const DEFAULT_FONT_SIZE = 14;
export const DEFAULT_FONT_COLOR = 'gray-800';
export const DEFAULT_GRANULARITY = 'day';
export const DEFAULT_HIDDEN_SERIES = [];
export const DEFAULT_LABEL = false;
export const DEFAULT_LABEL_ALIGN = 'center';
export const DEFAULT_LABEL_FONT_WEIGHT = 'normal';
export const DEFAULT_LABEL_ORIENTATION = 'horizontal';
Expand All @@ -35,6 +36,10 @@ export const DEFAULT_LINE_WIDTHS = ['M'];
export const DEFAULT_LINEAR_DIMENSION = 'x';
export const DEFAULT_LOCALE = 'en-US';
export const DEFAULT_METRIC = 'value';
export const DEFAULT_MAX_ARC_VALUE = 100;
export const DEFAULT_MIN_ARC_VALUE = 0;
export const DEFAULT_NEEDLE = false;
export const DEFAULT_TARGET_LINE = false;
export const DEFAULT_SCALE_TYPE = 'normal';
export const DEFAULT_SCALE_VALUE = 100;
export const DEFAULT_SECONDARY_COLOR = 'subSeries';
Expand Down
140 changes: 140 additions & 0 deletions packages/docs/docs/api/visualizations/Gauge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
## ALPHA RELEASE

Gauge is currently in alpha. This means that the component, behavior and API are all subject to change.

```
import { Chart, ChartProps } from '@adobe/react-spectrum-charts';
import { Gauge, GaugeSummary, SegmentLabel } from '@adobe/react-spectrum-charts/rc';
```

# Gauge
The `Gauge` component is used to display data in a dashboard gauge style.

## Needle
The gauge can draw a mark needle for progression measurement and data tracking. Disabled by default.

## Target Line
The target line shows a line representing a goal value for the metric. Disabled by default.

## Performance Ranges
The gauge can draw `performance ranges` marks for a given series of target ranges, defining color for detailed data tracking. Disabled by default.

## Dynamic Labeling with unit options
The guage label can be represented as a percentage or numeric value and resizes in relation to the needle being present.

## Props

<table>
<thead>
<tr>
<th>name</th>
<th>type</th>
<th>default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>metric</td>
<td>number</td>
<td>'value'</td>
<td>The data that is used for the current value.</td>
</tr>
<tr>
<td>color</td>
<td>string</td>
<td>'series'</td>
<td>The data that is used as the color to current value.</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
<td>'gauge0'</td>
<td>Sets the name of the component.</td>
</tr>
<tr>
<td>graphLabel</td>
<td>string</td>
<td>'graphLabel'</td>
<td>The data that is used as the graph label.</td>
</tr>
<tr>
<td>showLabel</td>
<td>boolean</td>
<td>false</td>
<td>Sets to show the label or not.</td>
</tr>
<tr>
<td>showsAsPercent</td>
<td>boolean</td>
<td>false</td>
<td>Sets to show the current value as a percentage or not.</td>
</tr>
<tr>
<td>minArcValue</td>
<td>number</td>
<td>0</td>
<td>Minimum value for the scale. This value must be greater than zero, and less than maxArcValue.</td>
</tr>
<tr>
<td>maxArcValue</td>
<td>number</td>
<td>100</td>
<td>Maximum value for the scale. This value must be greater than zero, and greater than minArcValue.</td>
</tr>
<tr>
<td>currVal</td>
<td>number</td>
<td>75</td>
<td>The current value tracked and its progress in the gauge. Set to 75 out of 100 by default.</td>
</tr>
<tr>
<td>backgroundFill</td>
<td>string</td>
<td>-</td>
<td>The color of the background arc.</td>
</tr>
<tr>
<td>backgroundStroke</td>
<td>string</td>
<td>-</td>
<td>The color of the background stroke.</td>
</tr>
<tr>
<td>fillerColorSignal</td>
<td>string</td>
<td>-</td>
<td>The color of the filler color arc.</td>
</tr>
<tr>
<td>needle</td>
<td>boolean</td>
<td>false</td>
<td>The needle mark for tracking progress towards a goal.</td>
</tr>
<tr>
<td>target</td>
<td>string</td>
<td>'target'</td>
<td>The data that is used as the target.</td>
</tr>
<tr>
<td>targetLine</td>
<td>boolean</td>
<td>false</td>
<td>Shows a line for target tracking.</td>
</tr>
<tr>
<td>performanceRanges</td>
<td>-</td>
<td>false</td>
<td>Array of performance ranges to be rendered as filled bands on the gauge.</td>
</tr>
<tr>
<td>showPerformanceRanges</td>
<td>number</td>
<td>0</td>
<td>If true, show banded performance ranges instead of a colored filler arc.</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2025 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

/* eslint-disable @typescript-eslint/no-unused-vars */
import { FC } from 'react';

import {
DEFAULT_MAX_ARC_VALUE,
DEFAULT_MIN_ARC_VALUE,
DEFAULT_LABEL,
DEFAULT_NEEDLE,
DEFAULT_TARGET_LINE,
} from '@spectrum-charts/constants';

import { GaugeProps } from '../../../types';

const Gauge: FC<GaugeProps> = ({
name = 'gauge0',
graphLabel = 'graphLabel',
showLabel = DEFAULT_LABEL,
showsAsPercent = false,
metric = 'currentAmount',
minArcValue = DEFAULT_MIN_ARC_VALUE,
maxArcValue = DEFAULT_MAX_ARC_VALUE,
needle = DEFAULT_NEEDLE,
targetLine = DEFAULT_TARGET_LINE,
target = 'target',
showPerformanceRanges = false,
}) => {
return null;
};

// displayName is used to validate the component type in the spec builder
Gauge.displayName = 'Gauge';

export { Gauge };
13 changes: 13 additions & 0 deletions packages/react-spectrum-charts/src/alpha/components/Gauge/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright 2025 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

export * from './Gauge';
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
export * from './Bullet';
export * from './Combo';
export * from './Venn';
export * from './Gauge/Gauge';
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
ChartPopoverOptions,
ChartTooltipOptions,
DonutSummaryOptions,
GaugeOptions,
LegendOptions,
LineOptions,
MarkOptions,
Expand All @@ -30,7 +31,7 @@ import {
TrendlineOptions,
} from '@spectrum-charts/vega-spec-builder';

import { Bullet, Combo, Venn } from '../alpha';
import { Bullet, Combo, Gauge, Venn } from '../alpha';
import { Annotation } from '../components/Annotation';
import { Area } from '../components/Area';
import { Axis } from '../components/Axis';
Expand Down Expand Up @@ -158,6 +159,10 @@ export const childrenToOptions = (
marks.push({ ...child.props, markType: 'bullet' } as BulletOptions);
break;

case Gauge.displayName:
marks.push({ ...child.props, markType: 'gauge' } as GaugeOptions);
break;

case ChartPopover.displayName:
chartPopovers.push(getChartPopoverOptions(child.props as ChartPopoverProps));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const BulletStory: StoryFn<BulletProps & { width?: number; height?: number }> =
const { width, height, ...bulletProps } = args;
const chartProps = useChartProps({ ...defaultChartProps, width: width ?? 350, height: height ?? 350 });
return (
<Chart {...chartProps}>
<Chart {...chartProps} debug>
<Bullet {...bulletProps} />
</Chart>
);
Expand Down
Loading
Loading