Refactoring Calendar.
This commit is contained in:
parent
199d5a4d67
commit
9d5c06928c
@ -10,7 +10,7 @@ Class {
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
EcCalendar >> asEcScript [
|
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 = {
|
'var option = {
|
||||||
tooltip: {},
|
tooltip: {},
|
||||||
animation: true,
|
animation: true,
|
||||||
@ -18,28 +18,28 @@ EcCalendar >> asEcScript [
|
|||||||
|
|
||||||
legend: {
|
legend: {
|
||||||
data:', self eventsLabel, ',',
|
data:', self eventsLabel, ',',
|
||||||
'left:', ($' asString ), '0',($' asString),
|
'left:', '''', '0', '''',
|
||||||
'},
|
'},
|
||||||
|
|
||||||
calendar: {
|
calendar: {
|
||||||
top:', ($' asString), 'middle', ($' asString), ',',
|
top:', '''', 'middle', '''', ',',
|
||||||
'left:', ($' asString),'0', ($' asString), ',',
|
'left:', '''','0', '''', ',',
|
||||||
'orient:', ($' asString), 'horizontal', ($' asString), ',',
|
'orient:', '''', 'horizontal', '''', ',',
|
||||||
'cellSize: 40,
|
'cellSize: 40,
|
||||||
yearLabel: {
|
yearLabel: {
|
||||||
margin: 50,
|
margin: 50,
|
||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
color:', ($' asString), '#999', ($' asString),
|
color:', '''', '#999', '''',
|
||||||
'},
|
'},
|
||||||
dayLabel: {
|
dayLabel: {
|
||||||
firstDay: 1,
|
firstDay: 1,
|
||||||
nameMap:', ($' asString), 'cn', ($' asString),
|
nameMap:', '''', 'cn', '''',
|
||||||
'},
|
'},
|
||||||
monthLabel: {
|
monthLabel: {
|
||||||
nameMap:', ($' asString),'cn', ($' asString), ',',
|
nameMap:', '''','cn', '''', ',',
|
||||||
'margin: 15,
|
'margin: 15,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color:', ($' asString), '#999', ($' asString),
|
color:', '''', '#999', '''',
|
||||||
'},
|
'},
|
||||||
range:', self datesRangeWithMarginString,
|
range:', self datesRangeWithMarginString,
|
||||||
'},
|
'},
|
||||||
@ -92,7 +92,7 @@ EcCalendar >> datesRangeWithMargin [
|
|||||||
EcCalendar >> datesRangeWithMarginString [
|
EcCalendar >> datesRangeWithMarginString [
|
||||||
|
|
||||||
| datesRangeTemp |
|
| datesRangeTemp |
|
||||||
datesRangeTemp := self datesRangeWithMargin collect: [ :date | ($' asString), date yyyymmdd, ($' asString) ].
|
datesRangeTemp := self datesRangeWithMargin collect: [ :date | '''', date yyyymmdd, '''' ].
|
||||||
^ '[', (',' join: datesRangeTemp), ']'
|
^ '[', (',' join: datesRangeTemp), ']'
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -115,6 +115,6 @@ EcCalendar >> eventsLabel [
|
|||||||
|
|
||||||
| tempEvents |
|
| tempEvents |
|
||||||
tempEvents := self events collect: [ :each | each name ].
|
tempEvents := self events collect: [ :each | each name ].
|
||||||
tempEvents := tempEvents collect: [ :each | ($' asString), each, ($' asString) ].
|
tempEvents := tempEvents collect: [ :each | '''', each, '''' ].
|
||||||
^ '[', (',' join: tempEvents), ']'
|
^ '[', (',' join: tempEvents), ']'
|
||||||
]
|
]
|
||||||
|
@ -14,17 +14,17 @@ Class {
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
EcEvent >> asStringSnippet [
|
EcEvent >> asStringSnippet [
|
||||||
|
|
||||||
^ '{ type:', ($' asString), self type,($' asString), ',
|
^ '{ type:', '''', self type, '''', ',
|
||||||
name:', ($' asString), self name,($' asString), ',
|
name:', '''', self name, '''', ',
|
||||||
edgeSymbol: [',($' asString),'none',($' asString),',',($' asString),'arrow',($' asString),'],
|
edgeSymbol: [', '''','none', '''',',', '''','arrow', '''', '],
|
||||||
coordinateSystem:',($' asString),'calendar',($' asString),',
|
coordinateSystem:', '''','calendar', '''',',
|
||||||
symbolSize: 15,
|
symbolSize: 15,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color:', ($' asString),'#',self color asHexString,($' asString),',
|
color:', '''','#',self color asHexString, '''',',
|
||||||
shadowBlur: 9,
|
shadowBlur: 9,
|
||||||
shadowOffsetX: 1.5,
|
shadowOffsetX: 1.5,
|
||||||
shadowOffsetY: 3,
|
shadowOffsetY: 3,
|
||||||
shadowColor:',($' asString),'#555',($' asString),
|
shadowColor:', '''','#555', '''',
|
||||||
'},
|
'},
|
||||||
data:', self datesAsString, ',
|
data:', self datesAsString, ',
|
||||||
z: 3
|
z: 3
|
||||||
@ -63,7 +63,7 @@ EcEvent >> datesAsString [
|
|||||||
tempDates ifNil: [ ^ self ].
|
tempDates ifNil: [ ^ self ].
|
||||||
tempDates := tempDates collect: [ :each | each asDate ].
|
tempDates := tempDates collect: [ :each | each asDate ].
|
||||||
tempDates := tempDates collect: [ :date |
|
tempDates := tempDates collect: [ :date |
|
||||||
'[', ($' asString), date asDate yyyymmdd,($' asString) ].
|
'[', '''', date asDate yyyymmdd,'''' ].
|
||||||
datesCount := OrderedCollection new.
|
datesCount := OrderedCollection new.
|
||||||
tempDates doWithIndex: [ :date :i | datesCount add: (date, ',', (i asString), ']') ].
|
tempDates doWithIndex: [ :date :i | datesCount add: (date, ',', (i asString), ']') ].
|
||||||
^ '[', (',' join: datesCount ), ']'
|
^ '[', (',' join: datesCount ), ']'
|
||||||
|
Loading…
Reference in New Issue
Block a user