81 lines
1.7 KiB
Smalltalk
81 lines
1.7 KiB
Smalltalk
"
|
|
I model a widget to be put, generally in a HTML view of a website.
|
|
"
|
|
Class {
|
|
#name : #BreaWidget,
|
|
#superclass : #Object,
|
|
#instVars : [
|
|
'source',
|
|
'views'
|
|
],
|
|
#category : #Brea
|
|
}
|
|
|
|
{ #category : #accessing }
|
|
BreaWidget >> exportViewsTo: aFolder [
|
|
self shouldBeImplemented
|
|
]
|
|
|
|
{ #category : #'data visualization' }
|
|
BreaWidget >> piechartFor: dataArray titled: aString colored: aPalette [
|
|
"I create a pie chart for a subset of the data stored in a dataArray, which is an Association
|
|
of keys and values.
|
|
aselector should be a message undestood by the dataArray."
|
|
| b lb |
|
|
b := RTPieBuilder new.
|
|
b interaction popup.
|
|
b objects: dataArray.
|
|
b slice: #value.
|
|
b labeled.
|
|
"And add the legend"
|
|
lb := RTLegendBuilder new.
|
|
lb view: b view.
|
|
lb addText: aString.
|
|
lb build.
|
|
^ b
|
|
]
|
|
|
|
{ #category : #'data visualization' }
|
|
BreaWidget >> piechartFor: dataArray using: aSelector titled: aString colored: aPalette [
|
|
"I create a pie chart for a subset of the data stored in a dataArray, which is an Association
|
|
of keys and values.
|
|
aselector should be a message undestood by the dataArray."
|
|
| b lb |
|
|
b := RTPieBuilder new.
|
|
b interaction popup.
|
|
b objects: dataArray.
|
|
b slice: aSelector.
|
|
b labeled.
|
|
"And add the legend"
|
|
lb := RTLegendBuilder new.
|
|
lb view: b view.
|
|
lb addText: 'Asitentes a talleres'.
|
|
lb build.
|
|
^ b
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaWidget >> source [
|
|
^ source
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaWidget >> source: aUrl [
|
|
source := aUrl
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaWidget >> sourceAsJSON [
|
|
^ NeoJSONReader fromString: self source asUrl retrieveContents
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaWidget >> views [
|
|
^ views ifNil: [ views := Dictionary new ]
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaWidget >> views: anObject [
|
|
views := anObject
|
|
]
|