일목균형표 수정
This commit is contained in:
@@ -43,6 +43,8 @@ class CloudRenderer implements IPrimitivePaneRenderer {
|
||||
private _data: IchimokuCloudPoint[];
|
||||
private _bullishColor: string;
|
||||
private _bearishColor: string;
|
||||
private _bullishVisible: boolean;
|
||||
private _bearishVisible: boolean;
|
||||
|
||||
constructor(
|
||||
chart: IChartApiBase<Time>,
|
||||
@@ -50,12 +52,16 @@ class CloudRenderer implements IPrimitivePaneRenderer {
|
||||
data: IchimokuCloudPoint[],
|
||||
bullishColor: string,
|
||||
bearishColor: string,
|
||||
bullishVisible: boolean,
|
||||
bearishVisible: boolean,
|
||||
) {
|
||||
this._chart = chart;
|
||||
this._series = series;
|
||||
this._data = data;
|
||||
this._bullishColor = bullishColor;
|
||||
this._bearishColor = bearishColor;
|
||||
this._bullishVisible = bullishVisible;
|
||||
this._bearishVisible = bearishVisible;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -81,6 +87,8 @@ class CloudRenderer implements IPrimitivePaneRenderer {
|
||||
|
||||
// 한국 관례: SpanA > SpanB → 양운(빨강), SpanA <= SpanB → 음운(청록)
|
||||
const bullish = (a.spanA + b.spanA) > (a.spanB + b.spanB);
|
||||
if (bullish && !this._bullishVisible) continue;
|
||||
if (!bullish && !this._bearishVisible) continue;
|
||||
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
@@ -112,6 +120,8 @@ class CloudPaneView implements IPrimitivePaneView {
|
||||
this._plugin.getCloudData(),
|
||||
this._plugin.getBullishColor(),
|
||||
this._plugin.getBearishColor(),
|
||||
this._plugin.getBullishVisible(),
|
||||
this._plugin.getBearishVisible(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -123,6 +133,8 @@ export class IchimokuCloudPlugin implements ISeriesPrimitive<Time> {
|
||||
private _data: IchimokuCloudPoint[] = [];
|
||||
private _bullishColor = 'rgba(239, 83, 80, 0.2)';
|
||||
private _bearishColor = 'rgba(38, 166, 154, 0.2)';
|
||||
private _bullishVisible = true;
|
||||
private _bearishVisible = true;
|
||||
private _updateFn: (() => void) | null = null;
|
||||
|
||||
attached({ chart, series, requestUpdate }: SeriesAttachedParameter<Time>): void {
|
||||
@@ -147,8 +159,16 @@ export class IchimokuCloudPlugin implements ISeriesPrimitive<Time> {
|
||||
this._updateFn?.();
|
||||
}
|
||||
|
||||
setVisibility(bullishVisible: boolean, bearishVisible: boolean): void {
|
||||
this._bullishVisible = bullishVisible;
|
||||
this._bearishVisible = bearishVisible;
|
||||
this._updateFn?.();
|
||||
}
|
||||
|
||||
getBullishColor() { return this._bullishColor; }
|
||||
getBearishColor() { return this._bearishColor; }
|
||||
getBullishVisible() { return this._bullishVisible; }
|
||||
getBearishVisible() { return this._bearishVisible; }
|
||||
|
||||
paneViews(): readonly IPrimitivePaneView[] {
|
||||
if (!this._chart || !this._series) return [];
|
||||
|
||||
Reference in New Issue
Block a user