Skip to content

Commit

Permalink
added errorMargin: for RSViolinPlot
Browse files Browse the repository at this point in the history
  • Loading branch information
akevalion committed Oct 18, 2023
1 parent c31fbdb commit 9c84d0a
Show file tree
Hide file tree
Showing 139 changed files with 2,008 additions and 1,790 deletions.
8 changes: 5 additions & 3 deletions src/Roassal-Builders/RSAbstractContainerBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
I have here for compatibility. Use `RSBuilder`
"
Class {
#name : #RSAbstractContainerBuilder,
#superclass : #RSBuilder,
#category : #'Roassal-Builders-Core'
#name : 'RSAbstractContainerBuilder',
#superclass : 'RSBuilder',
#category : 'Roassal-Builders-Core',
#package : 'Roassal-Builders',
#tag : 'Core'
}
16 changes: 9 additions & 7 deletions src/Roassal-Builders/RSAbstractShapesBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,29 @@ I redefine #renderIn:
My subclasses needs to implement #objects and: #shapesFor:
"
Class {
#name : #RSAbstractShapesBuilder,
#superclass : #RSBuilder,
#category : #'Roassal-Builders-Core'
#name : 'RSAbstractShapesBuilder',
#superclass : 'RSBuilder',
#category : 'Roassal-Builders-Core',
#package : 'Roassal-Builders',
#tag : 'Core'
}

{ #category : #hooks }
{ #category : 'hooks' }
RSAbstractShapesBuilder >> objects [
^ self subclassResponsibility
]

{ #category : #rendering }
{ #category : 'rendering' }
RSAbstractShapesBuilder >> renderIn: aCanvas [
aCanvas addAll: (shapes := self shapesFor: self objects)
]

{ #category : #hooks }
{ #category : 'hooks' }
RSAbstractShapesBuilder >> shapeFor: anObject index: index [
^ self subclassResponsibility
]

{ #category : #hooks }
{ #category : 'hooks' }
RSAbstractShapesBuilder >> shapesFor: aCollection [
| k |
k := 0.
Expand Down
48 changes: 25 additions & 23 deletions src/Roassal-Builders/RSAbstractTreeBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
I am a abstract class to create visual elements based on tree structured in Roassal
"
Class {
#name : #RSAbstractTreeBuilder,
#superclass : #RSBuilder,
#name : 'RSAbstractTreeBuilder',
#superclass : 'RSBuilder',
#instVars : [
'rootNodes',
'weight'
],
#category : #'Roassal-Builders-Core'
#category : 'Roassal-Builders-Core',
#package : 'Roassal-Builders',
#tag : 'Core'
}

{ #category : #private }
{ #category : 'private' }
RSAbstractTreeBuilder >> createElements: atree nesting: block1 leaves: block2 depth: depth [
| children aShape leaves nodes|

Expand All @@ -37,7 +39,7 @@ RSAbstractTreeBuilder >> createElements: atree nesting: block1 leaves: block2 de
^ aShape
]

{ #category : #private }
{ #category : 'private' }
RSAbstractTreeBuilder >> createElements: atree using: ablock depth: depth [
| children shape |

Expand All @@ -54,86 +56,86 @@ RSAbstractTreeBuilder >> createElements: atree using: ablock depth: depth [
^ shape
]

{ #category : #'public - building' }
{ #category : 'public - building' }
RSAbstractTreeBuilder >> explore: atree nesting: block1 leaves: block2 [
shapes := RSGroup new.
^ (self from: (Array with: atree) nesting: block1 leaves: block2) first
]

{ #category : #'public - building' }
{ #category : 'public - building' }
RSAbstractTreeBuilder >> explore: atree using: ablock [
shapes := RSGroup new.
^ (self from: (Array with: atree) using: ablock) first
]

{ #category : #'public - building' }
{ #category : 'public - building' }
RSAbstractTreeBuilder >> from: objects nesting: block1 leaves: block2 [
shapes := RSGroup new.
rootNodes := objects collect: [:obj | self createElements: obj nesting: block1 leaves: block2 depth: 1 ].
^ rootNodes
]

{ #category : #'public - building' }
{ #category : 'public - building' }
RSAbstractTreeBuilder >> from: objects using: ablock [
shapes := RSGroup new.
"This is the main public method. Takes a list of objects, and a block to specify how to recurse"
rootNodes := objects collect: [:obj | self createElements: obj using: ablock depth: 1 ].
^ rootNodes
]

{ #category : #initialization }
{ #category : 'initialization' }
RSAbstractTreeBuilder >> initialize [
super initialize.
rootNodes := RSGroup new
]

{ #category : #weight }
{ #category : 'weight' }
RSAbstractTreeBuilder >> leafWeight: block [
self weight: [ :shape | self weightLeafShape: shape block: block ]
]

{ #category : #'accessing - defaults' }
{ #category : 'accessing - defaults' }
RSAbstractTreeBuilder >> minWeightValue [
^ 1
]

{ #category : #weight }
{ #category : 'weight' }
RSAbstractTreeBuilder >> modelWeight: anObject [
self weight: [ :shape | anObject rsValue: shape model ]
]

{ #category : #rendering }
{ #category : 'rendering' }
RSAbstractTreeBuilder >> renderIn: aCanvas [
aCanvas addAll: self shapes
]

{ #category : #accessing }
{ #category : 'accessing' }
RSAbstractTreeBuilder >> rootNodes [
^ rootNodes
]

{ #category : #accessing }
{ #category : 'accessing' }
RSAbstractTreeBuilder >> rootNodes: anArray [
rootNodes := anArray
]

{ #category : #hooks }
{ #category : 'hooks' }
RSAbstractTreeBuilder >> shapeFor: anObject [
^ self subclassResponsibility
]

{ #category : #weight }
{ #category : 'weight' }
RSAbstractTreeBuilder >> weight [
^ weight
]

{ #category : #weight }
{ #category : 'weight' }
RSAbstractTreeBuilder >> weight: anObject [
"one arg block, example [:aRoassalShape | ]"
weight := anObject
]

{ #category : #private }
{ #category : 'private' }
RSAbstractTreeBuilder >> weightFromChildren: shape block: aBlock [
| children weightValue |
children := shape schildren.
Expand All @@ -146,20 +148,20 @@ RSAbstractTreeBuilder >> weightFromChildren: shape block: aBlock [
^ weightValue max: self minWeightValue
]

{ #category : #'accessing - keys' }
{ #category : 'accessing - keys' }
RSAbstractTreeBuilder >> weightKey [
^ #weight
]

{ #category : #private }
{ #category : 'private' }
RSAbstractTreeBuilder >> weightLeafShape: shape block: aBlock [
^ shape
propertyAt: self weightKey
ifAbsentPut: [
self weightFromChildren: shape block: aBlock ]
]

{ #category : #weight }
{ #category : 'weight' }
RSAbstractTreeBuilder >> weightOf: aShape [
^ self weight rsValue: aShape
]
16 changes: 9 additions & 7 deletions src/Roassal-Builders/RSAbstractWrapStrategy.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,33 @@
My subclasses can define the way to wrap a text
"
Class {
#name : #RSAbstractWrapStrategy,
#superclass : #RSObject,
#name : 'RSAbstractWrapStrategy',
#superclass : 'RSObject',
#instVars : [
'wrapMaxWidth'
],
#category : #'Roassal-Builders-Text'
#category : 'Roassal-Builders-Text',
#package : 'Roassal-Builders',
#tag : 'Text'
}

{ #category : #initialization }
{ #category : 'initialization' }
RSAbstractWrapStrategy >> initialize [
super initialize.
self wrapMaxWidth: 200
]

{ #category : #accessing }
{ #category : 'accessing' }
RSAbstractWrapStrategy >> wrapMaxWidth [
^ wrapMaxWidth
]

{ #category : #accessing }
{ #category : 'accessing' }
RSAbstractWrapStrategy >> wrapMaxWidth: aNumber [
wrapMaxWidth := aNumber
]

{ #category : #hooks }
{ #category : 'hooks' }
RSAbstractWrapStrategy >> wrapTextFor: aString with: aRSMultilineLabelBuilder [
^ self subclassResponsibility
]
Loading

0 comments on commit 9c84d0a

Please sign in to comment.