From 03fbb00f15dfd6487e7f92aa6e1517c99d7c1d1c Mon Sep 17 00:00:00 2001 From: Mark McDowell Date: Wed, 2 Sep 2020 12:11:44 +0100 Subject: [PATCH] feat(series): adding AlternateDataSeries component Component to switch to a different data stream. --- packages/series/src/AlternateDataSeries.tsx | 23 +++++++++++++++++++++ packages/series/src/index.ts | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 packages/series/src/AlternateDataSeries.tsx diff --git a/packages/series/src/AlternateDataSeries.tsx b/packages/series/src/AlternateDataSeries.tsx new file mode 100644 index 000000000..e99b31273 --- /dev/null +++ b/packages/series/src/AlternateDataSeries.tsx @@ -0,0 +1,23 @@ +import * as PropTypes from "prop-types"; +import * as React from "react"; + +export interface AlternateDataSeriesProps { + readonly data: TData[]; +} + +export class AlternateDataSeries extends React.Component> { + public static childContextTypes = { + plotData: PropTypes.array, + }; + + public getChildContext() { + const { data } = this.props; + return { + plotData: data, + }; + } + + public render() { + return this.props.children; + } +} diff --git a/packages/series/src/index.ts b/packages/series/src/index.ts index 4399c9e01..3bb4c3a1b 100644 --- a/packages/series/src/index.ts +++ b/packages/series/src/index.ts @@ -1,6 +1,7 @@ -export * from "./AreaSeries"; +export * from "./AlternateDataSeries"; export * from "./AlternatingFillAreaSeries"; export * from "./AreaOnlySeries"; +export * from "./AreaSeries"; export * from "./markers"; export * from "./LineSeries"; export * from "./CandlestickSeries";