Skip to content

Commit 7d6e414

Browse files
committed
fix(series): BarSeries should have opacity
This is specified through the strokeStyle now instead.
1 parent 27f410a commit 7d6e414

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

packages/series/src/BarSeries.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ export interface BarSeriesProps {
2525
| CanvasGradient
2626
| CanvasPattern
2727
| ((data: any) => string | CanvasGradient | CanvasPattern);
28-
readonly opacity?: number;
29-
readonly stroke?: boolean;
3028
readonly strokeStyle?: string | CanvasGradient | CanvasPattern;
3129
readonly swapScales?: boolean;
3230
readonly width?: number | ((props: { widthRatio: number }, moreProps: any) => number);
@@ -44,9 +42,7 @@ export class BarSeries extends React.Component<BarSeriesProps> {
4442
yScale: ScaleContinuousNumeric<number, number> /* , d*/,
4543
) => head(yScale.range()),
4644
clip: true,
47-
direction: "up",
4845
fillStyle: "rgba(70, 130, 180, 0.5)",
49-
stroke: false,
5046
swapScales: false,
5147
width: plotDataLengthBarWidth,
5248
widthRatio: 0.8,
@@ -73,7 +69,7 @@ export class BarSeries extends React.Component<BarSeriesProps> {
7369
} else {
7470
const bars = this.getBars(moreProps);
7571

76-
const { stroke, strokeStyle } = this.props;
72+
const { strokeStyle } = this.props;
7773

7874
const nest = group(bars, (d: any) => d.fillStyle);
7975

@@ -90,7 +86,7 @@ export class BarSeries extends React.Component<BarSeriesProps> {
9086
ctx.fillRect(d.x - 0.5, d.y, 1, d.height);
9187
} else {
9288
ctx.fillRect(d.x + 0.5, d.y + 0.5, d.width, d.height);
93-
if (stroke) {
89+
if (strokeStyle !== undefined) {
9490
ctx.strokeRect(d.x, d.y, d.width, d.height);
9591
}
9692
}

packages/series/src/MACDSeries.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { StraightLine } from "./StraightLine";
77
export interface MACDSeriesProps {
88
readonly className?: string;
99
readonly clip?: boolean;
10-
readonly divergenceStroke?: boolean;
1110
readonly fillStyle?: {
1211
divergence: string | CanvasGradient | CanvasPattern;
1312
};
@@ -30,7 +29,6 @@ export class MACDSeries extends React.Component<MACDSeriesProps> {
3029
public static defaultProps = {
3130
className: "react-financial-charts-macd-series",
3231
clip: true,
33-
divergenceStroke: false,
3432
fillStyle: {
3533
divergence: "rgba(70, 130, 180, 0.6)",
3634
},
@@ -48,7 +46,6 @@ export class MACDSeries extends React.Component<MACDSeriesProps> {
4846
className,
4947
clip,
5048
fillStyle = MACDSeries.defaultProps.fillStyle,
51-
divergenceStroke,
5249
strokeStyle = MACDSeries.defaultProps.strokeStyle,
5350
widthRatio,
5451
width,
@@ -60,7 +57,6 @@ export class MACDSeries extends React.Component<MACDSeriesProps> {
6057
baseAt={this.yAccessorForDivergenceBase}
6158
width={width}
6259
widthRatio={widthRatio}
63-
stroke={divergenceStroke}
6460
fillStyle={fillStyle.divergence}
6561
clip={clip}
6662
yAccessor={this.yAccessorForDivergence}

packages/series/src/StackedBarSeries.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ export const drawOnCanvas2 = (props: { stroke?: boolean }, ctx: CanvasRenderingC
171171

172172
nest.forEach((values, key) => {
173173
if (head(values).width > 1) {
174-
ctx.strokeStyle = key;
174+
if (key !== undefined) {
175+
ctx.strokeStyle = key;
176+
}
175177
}
176178
ctx.fillStyle = key;
177179

0 commit comments

Comments
 (0)