보조지표 소수점 추가, cci 수정
This commit is contained in:
@@ -24,7 +24,7 @@ import { IndicatorFillPrimitive } from './IndicatorFillPrimitive';
|
||||
import { BollingerBandFillPrimitive } from './BollingerBandFillPrimitive';
|
||||
import { resolveBbBandBackground } from './bollingerConfig';
|
||||
import type { OHLCVBar, ChartType, Theme, IndicatorConfig, Timeframe } from '../types';
|
||||
import { formatChartAxisPrice } from './dataGenerator';
|
||||
import { formatChartAxisPrice, formatIndicatorAxisPrice } from './dataGenerator';
|
||||
import {
|
||||
DEFAULT_CHART_TIME_FORMAT,
|
||||
formatUnixWithChartPattern,
|
||||
@@ -42,6 +42,16 @@ const MAIN_PRICE_FORMAT = {
|
||||
minMove: 1,
|
||||
formatter: formatChartAxisPrice,
|
||||
};
|
||||
|
||||
const INDICATOR_PRICE_FORMAT = {
|
||||
type: 'custom' as const,
|
||||
minMove: 0.01,
|
||||
formatter: formatIndicatorAxisPrice,
|
||||
};
|
||||
|
||||
function priceFormatForIndicatorPane(paneIndex: number) {
|
||||
return paneIndex >= 2 ? INDICATOR_PRICE_FORMAT : undefined;
|
||||
}
|
||||
import {
|
||||
getIchimokuPlotTitle,
|
||||
isIchimokuCloudVisible,
|
||||
@@ -655,8 +665,12 @@ export class ChartManager {
|
||||
if (filtered.length === 0) continue;
|
||||
|
||||
let series: ISeriesApi<SeriesType>;
|
||||
const indicatorPriceFormat = priceFormatForIndicatorPane(pane);
|
||||
if (plotDef.type === 'histogram') {
|
||||
series = this.chart.addSeries(HistogramSeries, { color: plotDef.color }, pane);
|
||||
series = this.chart.addSeries(HistogramSeries, {
|
||||
color: plotDef.color,
|
||||
...(indicatorPriceFormat ? { priceFormat: indicatorPriceFormat } : {}),
|
||||
}, pane);
|
||||
series.setData(mapHistogramSeriesData(filtered, plotDef));
|
||||
seriesMeta.push({ plotId: plotDef.id, isHistogram: true, color: plotDef.color });
|
||||
} else {
|
||||
@@ -671,6 +685,7 @@ export class ChartManager {
|
||||
lastValueVisible: showPriceLabel,
|
||||
title: showSeriesTitle ? this.seriesTitleForPlot(config, plotDef) : '',
|
||||
visible: isPlotVisible,
|
||||
...(indicatorPriceFormat ? { priceFormat: indicatorPriceFormat } : {}),
|
||||
}, pane);
|
||||
series.setData(filtered.map(p => ({ time: p.time as Time, value: p.value })));
|
||||
seriesMeta.push({ plotId: plotDef.id, isHistogram: false, color: plotDef.color });
|
||||
@@ -2263,8 +2278,13 @@ export class ChartManager {
|
||||
if (!plot) return;
|
||||
const indicatorVisible = config.hidden !== true;
|
||||
const visible = indicatorVisible && config.plotVisibility?.[plot.id] !== false;
|
||||
const paneIdx = entry.paneIndex ?? 0;
|
||||
const indicatorPriceFormat = priceFormatForIndicatorPane(paneIdx);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const opts: Record<string, unknown> = { visible };
|
||||
if (indicatorPriceFormat) {
|
||||
opts['priceFormat'] = indicatorPriceFormat;
|
||||
}
|
||||
if (!entry.seriesMeta[i]?.isHistogram) {
|
||||
opts['color'] = plot.color ?? '#aaa';
|
||||
if (plot.lineWidth != null) opts['lineWidth'] = plot.lineWidth;
|
||||
@@ -2274,7 +2294,6 @@ export class ChartManager {
|
||||
plotAllows = entry.seriesMeta[i]?.plotId !== 'plot2';
|
||||
}
|
||||
const showPriceLabel = this.shouldShowSeriesPriceLabel(config, plotAllows);
|
||||
const paneIdx = entry.paneIndex ?? 0;
|
||||
opts['lastValueVisible'] = showPriceLabel;
|
||||
opts['title'] = paneIdx < 2 && showPriceLabel
|
||||
? this.seriesTitleForPlot(config, plot, plotAllows)
|
||||
|
||||
Reference in New Issue
Block a user