Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
nu444 committed Jul 8, 2024
1 parent 80c7814 commit 2a40868
Show file tree
Hide file tree
Showing 40 changed files with 124 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ addDatapointsToLine
self removeAllDatapoints.
1 to: self data size do: [:index |
dataPoint := SWDataPoint create: (self data at: index) at: (self vertices at: (index+1)).
dataPoint color: Color transparent;
dataPoint
color: Color transparent;
suffix: self dataSuffix;
position: dataPoint renderedPoint.
self dataPoints add: dataPoint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ as yet unclassified
initialize

super initialize.
self lineMorph: self createLineMorph;
self
lineMorph: self createLineMorph;
lineColor: self class defaultColor;
dataPoints: OrderedCollection new;
dataSuffix: ''
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"class" : {
"create" : "Nils Urban 5/28/2024 10:10" },
"instance" : {
"addDatapointsToLine" : "Nils Urban 6/12/2024 14:38",
"addDatapointsToLine" : " Nils Urban 7/8/2024 11:08",
"createLineMorph" : "JB 6/18/2024 22:50",
"createVertices" : "Nils Urban 5/28/2024 10:47",
"initialize" : "Nils Urban 6/12/2024 14:39",
"initialize" : " Nils Urban 7/8/2024 11:08",
"update" : "Nils Urban 6/7/2024 10:04" } }
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
accessing
bottomCaption: aString

| bottomTextMorph |
| bottomTextMorph labelMorph |

bottomTextMorph := TextMorph new.
bottomTextMorph contents: aString.
bottomTextMorph color: self captionColor.
self bottomLabelMorph: TransformationMorph new.
self bottomLabelMorph addMorph: bottomTextMorph.
self bottomLabelMorph angle: (0.25 * (Float pi)).
self bottomLabelMorph topRight: self bottomCenter.
self addMorph: self bottomLabelMorph.
bottomTextMorph
contents: aString;
color: self captionColor.
labelMorph := TransformationMorph new.
labelMorph
addMorph: bottomTextMorph;
angle: (0.25 * (Float pi));
topRight: self bottomCenter.
self
addMorph: labelMorph;
bottomLabelMorph: labelMorph
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ caption: aString

self barLabelMorph: TextMorph new.
self barLabelMorph center: self barLabelMorph center + self defaultLabelOffset.

self rotationMorph: TransformationMorph new.
self rotationMorph addMorph: self barLabelMorph.
self addMorph: self rotationMorph.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
infoPopup: aTextMorph

infoPopup := aTextMorph
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
infoPopup

^ infoPopup
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
geometry
isHidden

^isHidden
^ isHidden
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ mouseDown: anEvent
ifTrue: [
owner data at: self datapointIndex put: (SWVector fromPoint: ((owner data at: self datapointIndex) x) @ 0).
owner originalData at: self datapointIndex put: (SWVector fromPoint: ((owner originalData at: self datapointIndex) x) @ 0).
owner diagram redrawChangedData.
].
owner diagram redrawChangedData.].
(anEvent redButtonPressed)
ifTrue: [self switchColor].
anEvent hand waitForClicksOrDrag: self event: anEvent
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@
"barLabelMorph:" : "ds 6/19/2020 19:12",
"bottom" : "ds 6/19/2020 19:12",
"bottom:" : "ds 6/19/2020 19:12",
"bottomCaption:" : " Nils Urban 6/21/2024 16:56",
"bottomCaption:" : " Nils Urban 7/8/2024 11:14",
"bottomCaptionHeight" : " Nils Urban 6/21/2024 16:59",
"bottomLabelMorph" : " Nils Urban 6/21/2024 16:36",
"bottomLabelMorph:" : " Nils Urban 6/21/2024 16:36",
"caption:" : " Nils Urban 6/21/2024 16:56",
"caption:" : " Nils Urban 7/8/2024 11:18",
"captionColor" : "Nils Urban 6/13/2024 01:42",
"captionColor:" : "Nils Urban 6/13/2024 01:42",
"defaultBarLabelOffset" : "ds 6/19/2020 19:13",
"defaultCharWidth" : "ds 6/19/2020 19:13",
"defaultLabelOffset" : "ds 6/19/2020 19:13",
"handlesMouseOver:" : "FM 5/30/2021 10:35",
"infoPopup" : "FM 5/30/2021 10:40",
"infoPopup:" : "FM 5/30/2021 10:40",
"infoPopup" : " Nils Urban 7/8/2024 11:18",
"infoPopup:" : " Nils Urban 7/8/2024 11:18",
"initialize" : " Nils Urban 6/23/2024 21:53",
"isHidden" : "Nils Urban 6/13/2024 00:56",
"isHidden" : " Nils Urban 7/8/2024 11:18",
"isHidden:" : "Nils Urban 6/13/2024 01:18",
"isLabelHorizontal" : "ds 6/19/2020 19:13",
"isLabelHorizontal:" : "ds 6/19/2020 19:13",
"isLabelTooLong" : "ds 6/19/2020 19:38",
"isTextHigherThanBar" : "ds 6/19/2020 19:39",
"minimumLabelWidth" : "ds 6/19/2020 19:39",
"mouseDown:" : " Nils Urban 6/23/2024 22:30",
"mouseDown:" : " Nils Urban 7/8/2024 11:19",
"mouseEnter:" : " Nils Urban 6/23/2024 22:35",
"mouseLeave:" : "Nils Urban 6/14/2024 14:16",
"raiseBarLabel" : "ds 6/19/2020 19:39",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ createBarsFrom: aSWData
bottom: self barBottom;
captionColor: self barLabelColor;
yourself).
((self data at: index) y = 0) ifFalse: ["bar caption: vector labelName." bar bottomCaption: vector labelName].
((self data at: index) y = 0)
ifFalse: [(self diagram stacked)
ifTrue: [bar caption: vector labelName.]
ifFalse: [bar bottomCaption: vector labelName.]].
self add: bar]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ update

self applyTheme: self diagram colorTheme.
self diagram updateCoordinateSystem.
self
removeAll;
self removeAll;
createBarsFrom: self data
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"barWidth:" : "ds 6/19/2020 18:54",
"bars" : "ds 6/19/2020 18:54",
"bars:" : "ds 6/19/2020 18:54",
"createBarsFrom:" : " Nils Urban 6/21/2024 17:06",
"createBarsFrom:" : " Nils Urban 7/8/2024 11:53",
"dataColor" : "PAR 8/6/2021 13:30",
"dynamicBarWidth" : "JB 6/19/2024 22:33",
"initialize" : "Nils Urban 6/14/2024 15:56",
Expand All @@ -29,4 +29,4 @@
"removeAll" : "ds 6/19/2020 18:55",
"requiredCoordinateSystem" : "FM 7/9/2021 17:12",
"supportsShowMean" : "jk 8/4/2020 17:58",
"update" : "IK 5/18/2021 20:22" } }
"update" : " Nils Urban 7/8/2024 11:00" } }
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ createDataPoint: aSWVector

dataPoint := SWDataPoint create: aSWVector at: (self coordinateSystem positionFor: aSWVector asPoint) size: (self scaledBubbleSize: (aSWVector third)).
dataPoint color: (self pointColor alpha: 0.7).

(aSWVector third > (self threshold)) ifTrue: [dataPoint height: 0. dataPoint width: 0].

^ dataPoint
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ data: dataSet
data := dataSet.
data addDependent: self.
self threshold: (data maximum: #z).
self update;
self
update;
changed: self
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
maxValuesPerData

^maxValuesPerData
^ maxValuesPerData
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ as yet unclassified
receiveValue: aValue

self threshold: aValue.
self update.
self update
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
threshold

^threshold
^ threshold
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"class" : {
"create" : "Nils Urban 6/13/2024 10:24" },
"instance" : {
"createDataPoint:" : "JB 6/19/2024 21:45",
"data:" : " Nils Urban 6/23/2024 23:42",
"createDataPoint:" : " Nils Urban 7/8/2024 10:57",
"data:" : " Nils Urban 7/8/2024 11:09",
"diagram:" : " Nils Urban 6/21/2024 15:20",
"dynamicMaxBubbleSize" : " Nils Urban 6/21/2024 14:48",
"initialize" : " Nils Urban 6/21/2024 15:11",
"maxValuesPerData" : " Nils Urban 6/21/2024 15:04",
"maxValuesPerData" : " Nils Urban 7/8/2024 10:58",
"maxValuesPerData:" : " Nils Urban 6/21/2024 14:48",
"receiveValue:" : "JB 6/19/2024 02:39",
"receiveValue:" : " Nils Urban 7/8/2024 10:58",
"scaledBubbleSize:" : " Nils Urban 6/21/2024 15:23",
"threshold" : "Nils Urban 6/13/2024 11:20",
"threshold" : " Nils Urban 7/8/2024 10:58",
"threshold:" : "Nils Urban 6/13/2024 11:20" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ updating
updateRasterSize

self xAxis rasterLength: self yAxis length.
self yAxis rasterLength: self xAxis length.
self yAxis rasterLength: self xAxis length
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
"toggleCenteredAxes" : "jk 7/15/2020 15:53",
"toggleRaster" : "jk 7/15/2020 18:26",
"update" : "JB 6/9/2024 01:46",
"updateLegends" : "jk 8/5/2020 20:13",
"updateLegends" : " Nils Urban 7/8/2024 11:20",
"updateMaxX:maxY:" : "jk 8/5/2020 20:10",
"updateMinX:minY:" : "JB 6/9/2024 00:27",
"updateRanges" : "JB 6/9/2024 01:42",
"updateRasterSize" : "JB 6/9/2024 22:55",
"updateRasterSize" : " Nils Urban 7/8/2024 11:21",
"xAxis" : "ds 6/19/2020 19:58",
"xAxis:" : "ds 6/19/2020 19:59",
"yAxis" : "ds 6/19/2020 19:59",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,17 @@ addSlider
valueMorph := TextMorph new.
self addMorph: sliderMorph.
self addMorph: valueMorph.

sliderMorph
extent: (100 @ 500);
position: ((self position x - 150)@(self position y));
orientation: #vertical;
minVal: (self globalMinimum: #z);
maxVal: (self globalMaximum: #z);
setValue: 1.

self configureSlider: sliderMorph.
valueMorph
extent: (20@50);
backgroundColor: Color white;
position: ((self position x - 150)@(self position y + (sliderMorph height)));
contents: (Text fromString: 'haloo').

self sliderValueMorph: valueMorph.
self sliderMorph: sliderMorph.

self sendToCharts: sliderMorph getNumericValue.

sliderMorph target: self.
sliderMorph arguments: OrderedCollection new.
sliderMorph actionSelector: #sendToCharts:
self
sliderValueMorph: valueMorph;
sliderMorph: sliderMorph;
sendToCharts: sliderMorph getNumericValue.
sliderMorph
target: self;
actionSelector: #sendToCharts:;
arguments: OrderedCollection new
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
accessing
configureSlider: aSliderMorph

aSliderMorph
extent: (100 @ 500);
position: ((self position x - 150)@(self position y));
orientation: #vertical;
minVal: (self globalMinimum: #z);
maxVal: (self globalMaximum: #z);
setValue: 1
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ exportIMG
[PNGReadWriter putForm: (self imageForm) onFileNamed: filePath] on: Error do: [:error |
self exportButton show.
error pass].
self exportButton show.
]
self exportButton show.]
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
geometry
extent: aPoint

|width labelHeight|
width := 0.
labelHeight := 0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ visualization
getColor: aCollection for: aChart

| index |

index := self charts indexOf: aChart ifAbsent: 1.
aCollection size >= index
ifTrue: [^ aCollection at: index]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ adding/removing
globalMaximum: aDimension

|chartMaxima|

chartMaxima := charts collect: [:aChart | aChart data maximum: aDimension].

^chartMaxima max
^ chartMaxima max
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ adding/removing
globalMinimum: aDimension

|chartMaxima|

chartMaxima := charts collect: [:aChart | aChart data minimum: aDimension].

^chartMaxima min
^ chartMaxima min
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
legend: anObject

legend := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
visualization
normalizeData: aSWData

| stack |
stack := (Array new: (aSWData first size)) collect: [:a | 0].
aSWData do: [:aData |
aData doWithIndex: [:vector :index |
stack at: index put: (vector y + (stack at: index))]].
aSWData do: [:aData |
aData doWithIndex: [:vector :index |
vector at: 2 put: (100 * (vector y) / stack at: index)]]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
adding/removing
normalized: aBool

normalized:= aBool
normalized := aBool
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
adding/removing
normalized

^normalized
^ normalized
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
sliderValueMorph

^sliderValueMorph
^ sliderValueMorph
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
visualization
stackData: aSWData

| stack |
stack := (Array new: (aSWData first size)) collect: [:a | 0].
aSWData do: [:aData |
aData doWithIndex: [:vector :index |
stack at: index put: (vector y + (stack at: index)).
vector at: 2 put: (stack at: index)]]
Loading

0 comments on commit 2a40868

Please sign in to comment.