Refactoring Calendar.

This commit is contained in:
ruidajo 2022-09-19 09:25:14 -05:00
parent 199d5a4d67
commit 9d5c06928c
2 changed files with 18 additions and 18 deletions

View File

@ -10,7 +10,7 @@ Class {
{ #category : #accessing }
EcCalendar >> asEcScript [
^ 'var myCalendar = echarts.init(document.getElementById(',($' asString), 'calendar', ($' asString), '));', Character cr asString,
^ 'var myCalendar = echarts.init(document.getElementById(','''', 'calendar', '''', '));', Character cr asString,
'var option = {
tooltip: {},
animation: true,
@ -18,28 +18,28 @@ EcCalendar >> asEcScript [
legend: {
data:', self eventsLabel, ',',
'left:', ($' asString ), '0',($' asString),
'left:', '''', '0', '''',
'},
calendar: {
top:', ($' asString), 'middle', ($' asString), ',',
'left:', ($' asString),'0', ($' asString), ',',
'orient:', ($' asString), 'horizontal', ($' asString), ',',
top:', '''', 'middle', '''', ',',
'left:', '''','0', '''', ',',
'orient:', '''', 'horizontal', '''', ',',
'cellSize: 40,
yearLabel: {
margin: 50,
fontSize: 30,
color:', ($' asString), '#999', ($' asString),
color:', '''', '#999', '''',
'},
dayLabel: {
firstDay: 1,
nameMap:', ($' asString), 'cn', ($' asString),
nameMap:', '''', 'cn', '''',
'},
monthLabel: {
nameMap:', ($' asString),'cn', ($' asString), ',',
nameMap:', '''','cn', '''', ',',
'margin: 15,
fontSize: 20,
color:', ($' asString), '#999', ($' asString),
color:', '''', '#999', '''',
'},
range:', self datesRangeWithMarginString,
'},
@ -92,7 +92,7 @@ EcCalendar >> datesRangeWithMargin [
EcCalendar >> datesRangeWithMarginString [
| datesRangeTemp |
datesRangeTemp := self datesRangeWithMargin collect: [ :date | ($' asString), date yyyymmdd, ($' asString) ].
datesRangeTemp := self datesRangeWithMargin collect: [ :date | '''', date yyyymmdd, '''' ].
^ '[', (',' join: datesRangeTemp), ']'
]
@ -115,6 +115,6 @@ EcCalendar >> eventsLabel [
| tempEvents |
tempEvents := self events collect: [ :each | each name ].
tempEvents := tempEvents collect: [ :each | ($' asString), each, ($' asString) ].
tempEvents := tempEvents collect: [ :each | '''', each, '''' ].
^ '[', (',' join: tempEvents), ']'
]

View File

@ -14,17 +14,17 @@ Class {
{ #category : #accessing }
EcEvent >> asStringSnippet [
^ '{ type:', ($' asString), self type,($' asString), ',
name:', ($' asString), self name,($' asString), ',
edgeSymbol: [',($' asString),'none',($' asString),',',($' asString),'arrow',($' asString),'],
coordinateSystem:',($' asString),'calendar',($' asString),',
^ '{ type:', '''', self type, '''', ',
name:', '''', self name, '''', ',
edgeSymbol: [', '''','none', '''',',', '''','arrow', '''', '],
coordinateSystem:', '''','calendar', '''',',
symbolSize: 15,
itemStyle: {
color:', ($' asString),'#',self color asHexString,($' asString),',
color:', '''','#',self color asHexString, '''',',
shadowBlur: 9,
shadowOffsetX: 1.5,
shadowOffsetY: 3,
shadowColor:',($' asString),'#555',($' asString),
shadowColor:', '''','#555', '''',
'},
data:', self datesAsString, ',
z: 3
@ -63,7 +63,7 @@ EcEvent >> datesAsString [
tempDates ifNil: [ ^ self ].
tempDates := tempDates collect: [ :each | each asDate ].
tempDates := tempDates collect: [ :date |
'[', ($' asString), date asDate yyyymmdd,($' asString) ].
'[', '''', date asDate yyyymmdd,'''' ].
datesCount := OrderedCollection new.
tempDates doWithIndex: [ :date :i | datesCount add: (date, ',', (i asString), ']') ].
^ '[', (',' join: datesCount ), ']'