From f417b6e2d03311c69327dfd5827836e6c66de898 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Mon, 1 Jul 2024 12:53:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8-K=E7=BA=BF=E5=9B=BE):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E9=97=AD=E6=8F=90=E7=A4=BA=E6=97=B6?= =?UTF-8?q?k=E7=BA=BF=E8=A2=AB=E9=9A=90=E8=97=8F=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BB=A5=E5=8F=8A=E6=A8=AA=E8=BD=B4=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/line/stock-line.ts | 52 +++++++++++++------ 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/line/stock-line.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/line/stock-line.ts index abbd766e65..1352470018 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/line/stock-line.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/line/stock-line.ts @@ -282,6 +282,7 @@ export class StockLine extends G2PlotChartView { xField: xAxisDataeaseName, yField: key, color: colors[index - 1], + xAxis: null, yAxis: { label: false, min: minValue, @@ -398,20 +399,26 @@ export class StockLine extends G2PlotChartView { protected configTooltip(chart: Chart, options: MixOptions): MixOptions { const tooltipAttr = parseJson(chart.customAttr).tooltip - if (!tooltipAttr.show) { - return { - ...options, - tooltip: { - showContent: false - } - } - } const newPlots = [] const linePlotList = options.plots.filter(item => item.type === 'line') linePlotList.forEach(item => { newPlots.push(item) }) const stockPlot = options.plots.filter(item => item.type === 'stock')[0] + if (!tooltipAttr.show) { + const stockOption = { + ...stockPlot.options, + tooltip: { + showContent: false + } + } + newPlots.push({ ...stockPlot, options: stockOption }) + return { + ...options, + plots: newPlots + } + } + const showFiled = chart.data.fields const customTooltipItems = originalItems => { const formattedItems = originalItems @@ -510,10 +517,15 @@ export class StockLine extends G2PlotChartView { ...stockPlot, options: { ...stockPlot.options, - xAxis: { - ...stockPlot.options['xAxis'], - ...xAxisOptions['xAxis'] - } + xAxis: xAxisOptions['xAxis'] + ? { + ...stockPlot.options['xAxis'], + ...xAxisOptions['xAxis'] + } + : { + label: false, + line: null + } } } newPlots.push(newStockPlot) @@ -548,11 +560,17 @@ export class StockLine extends G2PlotChartView { ...stockPlot, options: { ...stockPlot.options, - yAxis: { - ...stockPlot.options['yAxis'], - ...yAxisOptions['yAxis'], - label - } + yAxis: label + ? { + ...stockPlot.options['yAxis'], + ...yAxisOptions['yAxis'], + label + } + : { + label, + grid: null, + line: null + } } } newPlots.push(newStockPlot)