UI: time series chart - fix axis intervals calculation.
This commit is contained in:
parent
8a5280799c
commit
15a88a90a3
@ -55,7 +55,7 @@ import {
|
|||||||
measureYAxisNameWidth,
|
measureYAxisNameWidth,
|
||||||
toNamedData
|
toNamedData
|
||||||
} from '@home/components/widget/lib/chart/echarts-widget.models';
|
} from '@home/components/widget/lib/chart/echarts-widget.models';
|
||||||
import { autoDateFormat, DateFormatProcessor } from '@shared/models/widget-settings.models';
|
import { DateFormatProcessor } from '@shared/models/widget-settings.models';
|
||||||
import { isDefinedAndNotNull, isEqual, mergeDeep } from '@core/utils';
|
import { isDefinedAndNotNull, isEqual, mergeDeep } from '@core/utils';
|
||||||
import { DataKey, Datasource, DatasourceType, widgetType } from '@shared/models/widget.models';
|
import { DataKey, Datasource, DatasourceType, widgetType } from '@shared/models/widget.models';
|
||||||
import * as echarts from 'echarts/core';
|
import * as echarts from 'echarts/core';
|
||||||
@ -73,7 +73,7 @@ import { BarRenderSharedContext } from '@home/components/widget/lib/chart/time-s
|
|||||||
export class TbTimeSeriesChart {
|
export class TbTimeSeriesChart {
|
||||||
|
|
||||||
public static dataKeySettings(type = TimeSeriesChartType.default): DataKeySettingsFunction {
|
public static dataKeySettings(type = TimeSeriesChartType.default): DataKeySettingsFunction {
|
||||||
return (key, isLatestDataKey) => {
|
return (_key, isLatestDataKey) => {
|
||||||
if (!isLatestDataKey) {
|
if (!isLatestDataKey) {
|
||||||
const settings = mergeDeep<TimeSeriesChartKeySettings>({} as TimeSeriesChartKeySettings,
|
const settings = mergeDeep<TimeSeriesChartKeySettings>({} as TimeSeriesChartKeySettings,
|
||||||
timeSeriesChartKeyDefaultSettings);
|
timeSeriesChartKeyDefaultSettings);
|
||||||
@ -629,18 +629,6 @@ export class TbTimeSeriesChart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateYAxisScale(axisList: TimeSeriesChartYAxis[]): boolean {
|
|
||||||
let changed = false;
|
|
||||||
for (const yAxis of axisList) {
|
|
||||||
const scaleYAxis = this.scaleYAxis(yAxis);
|
|
||||||
if (yAxis.option.scale !== scaleYAxis) {
|
|
||||||
yAxis.option.scale = scaleYAxis;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
private updateYAxisOffset(axisList: TimeSeriesChartYAxis[]): {offset: number; changed: boolean} {
|
private updateYAxisOffset(axisList: TimeSeriesChartYAxis[]): {offset: number; changed: boolean} {
|
||||||
const result = {offset: 0, changed: false};
|
const result = {offset: 0, changed: false};
|
||||||
let width = 0;
|
let width = 0;
|
||||||
@ -684,6 +672,21 @@ export class TbTimeSeriesChart {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private updateYAxisScale(axisList: TimeSeriesChartYAxis[]): boolean {
|
||||||
|
let changed = false;
|
||||||
|
for (const yAxis of axisList) {
|
||||||
|
const scaleYAxis = this.scaleYAxis(yAxis);
|
||||||
|
if (yAxis.option.scale !== scaleYAxis) {
|
||||||
|
yAxis.option.scale = scaleYAxis;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
if (updateYAxisIntervals(this.timeSeriesChart, yAxis, this.yAxisEmpty(yAxis))) {
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
private scaleYAxis(yAxis: TimeSeriesChartYAxis): boolean {
|
private scaleYAxis(yAxis: TimeSeriesChartYAxis): boolean {
|
||||||
const axisBarDataItems = this.dataItems.filter(d => d.yAxisId === yAxis.id && d.enabled &&
|
const axisBarDataItems = this.dataItems.filter(d => d.yAxisId === yAxis.id && d.enabled &&
|
||||||
d.data.length && d.dataKey.settings.type === TimeSeriesChartSeriesType.bar);
|
d.data.length && d.dataKey.settings.type === TimeSeriesChartSeriesType.bar);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user