From 61f2e846d99579213d0e3b22a9b5962d296b263d Mon Sep 17 00:00:00 2001 From: plainheart Date: Sat, 9 Nov 2024 16:27:16 +0800 Subject: [PATCH] feat(calendar): add `silent` option for `dayLabel`/`monthLabel`/yearLabel`. --- src/component/calendar/CalendarView.ts | 13 ++++++++++--- test/calendar-simple.html | 11 ++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/component/calendar/CalendarView.ts b/src/component/calendar/CalendarView.ts index 6cc7274758..01a84b2180 100644 --- a/src/component/calendar/CalendarView.ts +++ b/src/component/calendar/CalendarView.ts @@ -337,7 +337,8 @@ class CalendarView extends ComponentView { z2: 30, style: createTextStyle(yearLabel, { text: content - }) + }), + silent: yearLabel.get('silent') }); yearText.attr(this._yearTextPositionControl(yearText, posPoints[pos], orient, pos, margin)); @@ -422,6 +423,8 @@ class CalendarView extends ComponentView { margin = pos === 'start' ? -margin : margin; const isCenter = (align === 'center'); + const labelSilent = monthLabel.get('silent'); + for (let i = 0; i < termPoints[idx].length - 1; i++) { const tmp = termPoints[idx][i].slice(); @@ -449,7 +452,8 @@ class CalendarView extends ComponentView { style: extend( createTextStyle(monthLabel, {text: content}), this._monthTextPositionControl(tmp, isCenter, orient, pos, margin) - ) + ), + silent: labelSilent }); group.add(monthText); @@ -533,6 +537,8 @@ class CalendarView extends ComponentView { margin = -margin; } + const labelSilent = dayLabel.get('silent'); + for (let i = 0; i < 7; i++) { const tmpD = coordSys.getNextNDay(start, i); @@ -544,7 +550,8 @@ class CalendarView extends ComponentView { style: extend( createTextStyle(dayLabel, {text: nameMap[day]}), this._weekTextPositionControl(point, orient, pos, margin, cellSize) - ) + ), + silent: labelSilent }); group.add(weekText); diff --git a/test/calendar-simple.html b/test/calendar-simple.html index ecaa3a3d25..1cf47ba530 100644 --- a/test/calendar-simple.html +++ b/test/calendar-simple.html @@ -73,7 +73,16 @@ max: 1000 }, calendar: { - range: '2017' + range: '2017', + dayLabel: { + silent: true + }, + monthLabel: { + silent: true + }, + yearLabel: { + silent: true + } }, series: { type: 'heatmap',