Skip to content

Instantly share code, notes, and snippets.

@iriyak
Created September 27, 2025 06:07
Show Gist options
  • Save iriyak/dbab54d96140ff24d31c8764b555e502 to your computer and use it in GitHub Desktop.
Save iriyak/dbab54d96140ff24d31c8764b555e502 to your computer and use it in GitHub Desktop.
Object subclass: #MyScatterChartExamples
instanceVariableNames: 'aResource'
classVariableNames: ''
package: 'KITestResourceInGtExample'!
!MyScatterChartExamples methodsFor: 'as yet unclassified' stamp: 'GlamorousAuthor 9/27/2025 14:54'!
withProjectionAxis
<gtExample>
| aChart |
self setUp.
aChart := self pointEventHandler.
aChart withProjectionAxis.
^ aChart! !
!MyScatterChartExamples methodsFor: 'as yet unclassified' stamp: 'GlamorousAuthor 9/27/2025 14:51'!
dotElement
<gtExample>
| aChart |
self setUp.
aChart := self basicChart.
aChart
dotElement: [ BlElement new
geometry: BlSquareGeometry new;
size: 3 asPoint ].
^ aChart! !
!MyScatterChartExamples methodsFor: 'as yet unclassified' stamp: 'GlamorousAuthor 9/27/2025 14:53'!
basicChart
<gtExample>
| aChart dataset |
self setUp.
dataset := aResource dataset.
aChart := GtPlotterScatterChart new
with: (GtPlotterDataGroup new values: dataset);
valueX: [ :e | e at: 1 ];
scaleX: GtPlotterLinearScale new;
titleX: 'X';
valueY: [ :e | e at: 2 ];
scaleY: GtPlotterLinearScale new;
titleY: 'Y'.
^ aChart! !
!MyScatterChartExamples methodsFor: 'as yet unclassified' stamp: 'GlamorousAuthor 9/27/2025 13:19'!
setUp
aResource := MyTestData current! !
!MyScatterChartExamples methodsFor: 'as yet unclassified' stamp: 'GlamorousAuthor 9/27/2025 14:54'!
pointEventHandler
<gtExample>
| aChart |
self setUp.
aChart := self with.
aChart pointEventHandler
highlightBlock: [ :e | e background: (Color red alpha: 0.8) ];
unhighlightBlock: [ :e | e background: (Color veryDarkGray alpha: 0.3) ].
^ aChart! !
!MyScatterChartExamples methodsFor: 'as yet unclassified' stamp: 'GlamorousAuthor 9/27/2025 14:51'!
with
<gtExample>
| aChart |
self setUp.
aChart := self basicChart.
aChart with: (aChart data background: (Color veryDarkGray alpha: 0.3)).
^ aChart! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
MyScatterChartExamples class
instanceVariableNames: ''!
!MyScatterChartExamples class methodsFor: 'as yet unclassified' stamp: 'GlamorousAuthor 9/27/2025 13:19'!
resources
^ {MyTestData}! !
TestResource subclass: #MyTestData
instanceVariableNames: 'dataset generator'
classVariableNames: ''
package: 'KITestResourceInGtExample'!
!MyTestData methodsFor: 'as yet unclassified' stamp: 'GlamorousAuthor 9/27/2025 12:58'!
dataset
^ dataset! !
!MyTestData methodsFor: 'as yet unclassified' stamp: 'GlamorousAuthor 9/27/2025 14:57'!
setUp
super setUp.
Transcript
crTrace: self class printString , '>>setUp is performed at '
, DateAndTime now printString;
cr.
generator := Random seed: 14159265.
dataset := (-100 to: 100)
collect: [ :e | Array with: e with: e * generator next ]! !
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment