Roassal3 icon indicating copy to clipboard operation
Roassal3 copied to clipboard

Issue with the scaling and ticks

Open bergel opened this issue 5 years ago • 2 comments

check this:

| c p classes names x y |

classes := Collection withAllSubclasses.
x := classes collect: #numberOfMethods.
y := classes collect: #linesOfCode.

c := RSChart new.
c extent: 400@400.
c addPlot: (p := RSScatterPlot new x: x y: y; color: Color blue translucent; yourself).
    
c addDecoration: (RSHorizontalTick new 
    yourself).
c xlabel: 'Classes'.
c yLog.
"c addDecoration: (RSVerticalTick new 
    numberOfTicks: 10;
    asFloat)."
c ylabel: 'Lines of code'.
c title: 'Collection withAllSubClasses'.

c addDecoration: (vertical := RSVerticalTick new).
vertical shape dashed.
vertical numberOfTicks: 10.
vertical configuration tickSize: c extent x negated.

c build.
popup := RSPopup text: [ :cls | cls name, String crlf, cls linesOfCode asString ].


ellipses := c canvas shapes select: [ :shape | shape class = RSEllipse ].
ellipses with: classes do: [ :shape :cls |
    shape model: cls.
    shape addInteraction: popup.
     ].
c canvas
image

bergel avatar Nov 20 '20 21:11 bergel

I would hope to have something like: image

bergel avatar Nov 20 '20 21:11 bergel

The order of yLog matters, try this:

| c p classes names x y |

classes := Collection withAllSubclasses.
x := classes collect: #numberOfMethods.
y := classes collect: #linesOfCode.

c := RSChart new.
c extent: 400@400.
c addPlot: (p := RSScatterPlot new x: x y: y; color: Color blue translucent; yourself).
    
c addDecoration: (RSHorizontalTick new 
    yourself).
c xlabel: 'Classes'.

"c addDecoration: (RSVerticalTick new 
    numberOfTicks: 10;
    asFloat)."
c ylabel: 'Lines of code'.
c title: 'Collection withAllSubClasses'.

c addDecoration: (vertical := RSVerticalTick new).
vertical shape dashed.
vertical numberOfTicks: 10.
vertical configuration tickSize: c extent x negated.
c yLog.
c build.
popup := RSPopup text: [ :cls | cls name, String crlf, cls linesOfCode asString ].


ellipses := c canvas shapes select: [ :shape | shape class = RSEllipse ].
ellipses with: classes do: [ :shape :cls |
    shape model: cls.
    shape addInteraction: popup.
     ].
c canvas

image

Should RSChart have a general scale for all their plots and decorations?

akevalion avatar Nov 28 '20 01:11 akevalion

We can close this as it was fixed on: https://github.com/ObjectProfile/Roassal3/pull/528

jordanmontt avatar May 02 '23 09:05 jordanmontt

Mark as done

akevalion avatar May 30 '23 11:05 akevalion