From 8e01a69f48b0632b80cb432f6a5f0decdf3301d4 Mon Sep 17 00:00:00 2001 From: Luciana Corteggiano Date: Thu, 30 May 2024 15:59:37 -0600 Subject: [PATCH] fix: anomaly chart docs not loading --- .../anomalyChart/AnomalyChart.stories.tsx | 8 ++--- .../stories/components/anomalyChart/Data.mdx | 2 +- .../stories/components/anomalyChart/Query.mdx | 2 +- .../stories/components/anomalyChart/data.ts | 34 +++++++++++++++---- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/packages/doc-site/stories/components/anomalyChart/AnomalyChart.stories.tsx b/packages/doc-site/stories/components/anomalyChart/AnomalyChart.stories.tsx index 8edc515e3..635f503a9 100644 --- a/packages/doc-site/stories/components/anomalyChart/AnomalyChart.stories.tsx +++ b/packages/doc-site/stories/components/anomalyChart/AnomalyChart.stories.tsx @@ -20,7 +20,7 @@ export const Standard: Story = { ), args: { - data: [MOCK_DATA], + data: MOCK_DATA.data, viewport: { duration: '30s' }, }, }; @@ -28,20 +28,20 @@ export const Standard: Story = { export const Error: Story = { ...Standard, args: { - data: [MOCK_DATA_ERROR], + data: MOCK_DATA_ERROR.data, }, }; export const Empty: Story = { ...Standard, args: { - data: [], + data: [{state: 'success', value: {data: []}}], }, }; export const Loading: Story = { ...Standard, args: { - data: [MOCK_DATA_LOADING], + data: MOCK_DATA_LOADING.data, }, }; diff --git a/packages/doc-site/stories/components/anomalyChart/Data.mdx b/packages/doc-site/stories/components/anomalyChart/Data.mdx index 0bfd82796..ed7d3e4f4 100644 --- a/packages/doc-site/stories/components/anomalyChart/Data.mdx +++ b/packages/doc-site/stories/components/anomalyChart/Data.mdx @@ -5,7 +5,7 @@ import * as AnomalyChartStories from './AnomalyChart.stories'; # Anomaly Chart Data Structure -[Learn more about the Anomaly Chart](/docs/components-anomalychart-docs--docs). +[Learn more about the Anomaly Chart](/docs/components-anomalychart--docs). The Anomaly provides a timeline view of anomaly predictions, visualizing the raw data in a specific format. diff --git a/packages/doc-site/stories/components/anomalyChart/Query.mdx b/packages/doc-site/stories/components/anomalyChart/Query.mdx index a5e7fef79..84c299cbc 100644 --- a/packages/doc-site/stories/components/anomalyChart/Query.mdx +++ b/packages/doc-site/stories/components/anomalyChart/Query.mdx @@ -7,7 +7,7 @@ import * as AnomalyChartStories from './AnomalyChart.stories'; The Anomaly Chart is a powerful visualization tool that allows you to display anomaly predictions. This user guide will walk you through the process of specifying queries for the Anomaly Chart to request and visualize anomaly data. -[Learn more about the Anomaly Chart](/docs/components-anomalychart-docs--docs). +[Learn more about the Anomaly Chart](/docs/components-anomalychart--docs). [Learn more about anomaly data query](/docs/data-sources-aws-iot-sitewise--docs). diff --git a/packages/doc-site/stories/components/anomalyChart/data.ts b/packages/doc-site/stories/components/anomalyChart/data.ts index 0006d6b5a..c66ac5836 100644 --- a/packages/doc-site/stories/components/anomalyChart/data.ts +++ b/packages/doc-site/stories/components/anomalyChart/data.ts @@ -1,11 +1,12 @@ -import type { AnomalyObjectDataSource } from '@iot-app-kit/react-components'; +import type { AnomalyChartDataSourceOption } from '@iot-app-kit/react-components'; -export const MOCK_DATA: AnomalyObjectDataSource = { +export const MOCK_DATA: AnomalyChartDataSourceOption = {data: [{ state: 'success', value: { data: [ { timestamp: 1714909732438, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -35,6 +36,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714419170826, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -64,6 +66,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714578429305, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -93,6 +96,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714643198943, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -122,6 +126,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714480555677, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -151,6 +156,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714411937923, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -180,6 +186,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714627287904, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -209,6 +216,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714999072631, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -238,6 +246,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714628340330, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -267,6 +276,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714731287864, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -296,6 +306,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714822944244, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -325,6 +336,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714933880365, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -354,6 +366,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714632308567, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -383,6 +396,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714757072072, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -412,6 +426,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714455343258, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -441,6 +456,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714409979348, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -470,6 +486,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714459669203, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -499,6 +516,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714511393770, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -528,6 +546,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714464450991, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -557,6 +576,7 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, { timestamp: 1714660199070, + prediction: 1, diagnostics: [ { name: 'Average Power', @@ -586,14 +606,14 @@ export const MOCK_DATA: AnomalyObjectDataSource = { }, ], }, -}; +}]}; -export const MOCK_DATA_ERROR: AnomalyObjectDataSource = { +export const MOCK_DATA_ERROR: AnomalyChartDataSourceOption = {data: [{ state: 'error', value: { data: [] }, -}; +}]}; -export const MOCK_DATA_LOADING: AnomalyObjectDataSource = { +export const MOCK_DATA_LOADING: AnomalyChartDataSourceOption = {data: [{ state: 'loading', value: { data: [] }, -} \ No newline at end of file +}]} \ No newline at end of file