UNPKG

@tradingaction/annotations

Version:
22 lines 1.09 kB
import * as React from "react"; import { GenericChartComponent } from "@tradingaction/core"; export class Annotate extends React.Component { constructor() { super(...arguments); this.renderSVG = (moreProps) => { const { xAccessor, xScale, chartConfig: { yScale }, plotData, } = moreProps; const { className, usingProps, with: Annotation, when } = this.props; const data = plotData.filter(when); return (React.createElement("g", { className: className }, data.map((d, idx) => { return (React.createElement(Annotation, Object.assign({ key: idx }, usingProps, { xScale: xScale, yScale: yScale, xAccessor: xAccessor, plotData: plotData, datum: d }))); }))); }; } render() { return React.createElement(GenericChartComponent, { svgDraw: this.renderSVG, drawOn: ["pan"] }); } } Annotate.defaultProps = { className: "react-financial-charts-enable-interaction react-financial-charts-annotate react-financial-charts-default-cursor", }; //# sourceMappingURL=Annotate.js.map