@react-financial-charts/interactive
Version:
Interactive features for react-financial-charts
26 lines • 999 B
JavaScript
import * as React from "react";
import { getMouseCanvas, GenericChartComponent } from "@react-financial-charts/core";
export class Text extends React.Component {
constructor() {
super(...arguments);
this.isHover = () => {
return false;
};
this.drawOnCanvas = (ctx, moreProps) => {
const { xyProvider, fontFamily, fontSize, fillStyle, children } = this.props;
const [x, y] = xyProvider(moreProps);
ctx.font = `${fontSize}px ${fontFamily}`;
ctx.fillStyle = fillStyle;
ctx.beginPath();
ctx.fillText(children, x, y);
};
}
render() {
const { selected } = this.props;
return (React.createElement(GenericChartComponent, { isHover: this.isHover, selected: selected, canvasToDraw: getMouseCanvas, canvasDraw: this.drawOnCanvas, drawOn: ["mousemove", "pan", "drag"] }));
}
}
Text.defaultProps = {
selected: false,
};
//# sourceMappingURL=Text.js.map