Browse Source

UI: Time series charts improvements

pull/10592/head
Igor Kulikov 2 years ago
parent
commit
02648dd4a5
  1. 4
      ui-ngx/src/app/modules/home/components/widget/lib/chart/echarts-widget.models.ts
  2. 5
      ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-bar.models.ts
  3. 10
      ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts

4
ui-ngx/src/app/modules/home/components/widget/lib/chart/echarts-widget.models.ts

@ -417,8 +417,8 @@ export const adjustTimeAxisExtentToData = (timeAxisOption: TimeAxisBaseOption,
}
}
}
timeAxisOption.min = (typeof min !== 'undefined') ? min : defaultMin;
timeAxisOption.max = (typeof max !== 'undefined') ? max : defaultMax;
timeAxisOption.min = (typeof min !== 'undefined' && Math.abs(min - defaultMin) < 1000) ? min : defaultMin;
timeAxisOption.max = (typeof max !== 'undefined' && Math.abs(max - defaultMax) < 1000) ? max : defaultMax;
};
const toEChartsDataItem = (entry: DataEntry, valueConverter?: (value: any) => any): EChartsDataItem => {

5
ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-bar.models.ts

@ -128,7 +128,8 @@ export const renderTimeSeriesBar = (params: CustomSeriesRenderItemParams, api: C
height: coordSys.height
});
const zeroPos = api.coord([0, offset]);
const zeroCoord = api.coord([0, offset]);
const zeroPos = Math.min(zeroCoord[1], coordSys.y + coordSys.height);
let style: any = {
fill: renderCtx.visualSettings.color,
@ -176,7 +177,7 @@ export const renderTimeSeriesBar = (params: CustomSeriesRenderItemParams, api: C
transition: 'all',
enterFrom: {
style: { opacity: 0 },
shape: { height: 0, y: zeroPos[1] }
shape: { height: 0, y: zeroPos }
}
};
};

10
ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts

@ -803,9 +803,13 @@ export class TbTimeSeriesChart {
}
private scaleYAxis(yAxis: TimeSeriesChartYAxis): boolean {
const axisBarDataItems = this.dataItems.filter(d => d.yAxisId === yAxis.id && d.enabled &&
d.data.length && d.dataKey.settings.type === TimeSeriesChartSeriesType.bar);
return !axisBarDataItems.length;
if (!this.stateData) {
const axisBarDataItems = this.dataItems.filter(d => d.yAxisId === yAxis.id && d.enabled &&
d.data.length && d.dataKey.settings.type === TimeSeriesChartSeriesType.bar);
return !axisBarDataItems.length;
} else {
return false;
}
}
private minTopOffset(): number {

Loading…
Cancel
Save