Roassal3
Roassal3 copied to clipboard
RSChart
from discord
jecisc — hoy a las 16:22
In the end, I'm having this script:
c := RSChart new.
p := RSScatterPlot new x: (housing column: #longitude) values y: (housing column: #latitude) values.
c addPlot: p.
c addDecoration: RSHorizontalTick new.
c addDecoration: RSVerticalTick new.
c open
I think it would be great to add an #open method to charts with default options to make it easier to use charts in simple use cases like:
open
| canvas |
canvas := RSChart new.
canvas addPlot: self.
canvas addDecoration: RSHorizontalTick new.
canvas addDecoration: RSVerticalTick new.
canvas open
akevalion — hoy a las 16:25
I will put it as an issue
My idea for this would be
p := RSScatterPlot new x: (housing column: #longitude) values y: (housing column: #latitude) values.
p open
jecisc — hoy a las 16:26
Yeah exactly 🙂
By adding that to the charts you can simplify the code this much for simple cases :3
We could also have:
p := RSScatterPlot new x: (housing column: #longitude) values y: (housing column: #latitude) values.
p open: [ :canvas | "Do some customizations on canvas ]
To tweak a little the canvas. The method would do:
open: aBlock
| canvas |
canvas := RSChart new.
canvas addPlot: self.
canvas addDecoration: RSHorizontalTick new.
canvas addDecoration: RSVerticalTick new.
aBlock value: canvas.
canvas open
Moved to pharo-graphics/Roassal