mirror of
https://git.hmsn.ink/coin/chart.git
synced 2026-03-20 08:03:31 +09:00
rsi 추가
This commit is contained in:
@@ -36,6 +36,9 @@ const props = defineProps({
|
||||
bb: {
|
||||
type: Object,
|
||||
},
|
||||
rsi: {
|
||||
type: Object,
|
||||
},
|
||||
autosize: {
|
||||
default: true,
|
||||
type: Boolean,
|
||||
@@ -58,6 +61,9 @@ const props = defineProps({
|
||||
macdHistogramOptions: {
|
||||
type: Object,
|
||||
},
|
||||
rsiLineOptions: {
|
||||
type: Object,
|
||||
},
|
||||
upperBbOptions: {
|
||||
type: Object,
|
||||
},
|
||||
@@ -108,13 +114,15 @@ let chart;
|
||||
let macdLine;
|
||||
let macdSignalLine;
|
||||
let macdHistogram;
|
||||
let mainPane;
|
||||
let macdPane;
|
||||
let rsiPane;
|
||||
|
||||
let upperBb;
|
||||
let middleBb;
|
||||
let lowerBb;
|
||||
|
||||
let rsiLine;
|
||||
|
||||
const chartContainer = ref();
|
||||
|
||||
const fitContent = () => {
|
||||
@@ -160,7 +168,6 @@ const addSeriesAndData = props => {
|
||||
emaLine = chart.addSeries(seriesDefinition, props.emaOptions)
|
||||
emaLine.setData(props.ema)
|
||||
|
||||
console.log(Object.keys(props.macd).length)
|
||||
macdLine = macdPane.addSeries(seriesDefinition, props.macdLineOptions)
|
||||
macdSignalLine = macdPane.addSeries(seriesDefinition, props.macdSignalOptions)
|
||||
macdHistogram = macdPane.addSeries(getChartSeriesDefinition('histogram'), props.macdHistogramOptions)
|
||||
@@ -178,6 +185,11 @@ const addSeriesAndData = props => {
|
||||
middleBb.setData(props.bb.m);
|
||||
lowerBb.setData(props.bb.l);
|
||||
}
|
||||
|
||||
rsiLine = rsiPane.addSeries(seriesDefinition, props.rsiLineOptions)
|
||||
if(Object.keys(props.macd).length) {
|
||||
rsiLine.setData(props.rsi)
|
||||
}
|
||||
// console.log(3)
|
||||
};
|
||||
|
||||
@@ -186,6 +198,8 @@ onMounted(() => {
|
||||
chart = createChart(chartContainer.value, props.chartOptions);
|
||||
macdPane = chart.addPane();
|
||||
macdPane.setStretchFactor(0.5)
|
||||
rsiPane = chart.addPane();
|
||||
rsiPane.setStretchFactor(0.4)
|
||||
|
||||
addSeriesAndData(props);
|
||||
|
||||
@@ -325,6 +339,15 @@ watch(
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
watch(
|
||||
() => props.rsi,
|
||||
newData => {
|
||||
if (!rsiLine) return;
|
||||
rsiLine.setData(props.rsi);
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.chartOptions,
|
||||
newOptions => {
|
||||
|
||||
Reference in New Issue
Block a user