UI: Improve range chart and bar chart axis pointers.
This commit is contained in:
parent
d2ba3d2d84
commit
0bf213be7d
@ -384,7 +384,25 @@ export class BarChartWithLabelsWidgetComponent implements OnInit, OnDestroy, Aft
|
|||||||
});
|
});
|
||||||
this.barChartOptions = {
|
this.barChartOptions = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'none'
|
trigger: 'axis',
|
||||||
|
confine: true,
|
||||||
|
appendToBody: true,
|
||||||
|
axisPointer: {
|
||||||
|
type: 'shadow'
|
||||||
|
},
|
||||||
|
formatter: (params: CallbackDataParams[]) => {
|
||||||
|
if (this.settings.showTooltip) {
|
||||||
|
const focusedSeriesIndex = this.focusedSeriesIndex();
|
||||||
|
return echartsTooltipFormatter(this.renderer, this.tooltipDateFormat,
|
||||||
|
this.settings, params, this.decimals, this.units, focusedSeriesIndex);
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
padding: [8, 12],
|
||||||
|
backgroundColor: this.settings.tooltipBackgroundColor,
|
||||||
|
borderWidth: 0,
|
||||||
|
extraCssText: `line-height: 1; backdrop-filter: blur(${this.settings.tooltipBackgroundBlur}px);`
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
containLabel: true,
|
containLabel: true,
|
||||||
@ -421,26 +439,6 @@ export class BarChartWithLabelsWidgetComponent implements OnInit, OnDestroy, Aft
|
|||||||
|
|
||||||
this.barChartOptions.series = this.updateSeries();
|
this.barChartOptions.series = this.updateSeries();
|
||||||
|
|
||||||
if (this.settings.showTooltip) {
|
|
||||||
this.barChartOptions.tooltip = {
|
|
||||||
trigger: 'axis',
|
|
||||||
confine: true,
|
|
||||||
appendToBody: true,
|
|
||||||
axisPointer: {
|
|
||||||
type: 'shadow'
|
|
||||||
},
|
|
||||||
formatter: (params: CallbackDataParams[]) => {
|
|
||||||
const focusedSeriesIndex = this.focusedSeriesIndex();
|
|
||||||
return echartsTooltipFormatter(this.renderer, this.tooltipDateFormat,
|
|
||||||
this.settings, params, this.decimals, this.units, focusedSeriesIndex);
|
|
||||||
},
|
|
||||||
padding: [8, 12],
|
|
||||||
backgroundColor: this.settings.tooltipBackgroundColor,
|
|
||||||
borderWidth: 0,
|
|
||||||
extraCssText: `line-height: 1; backdrop-filter: blur(${this.settings.tooltipBackgroundBlur}px);`
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
this.barChart.setOption(this.barChartOptions);
|
this.barChart.setOption(this.barChartOptions);
|
||||||
|
|
||||||
this.shapeResize$ = new ResizeObserver(() => {
|
this.shapeResize$ = new ResizeObserver(() => {
|
||||||
|
|||||||
@ -286,7 +286,8 @@ export class RangeChartWidgetComponent implements OnInit, OnDestroy, AfterViewIn
|
|||||||
this.rangeChart.setOption({
|
this.rangeChart.setOption({
|
||||||
xAxis: {
|
xAxis: {
|
||||||
min: this.ctx.defaultSubscription.timeWindow.minTime,
|
min: this.ctx.defaultSubscription.timeWindow.minTime,
|
||||||
max: this.ctx.defaultSubscription.timeWindow.maxTime
|
max: this.ctx.defaultSubscription.timeWindow.maxTime,
|
||||||
|
tbTimeWindow: this.ctx.defaultSubscription.timeWindow
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{data: this.ctx.data?.length ? toNamedData(this.ctx.data[0].data) : []}
|
{data: this.ctx.data?.length ? toNamedData(this.ctx.data[0].data) : []}
|
||||||
@ -315,7 +316,19 @@ export class RangeChartWidgetComponent implements OnInit, OnDestroy, AfterViewIn
|
|||||||
});
|
});
|
||||||
this.rangeChartOptions = {
|
this.rangeChartOptions = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'none'
|
trigger: 'axis',
|
||||||
|
confine: true,
|
||||||
|
appendToBody: true,
|
||||||
|
axisPointer: {
|
||||||
|
type: 'shadow'
|
||||||
|
},
|
||||||
|
formatter: (params: CallbackDataParams[]) =>
|
||||||
|
this.settings.showTooltip ? echartsTooltipFormatter(this.renderer, this.tooltipDateFormat,
|
||||||
|
this.settings, params, this.decimals, this.units, 0) : undefined,
|
||||||
|
padding: [8, 12],
|
||||||
|
backgroundColor: this.settings.tooltipBackgroundColor,
|
||||||
|
borderWidth: 0,
|
||||||
|
extraCssText: `line-height: 1; backdrop-filter: blur(${this.settings.tooltipBackgroundBlur}px);`
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
containLabel: true,
|
containLabel: true,
|
||||||
@ -403,19 +416,7 @@ export class RangeChartWidgetComponent implements OnInit, OnDestroy, AfterViewIn
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.settings.showTooltip) {
|
(this.rangeChartOptions.xAxis as any).tbTimeWindow = this.ctx.defaultSubscription.timeWindow;
|
||||||
this.rangeChartOptions.tooltip = {
|
|
||||||
trigger: 'axis',
|
|
||||||
confine: true,
|
|
||||||
appendToBody: true,
|
|
||||||
formatter: (params: CallbackDataParams[]) => echartsTooltipFormatter(this.renderer, this.tooltipDateFormat,
|
|
||||||
this.settings, params, this.decimals, this.units, 0),
|
|
||||||
padding: [8, 12],
|
|
||||||
backgroundColor: this.settings.tooltipBackgroundColor,
|
|
||||||
borderWidth: 0,
|
|
||||||
extraCssText: `line-height: 1; backdrop-filter: blur(${this.settings.tooltipBackgroundBlur}px);`
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
this.rangeChart.setOption(this.rangeChartOptions);
|
this.rangeChart.setOption(this.rangeChartOptions);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user