Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
NumberLineMorph
Last updated at 7:37 am UTC on 10 November 2020
 NumberLineMorph subclass: #HorizontalNumberLineMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Etoys-Squeakland-MorphicExtras-Charts'

An abstract superclass for VerticalNumberLine and HorizontalNumberLine.

minValue - Number - the value corresponding to the left edge of the line.
pixelsPerUnit - Integer - the number of pixels on the graph that correspond to a single unit in the metric space of the line.
actualColor - the color borne by the axis
axis - a two-vertex PolygonMorph which is the actual line
showZero - Boolean - if false, then a 0 legend will not be show.


 NumberLineMorph subclasses
     {HorizontalNumberLineMorph . VerticalNumberLineMorph}
HorizontalNumberLines.png
c := Color white. w := 650.
container := Morph  newBounds: (0@0 extent: w@200) color: c.
container layoutPolicy: TableLayout new.
container listDirection: #topToBottom.

m := Morph newBounds: (0@0 extent: w@50) color: c.
m2 := (HorizontalNumberLineMorph from: 0 pixelsPerUnit: 50 unitsPerMark: 1 marksPerLegend: 1) update.
m addMorphBack: m2.
container addMorphBack: m.


m := Morph newBounds: (0@0 extent: w@50) color: c.
m2 := (HorizontalNumberLineMorph from: 0 pixelsPerUnit: 5 unitsPerMark: 5 marksPerLegend: 10) update.
m addMorphBack: m2.
container addMorphBack: m.


m := Morph newBounds: (0@0 extent: w@50) color: c.
m2 := (HorizontalNumberLineMorph from: 0 pixelsPerUnit: 10 unitsPerMark: 5 marksPerLegend: 1) update.
m addMorphBack: m2.
container addMorphBack: m.


m := Morph newBounds: (0@0 extent: w@50) color: c.
m2 := (HorizontalNumberLineMorph from: 0 pixelsPerUnit: 2 unitsPerMark: 20 marksPerLegend: 20) update.
m addMorphBack: m2.
container addMorphBack: m.

m := Morph newBounds: (0@0 extent: w@50) color: c.
m2 := (HorizontalNumberLineMorph from: 0 pixelsPerUnit: 1 unitsPerMark: 50 marksPerLegend: 50) update.
m addMorphBack: m2.
container addMorphBack: m.

container openInWorld.
container exportAsPNGNamed: 'HorizontalNumberLines.png'