Hi!
Here is a small animated scale I did for the datathlon team. Some may find it interesting.
-=-=-=-=-=-=-=-=-=-=-=-= v := RTView new. v @ RTDraggableView.
"Linear per default" scale := [ :x | x ]. width := 200. doLayout := [ RTHorizontalLineLayout new gapSize: 0; on: dots. RTMetricNormalizer new elements: dots; fastSmoothTranslation; normalizeY: #numberOfMethods min: 0 max: width negated using: scale. v signalUpdate ].
v addMenu: 'linear' callback: [ scale := [ :x | x ]. doLayout value ]. v addMenu: 'log' callback: [ scale := [ :x | (x + 1) log ] . doLayout value ]. v addMenu: 'square root' callback: [ scale := [ :x | x sqrt ] . doLayout value ].
values := RTObject withAllSubclasses.
dots := (RTEllipse new color: (Color blue alpha: 0.5)) elementsOn: values. v addAll: dots.
doLayout value. v -=-=-=-=-=-=-=-=-=-=-=-=
Cheers, Alexandre
Here another animated example in the same spirit
http://ws.stfx.eu/EX28WBMTUXI6
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= metrics := { { 'LOC' . #numberOfLinesOfCode } . { 'NOM' . #numberOfMethods } . { 'NOA' . #numberOfVariables } . }.
classes := RTObject withAllSubclasses.
view := RTView new. view @ RTDraggableView. xAxis := metrics first second. yAxis := metrics second second.
"Preparing the menu according to the provided metrics" mb := RTMenuBuilder new. mb view: view.
metrics do: [ :tupple | mb menu: 'X-axis' submenu: tupple first background: Color green callback: [ xAxis := tupple second. refresh value]. mb menu: 'Y-axis' submenu: tupple first background: Color green callback: [ yAxis := tupple second. refresh value ]. ].
elements := (RTEllipse new color: (Color red alpha: 0.3)) elementsOn: classes.
elements @ RTPopup.
view addAll: elements.
refresh := [ RTMetricNormalizer new elements: elements; fastSmoothTranslation; normalizePosition: [:cls | (xAxis rtValue: cls) @ (yAxis rtValue: cls) negated ] min: 0@0 max: 200 @ 200. view signalUpdate. ]. refresh value.
view canvas addShape: (TRLineShape new from: 0 @ 200 to: 200 @ 200).
view canvas addShape: (TRLineShape new from: 0 @ 0 to: 0 @ 200).
view -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
On Apr 8, 2015, at 10:39 AM, Alexandre Bergel alexandre.bergel@me.com wrote:
Hi!
Here is a small animated scale I did for the datathlon team. Some may find it interesting.
-=-=-=-=-=-=-=-=-=-=-=-= v := RTView new. v @ RTDraggableView.
"Linear per default" scale := [ :x | x ]. width := 200. doLayout := [ RTHorizontalLineLayout new gapSize: 0; on: dots. RTMetricNormalizer new elements: dots; fastSmoothTranslation; normalizeY: #numberOfMethods min: 0 max: width negated using: scale. v signalUpdate ].
v addMenu: 'linear' callback: [ scale := [ :x | x ]. doLayout value ]. v addMenu: 'log' callback: [ scale := [ :x | (x + 1) log ] . doLayout value ]. v addMenu: 'square root' callback: [ scale := [ :x | x sqrt ] . doLayout value ].
values := RTObject withAllSubclasses.
dots := (RTEllipse new color: (Color blue alpha: 0.5)) elementsOn: values. v addAll: dots.
doLayout value. v -=-=-=-=-=-=-=-=-=-=-=-=
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev