UNPKG

react-financial-charts

Version:
27 lines 1.47 kB
import * as React from "react"; import GenericChartComponent from "../GenericChartComponent"; import { getAxisCanvas } from "../GenericComponent"; import { drawOnCanvasHelper, identityStack, StackedBarSeries, svgHelper } from "./StackedBarSeries"; export class GroupedBarSeries extends React.Component { constructor() { super(...arguments); this.drawOnCanvas = (ctx, moreProps) => { const { xAccessor } = moreProps; drawOnCanvasHelper(ctx, this.props, moreProps, xAccessor, identityStack, this.postProcessor); }; this.renderSVG = (moreProps) => { const { xAccessor } = moreProps; return (React.createElement("g", { className: "react-financial-charts-grouped-bar-series" }, svgHelper(this.props, moreProps, xAccessor, identityStack, this.postProcessor))); }; this.postProcessor = (array) => { return array.map((each) => { return Object.assign(Object.assign({}, each), { x: each.x + each.offset - each.groupOffset, width: each.groupWidth }); }); }; } render() { return (React.createElement(GenericChartComponent, { svgDraw: this.renderSVG, canvasDraw: this.drawOnCanvas, canvasToDraw: getAxisCanvas, drawOn: ["pan"] })); } } GroupedBarSeries.defaultProps = Object.assign(Object.assign({}, StackedBarSeries.defaultProps), { widthRatio: 0.8, spaceBetweenBar: 5 }); //# sourceMappingURL=GroupedBarSeries.js.map