Refactoring calendar and event calendar for echarts objects strings and improving sunburst segment for echarts format.

This commit is contained in:
ruidajo 2022-09-22 09:27:26 -05:00
parent 2bb7cf53ab
commit 00aa287d17
3 changed files with 21 additions and 9 deletions

View File

@ -45,7 +45,7 @@ EcCalendar >> asEcScript [
'}, '},
series: [', Character cr asString, series: [', Character cr asString,
self eventsAsStringSnippets, self eventsAsEcObjectsString,
'] ']
}; };
myCalendar.setOption(option);' myCalendar.setOption(option);'
@ -102,12 +102,12 @@ EcCalendar >> events [
] ]
{ #category : #accessing } { #category : #accessing }
EcCalendar >> eventsAsStringSnippets [ EcCalendar >> eventsAsEcObjectsString [
| tempEvents | | tempEvents |
tempEvents := self events. tempEvents := self events.
tempEvents ifNil: [ ^ self ]. tempEvents ifNil: [ ^ self ].
^ Character cr join: (tempEvents collect: [ :each | each asStringSnippet ]) ^ Character cr join: (tempEvents collect: [ :each | each asEcObjectString ])
] ]
{ #category : #accessing } { #category : #accessing }

View File

@ -12,7 +12,7 @@ Class {
} }
{ #category : #accessing } { #category : #accessing }
EcEvent >> asStringSnippet [ EcEvent >> asEcObjectString [
^ '{ type:', '''', self type, '''', ', ^ '{ type:', '''', self type, '''', ',
name:', '''', self name, '''', ', name:', '''', self name, '''', ',

View File

@ -33,11 +33,23 @@ EcSunburstSegment class >> rootName: aString [
{ #category : #accessing } { #category : #accessing }
EcSunburstSegment >> asEcObjectString [ EcSunburstSegment >> asEcObjectString [
self isRoot
ifFalse: [
^ '{ name: ', name, ', ^ '{ name: ', name, ',
value: ', value asString, ', value: ', value asString, ',
color: ', '''', color asHTMLColor, '''', ', color: ', '''', (color ifNil: [ '' ] ifNotNil: [ color asHTMLColor ]), '''', ',
children: []', Character cr asString, children: [',
']',
Character cr asString,
'}' '}'
]
ifTrue: [
^ '{ name: ', name, ',
color: ', '''', (color ifNil: [ '' ] ifNotNil: [ color asHTMLColor ]), '''', ',
children: []',
Character cr asString,
'}'
]
] ]
{ #category : #accessing } { #category : #accessing }