Skip to content

Commit

Permalink
Update RSPieChartExample
Browse files Browse the repository at this point in the history
  • Loading branch information
akevalion committed Jan 26, 2023
1 parent 7865c2e commit 3009496
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions src/Roassal3-Spec-Examples/RSPieChartExample.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,9 @@ RSPieChartExample class >> defaultLayout [
yourself
]

{ #category : #accessing }
RSPieChartExample >> chart [
^ chart
]

{ #category : #accessing }
RSPieChartExample >> droplist [
^ droplist
]

{ #category : #initialization }
RSPieChartExample >> initializePresenters [
| org |
| org selectedItem |
droplist := self instantiate: SpDropListPresenter.
org := RPackage organizer.
packages := (org packageNames
Expand All @@ -47,35 +37,34 @@ RSPieChartExample >> initializePresenters [
sorted: [ :a :b | a linesOfCode > b linesOfCode ].
totalSum := packages max: #linesOfCode.
droplist
"label: 'Roassal Packages';"
items: packages;
display: [ :i | i name ].
chart := self newRoassal.
pie := self newRoassal.
droplist whenSelectedItemChangedDo: [ :pkg |
chart script: [ :aCanvas |
aCanvas
when: RSExtentChangedEvent
do: [ aCanvas edges copy do: #remove.
aCanvas nodes copy do: #remove.
self visualizeChart: aCanvas package: pkg ] ].
pie script: [ :view | self visualizePie: view package: pkg ] ].
droplist selectIndex: 1
selectedItem := packages first.
chart script: [ :aCanvas |
aCanvas
when: RSExtentChangedEvent
do: [ aCanvas edges copy do: #remove.
aCanvas nodes copy do: #remove.
self visualizeChart: aCanvas package: selectedItem ] ].
pie script: [ :view | self visualizePie: view package: selectedItem ].

droplist whenSelectedItemChangedDo: [ :pkg |
selectedItem := pkg.
chart refresh.
pie refresh.
]
]

{ #category : #initialization }
RSPieChartExample >> initializeWindow: w [
w
RSPieChartExample >> initializeWindow: aWindow [
aWindow
title: 'Roassal packages';
initialExtent: 800@500;
centered
]

{ #category : #accessing }
RSPieChartExample >> pie [
^ pie
]

{ #category : #running }
RSPieChartExample >> run [
<script: 'self new asWindow open'>
Expand Down

0 comments on commit 3009496

Please sign in to comment.