opt: opt axis display

This commit is contained in:
liihuu 2024-08-30 00:25:44 +08:00
parent c80f5cfea1
commit 5086d071b8
3 changed files with 7 additions and 7 deletions

View File

@ -42,15 +42,15 @@ export default abstract class XAxisImp extends AxisImp {
let text = ''
switch (weight) {
case TimeWeightConstants.Year: {
text = dateTime.YYYY
text = dateTime.YYYY + '年'
break
}
case TimeWeightConstants.Month: {
text = `${dateTime.YYYY}-${dateTime.MM}`
text = `${dateTime.YYYY}${dateTime.MM}`
break
}
case TimeWeightConstants.Day: {
text = `${dateTime.MM}-${dateTime.DD}`
text = `${dateTime.MM}${dateTime.DD}`
break
}
case TimeWeightConstants.Hour:

View File

@ -252,7 +252,7 @@ export default abstract class YAxisImp extends AxisImp implements YAxis {
const ticks: AxisTick[] = []
if (realRange >= 0) {
const interval = nice(realRange / 8.0)
const interval = nice(realRange / 10)
const precision = getPrecision(interval)
const first = round(Math.ceil(realFrom / interval) * interval, precision)

View File

@ -160,10 +160,10 @@ export default class TimeScaleStore {
this._gapBarSpace = Math.max(1, gapBarSpace)
}
classifyTimeTicks (newDataList: KLineData[], update?: boolean): void {
classifyTimeTicks (newDataList: KLineData[], isUpdate?: boolean): void {
let baseDataIndex = 0
let prevKLineData: Nullable<KLineData> = null
if (update ?? false) {
if (isUpdate ?? false) {
const dataList = this._chartStore.getDataList()
baseDataIndex = dataList.length
prevKLineData = dataList[baseDataIndex - 1]
@ -300,7 +300,7 @@ export default class TimeScaleStore {
this._chartStore.getActionStore().execute(ActionType.OnVisibleRangeChange, this._visibleRange)
this._chartStore.adjustVisibleDataList()
if (
this._cacheVisibleRange.from !== this._visibleRange.from &&
this._cacheVisibleRange.from !== this._visibleRange.from ||
this._cacheVisibleRange.to !== this._visibleRange.to
) {
this._cacheVisibleRange = { ...this._visibleRange }