UNPKG

react-financial-charts

Version:
40 lines 1.7 kB
import * as React from "react"; import { LineSeries } from "./LineSeries"; import { StraightLine } from "./StraightLine"; export class StochasticSeries extends React.Component { constructor() { super(...arguments); this.yAccessorForK = (d) => { const { yAccessor } = this.props; return yAccessor(d) && yAccessor(d).K; }; this.yAccessorForD = (d) => { const { yAccessor } = this.props; return yAccessor(d) && yAccessor(d).D; }; } render() { const { className, stroke = StochasticSeries.defaultProps.stroke, refLineOpacity, overSold, middle, overBought } = this.props; return (React.createElement("g", { className: className }, React.createElement(LineSeries, { yAccessor: this.yAccessorForD, stroke: stroke.dLine, fill: "none" }), React.createElement(LineSeries, { yAccessor: this.yAccessorForK, stroke: stroke.kLine, fill: "none" }), React.createElement(StraightLine, { stroke: stroke.top, opacity: refLineOpacity, yValue: overSold }), React.createElement(StraightLine, { stroke: stroke.middle, opacity: refLineOpacity, yValue: middle }), React.createElement(StraightLine, { stroke: stroke.bottom, opacity: refLineOpacity, yValue: overBought }))); } } StochasticSeries.defaultProps = { className: "react-financial-charts-stochastic-series", stroke: { top: "#964B00", middle: "#000000", bottom: "#964B00", dLine: "#EA2BFF", kLine: "#74D400", }, overSold: 80, middle: 50, overBought: 20, refLineOpacity: 0.3, }; //# sourceMappingURL=StochasticSeries.js.map