Skip to content

Commit

Permalink
fix: make gauge values absolute values in gauge docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dpportet committed Jul 3, 2024
1 parent 92de90a commit 72de525
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/doc-site/stories/components/gauge/Gauge.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const Standard: Story = {
</div>
),
args: {
query: mockSinWaveDataWithQuality({ frequency: '5s' }),
query: mockSinWaveDataWithQuality({ frequency: '5s', positiveOnly: true }),
settings: {
gaugeThickness: 30,
showUnit: true,
Expand All @@ -46,7 +46,7 @@ export const StandardWithThresholds: Story = {
</div>
),
args: {
query: mockSinWaveDataWithQuality({ frequency: '5s' }),
query: mockSinWaveDataWithQuality({ frequency: '5s', positiveOnly: true }),
thresholds: [
{
value: 30,
Expand Down Expand Up @@ -87,7 +87,7 @@ export const BadDataQuality: Story = {
</div>
),
args: {
query: mockSinWaveDataWithQuality({ frequency: '5s', quality: 'BAD' }),
query: mockSinWaveDataWithQuality({ frequency: '5s', quality: 'BAD', positiveOnly: true }),
thresholds: [
{
value: 30,
Expand Down Expand Up @@ -131,6 +131,7 @@ export const UncertainDataQuality: Story = {
query: mockSinWaveDataWithQuality({
frequency: '5s',
quality: 'UNCERTAIN',
positiveOnly: true
}),
settings: {
gaugeThickness: 30,
Expand Down
4 changes: 3 additions & 1 deletion packages/doc-site/stories/mockSinWaveData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ export const mockSinWaveData = (frequency?: string) =>
export const mockSinWaveDataWithQuality = ({
frequency,
quality,
positiveOnly = false,
}: {
frequency?: string;
quality?: Quality;
positiveOnly?: boolean;
}) =>
mockTimeSeriesDataQueryLiveStream({
frequency: frequency || '0.25s',
Expand All @@ -35,7 +37,7 @@ export const mockSinWaveDataWithQuality = ({
name: 'Windmill',
createDataPoint: (date: Date) => ({
x: date.getTime(),
y: 100 * Math.sin(date.getTime() / 1000),
y: positiveOnly ? Math.abs(100 * Math.sin(date.getTime() / 1000)) : 100 * Math.sin(date.getTime() / 1000),
quality,
}),
},
Expand Down

0 comments on commit 72de525

Please sign in to comment.