Skip to content
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

feat(goal): add valueFormatter for tooltip #1529

Merged
merged 13 commits into from
Jan 5, 2022
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/charts/src/chart_types/goal_chart/specs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface BandFillColorAccessorInput {
export type BandFillColorAccessor = (input: BandFillColorAccessorInput) => Color;

/** @alpha */
export type GoalLabelAccessor = LabelAccessor<BandFillColorAccessorInput> | (() => string);
export type GoalLabelAccessor = LabelAccessor<BandFillColorAccessorInput>;

const defaultProps = {
chartType: ChartType.Goal,
Expand All @@ -54,7 +54,7 @@ export interface GoalSpec extends Spec {
tickValueFormatter: GoalLabelAccessor;
labelMajor: string | GoalLabelAccessor;
labelMinor: string | GoalLabelAccessor;
centralMajor: string | GoalLabelAccessor | (() => string);
centralMajor: string | GoalLabelAccessor;
centralMinor: string | GoalLabelAccessor;
angleStart: number;
angleEnd: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ exports[`Chart should render the legend name test 1`] = `
</div>
</Provider>
</Chart>"
`;
`;
2 changes: 1 addition & 1 deletion packages/charts/src/components/accessibility/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function ScreenReaderTypes({
<dl>
<dt>Chart type:</dt>
<dd id={defaultSummaryId}>{chartTypeDescription}</dd>
{validGoalChart && goalChartData && typeof goalChartData.maximum === 'number' ? (
{validGoalChart && goalChartData && isNaN(goalChartData.maximum) ? (
nickofthyme marked this conversation as resolved.
Show resolved Hide resolved
<>
<dt>Minimum:</dt>
<dd>{goalChartData.minimum}</dd>
Expand Down
2 changes: 1 addition & 1 deletion storybook/stories/goal/2_gauge_with_target.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const Example = () => {
centralMinor=""
angleStart={angleStart}
angleEnd={angleEnd}
tooltipValueFormatter={(d) => `${d}k USD`}
tooltipValueFormatter={(d) => `$${d}k USD`}
/>
</Chart>
);
Expand Down