Skip to content

Commit

Permalink
fix candlestick options
Browse files Browse the repository at this point in the history
  • Loading branch information
trash-and-fire committed May 31, 2022
1 parent d75bb71 commit 501c1b8
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion packages/lib/src/internal/series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,16 @@ export function series<T extends SeriesActionParams>(target: ChartActionResult,
throw new TypeError('Can not change type of series in runtime. Report a bug please');
}

subject.applyOptions(merge(clone(defaults), nextOptions));
const optionsToApply = merge(clone(defaults), nextOptions);

if (shouldHandleBorderCandlestickOptions(nextOptions)) {
delete optionsToApply.borderColor;
}
if (shouldHandleWickCandlestickOptions(nextOptions)) {
delete optionsToApply.wickColor;
}

subject.applyOptions(optionsToApply);

if (!nextReactive) {
data = null;
Expand Down Expand Up @@ -161,3 +170,17 @@ function omit<T extends { reactive?: unknown; data: unknown; type: unknown }>(pa
const {reactive, data, type, ...rest} = params;
return rest;
}

function shouldHandleBorderCandlestickOptions(next: any): boolean {
if (next.borderColor === undefined) {
return next.borderUpColor !== undefined || next.borderDownColor !== undefined;
}
return false;
}

function shouldHandleWickCandlestickOptions(next: any): boolean {
if (next.wickColor === undefined) {
return next.wickUpColor !== undefined || next.wickDownColor !== undefined;
}
return false;
}

0 comments on commit 501c1b8

Please sign in to comment.