Roassal3 icon indicating copy to clipboard operation
Roassal3 copied to clipboard

RSChart

Open akevalion opened this issue 2 years ago • 2 comments

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

akevalion avatar Mar 03 '23 15:03 akevalion

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

akevalion avatar Mar 03 '23 15:03 akevalion

Moved to pharo-graphics/Roassal

akevalion avatar Nov 10 '23 14:11 akevalion