react-financial-charts
Version:
React charts specific to finance.
25 lines • 1.2 kB
JavaScript
import * as React from "react";
import GenericChartComponent from "../GenericChartComponent";
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 = this.plotfilter(when, plotData);
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 })));
})));
};
this.plotfilter = (when, plotData) => {
return plotData.filter(when);
};
}
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