Skip to content

Commit

Permalink
feat(series): adding AlternateDataSeries component
Browse files Browse the repository at this point in the history
Component to switch to a different data stream.
  • Loading branch information
markmcdowell committed Sep 2, 2020
1 parent f564a8c commit 03fbb00
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions packages/series/src/AlternateDataSeries.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as PropTypes from "prop-types";
import * as React from "react";

export interface AlternateDataSeriesProps<TData> {
readonly data: TData[];
}

export class AlternateDataSeries<TData> extends React.Component<AlternateDataSeriesProps<TData>> {
public static childContextTypes = {
plotData: PropTypes.array,
};

public getChildContext() {
const { data } = this.props;
return {
plotData: data,
};
}

public render() {
return this.props.children;
}
}
3 changes: 2 additions & 1 deletion packages/series/src/index.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down

0 comments on commit 03fbb00

Please sign in to comment.