Hi Markus,

b dateShape returns and instance of RTShapeBuilder, so please take a look at that.

This example demonstrates loading of CSV data, which is then quantized into a diverging color scale. The values are visualized as colored cells per day. Dow Jones historical data copyright Yahoo! Finance or independent data provider; fair use for educational purposes

| b tab colors dictionary |
tab := RTTabTable new 
input: (TRPlatform current downloadContent: 'http://bl.ocks.org/mbostock/raw/4063318/dji.csv')
usingDelimiter: $,.
tab removeFirstRow.

dictionary := Dictionary new.
tab values do: [ :ar | | value |
value := (ar fifth asNumber - ar second asNumber)/ ar second asNumber.
dictionary at: ar first asDate put: value ].

colors := #(#(165 0 38) #(215 48 38) #(244 109 67)
#(253 174 97) #(254 224 139) #(255 255 191) #(217 239 139)
#(166 217 106) #(102 189 99) #(26 152 80) #(0 104 55)
  ) collect: [ :ar| Color r: ar first g: ar second b: ar third range: 255 ].

b := RTCalendarBuilder new.
b dateShape rectangle size: 15; color: Color white; borderColor: Color lightGray.
b monthShape shape: (b monthShapePath: 15.0).
b yearShape composite: [ :comp | 
comp add: (RTLabel new text: [ :d | d year ]; height: 20 ).
comp add: (RTBox new color: Color transparent). ] .
b dates: ((Year year: 1990) to: (Year year: 2010) ).
b dateLayout gapSize: 0.
b monthLayout month.
b yearLayout horizontalLine.
b dateShape if: [ :d | dictionary includesKey: d ] color: 
[ :d | | value index |
value := (dictionary at: d)+0.05.
index := ((value * 11/ 0.1)+1) asInteger.
index < 1 ifTrue: [ index := 1 ].
index > 11 ifTrue: [ index := 11 ].
colors at: index. ].
b dateInteraction popup.
b build.
(b view elements select: [:e | e model isKindOf: Month]) pushFront.
^ b view

Imágenes integradas 1




2017-04-07 7:48 GMT-03:00 Markus Böhm <markus.boehm@gmail.com>:

Hallo Milton, tx, very interesting.

How would I find out best what messages are e.g. supported by “b dateShape”, in order to configure visualization?

Just to understand the way of tackling the API based on this example. Via Spotter or Debugging…

 

Would You have a short example, indicating how to visualize CSV data in a month view (e.g. days with sports activity)?

 

Really cool. Sry for asking beginner questions, but it motivates.

 

BR Mike


Am 07.04.2017 11:10 vorm. schrieb "milton mamani" <akevalion@gmail.com>:
Hi Markus,

Is the month layout finally implemented in RTSVGPath in monthShapePath?
- could you please explain it?

How could one change month visualization and:

-   start weeks on Monday instead of Sunday.

---- RTCalendarBuilder uses RTDateLayout, and with this layout change the start of the weeks is not possible, we can improve that

- change color of day figure or background color based on criteria (e.g. weekend …)

---- You can use dateShape

I prepare this example, that I hope can resolve some of your questions.

| b |
b := RTCalendarBuilder new.
b dates: (Month current to: Month current next next).
b dateShape box size: 14.
b dateShape if: [:date | date dayOfWeek = 1 ]color: Color lightBlue .
b dateShape if: [:date | date dayOfWeek = 2 ]color: Color blue.
b monthShape shape: (b monthShapePath: 15.0).
b dateLayout gapSize: 1.
b monthLayout month.
b build.
(b view elements select: [:e | e model isKindOf: Month]) pushFront.
^ b view

Imágenes integradas 3

| b |
b := RTCalendarBuilder new.
b dates: (Month current to: Month current next next).
b dateShape shape: (RTPolygon star size: 20).
b dateShape if: [:date | date dayOfWeek = 1 ]color: Color lightBlue .
b dateShape if: [:date | date dayOfWeek = 2 ]color: Color blue.
b build.
^ b view

Imágenes integradas 2

Milton




Libre de virus. www.avast.com

2017-04-06 9:32 GMT-03:00 Markus Böhm <markus.boehm@gmail.com>:

May I ask: I’m trying to understand how to use RTCalendarBuilder in own, adapted calendar visualization, I read the chapter about builders in the book and started to look at:

exampleMonth

| b |

b := RTCalendarBuilder new.

b dates: (Month current to: Month current next).

b build.

^ b view

Is the month layout finally implemented in RTSVGPath in monthShapePath?

How could one change month visualization and:

-   start weeks on Monday instead of Sunday

-    change color of day figure or background color based on criteria (e.g. weekend …)

Only meant as example. Would I need to change SVGPaths or are there higher level methods?

BR Mike


_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev