UNPKG

@react-stockcharts3/annotations

Version:

Annotations for react-stockcharts3

23 lines 1.1 kB
import { jsx as _jsx } from "react/jsx-runtime"; import * as React from "react"; import { GenericChartComponent } from "@react-stockcharts3/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 (_jsx("g", { className: className, children: data.map((d, idx) => { return (_jsx(Annotation, { ...usingProps, xScale: xScale, yScale: yScale, xAccessor: xAccessor, plotData: plotData, datum: d }, idx)); }) })); }; } render() { return _jsx(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