Skip to content

Commit 91d7f60

Browse files
committed
fix(bollinger): correcting props
Re-arranging props to be alphabetical. Adding defaults for stroke and fill.
1 parent 48df593 commit 91d7f60

File tree

2 files changed

+35
-22
lines changed

2 files changed

+35
-22
lines changed

packages/charts/src/series/BollingerSeries.tsx

+22-10
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,41 @@ import { AreaOnlySeries } from "./AreaOnlySeries";
44
import { LineSeries } from "./LineSeries";
55

66
interface BollingerSeriesProps {
7-
readonly yAccessor: any; // func
8-
readonly className?: string;
97
readonly areaClassName?: string;
8+
readonly className?: string;
9+
readonly fill?: string;
1010
readonly opacity?: number;
11-
readonly type?: string;
12-
readonly stroke: {
11+
readonly stroke?: {
1312
top: string,
1413
middle: string,
1514
bottom: string,
1615
};
17-
readonly fill: string;
16+
readonly yAccessor?: any; // func
1817
}
1918

2019
export class BollingerSeries extends React.Component<BollingerSeriesProps> {
2120

2221
public static defaultProps = {
23-
className: "react-financial-charts-bollinger-band-series",
2422
areaClassName: "react-financial-charts-bollinger-band-series-area",
25-
opacity: 0.2,
23+
className: "react-financial-charts-bollinger-band-series",
24+
fill: "#26a69a",
25+
opacity: 0.05,
26+
stroke: {
27+
top: "#26a69a",
28+
middle: "#812828",
29+
bottom: "#26a69a",
30+
},
31+
yAccessor: (data: any) => data.bb,
2632
};
2733

2834
public render() {
29-
const { areaClassName, className, opacity } = this.props;
30-
const { stroke, fill } = this.props;
35+
const {
36+
areaClassName,
37+
className,
38+
opacity,
39+
stroke = BollingerSeries.defaultProps.stroke,
40+
fill,
41+
} = this.props;
3142

3243
return (
3344
<g className={className}>
@@ -47,7 +58,8 @@ export class BollingerSeries extends React.Component<BollingerSeriesProps> {
4758
className={areaClassName}
4859
yAccessor={this.yAccessorForTop}
4960
base={this.yAccessorForScalledBottom}
50-
stroke="none" fill={fill}
61+
stroke="none"
62+
fill={fill}
5163
opacity={opacity} />
5264
</g>
5365
);

packages/charts/src/tooltip/BollingerBandTooltip.tsx

+13-12
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ import { ToolTipText } from "./ToolTipText";
88
import { ToolTipTSpanLabel } from "./ToolTipTSpanLabel";
99

1010
interface BollingerBandTooltipProps {
11-
className?: string;
12-
yAccessor: any; // func
13-
displayValuesFor?: any; // func
14-
displayFormat: any; // func
15-
origin: number[];
16-
onClick?: any; // func
17-
options: {
11+
readonly className?: string;
12+
readonly displayValuesFor?: any; // func
13+
readonly displayFormat: any; // func
14+
readonly fontFamily?: string;
15+
readonly fontSize?: number;
16+
readonly labelFill?: string;
17+
readonly origin?: number[];
18+
readonly onClick?: any; // func
19+
readonly options: {
1820
sourcePath: string;
1921
windowSize: number;
2022
multiplier: number;
2123
movingAverageType: string;
2224
};
23-
textFill?: string;
24-
labelFill?: string;
25-
fontFamily?: string;
26-
fontSize?: number;
25+
readonly textFill?: string;
26+
readonly yAccessor?: any; // func
2727
}
2828

2929
export class BollingerBandTooltip extends React.Component<BollingerBandTooltipProps> {
@@ -32,7 +32,8 @@ export class BollingerBandTooltip extends React.Component<BollingerBandTooltipPr
3232
className: "react-financial-charts-tooltip react-financial-charts-bollingerband-tooltip",
3333
displayFormat: format(".2f"),
3434
displayValuesFor: defaultDisplayValuesFor,
35-
origin: [0, 10],
35+
origin: [8, 8],
36+
yAccessor: (data: any) => data.bb,
3637
};
3738

3839
public render() {

0 commit comments

Comments
 (0)