|
Class: PieChart
Object
|
+--AbstractChart
|
+--PieChart
- Package:
- stx:libwidg3
- Category:
- Statistic-Charts
- Version:
- rev:
1.11
date: 2017/11/28 18:23:44
- user: cg
- file: PieChart.st directory: libwidg3
- module: stx stc-classLibrary: libwidg3
- Author:
- Timo Merkert (tm@idefix)
hallo erstmal...
a simple PieChart,
(zeigt ein Tortendiagramm, wobei die Stücke jedoch nicht essbar sind.)
The model is a collection of chart description items,
each being a dictionary filled with entries for:
#value aNumber the numeric value
#color aColor the color
see example on how to fill such a chartDescription model.
This was one of the author's very first Smalltalk programs ever.
So please excuse any odd code.
[instance variables:]
middlePoint, only for the point in the middle => therefore middlepoint
radX radian for x-coordinate
radY radian for y-coordinate
anzahl number of pie-pieces
summe result of all values
aod Array of Dictionaries
aoHilf Array with help coordinates
foregroundColor text color for percent displaying
backgroundColor background color of pie chart
label1 name of pie chart
BarChartWidget
ChartDescription
instance creation
-
new
-
startup
-
open
-
accessing
-
anzahl
-
return the value of the instance variable 'anzahl' (automatically generated)
-
anzahl: something
-
set the value of the instance variable 'anzahl' (automatically generated)
-
aoHilf
-
return the value of the instance variable 'aoHilf' (automatically generated)
-
aoHilf: something
-
set the value of the instance variable 'aoHilf' (automatically generated)
-
aod
-
return the value of the instance variable 'aod' (automatically generated)
-
aod: something
-
set the value of the instance variable 'aod' (automatically generated)
-
label
-
-
label: aString
-
-
middlePoint
-
return the value of the instance variable 'middlePoint' (automatically generated)
-
middlePoint: aPoint
-
set the value of the instance variable 'middlePoint' (automatically generated)
-
model: newModel
-
-
newfont
-
return the value of the instance variable 'newfont' (automatically generated)
-
newfont: something
-
set the value of the instance variable 'newfont' (automatically generated)
-
oldfont
-
return the value of the instance variable 'oldfont' (automatically generated)
-
oldfont: something
-
set the value of the instance variable 'oldfont' (automatically generated)
-
pieChartName
-
return the value of the instance variable 'pieChartName' (automatically generated)
-
pieChartName: something
-
set the value of the instance variable 'pieChartName' (automatically generated)
-
rF
-
return the value of the instance variable 'rF' (automatically generated)
-
rF: something
-
set the value of the instance variable 'rF' (automatically generated)
-
radX
-
return the value of the instance variable 'radX' (automatically generated)
-
radX: something
-
set the value of the instance variable 'radX' (automatically generated)
-
radY
-
return the value of the instance variable 'radY' (automatically generated)
-
radY: something
-
set the value of the instance variable 'radY' (automatically generated)
-
style
-
return the value of the instance variable 'style' (automatically generated)
-
style: something
-
set the value of the instance variable 'style' (automatically generated)
-
summe
-
return the value of the instance variable 'summe' (automatically generated)
-
summe: something
-
set the value of the instance variable 'summe' (automatically generated)
accessing-color & font
-
backgroundColor
-
return the value of the instance variable 'backgroundColor' (automatically generated)
-
backgroundColor: something
-
set the value of the instance variable 'backgroundColor' (automatically generated)
-
foregroundColor
-
return the value of the instance variable 'foregroundColor' (automatically generated)
-
foregroundColor: something
-
set the value of the instance variable 'foregroundColor' (automatically generated)
drawing
-
drawKeyOn: aForm inArea: aRect
-
-
drawLogo2On: aView
-
zeichnet den pie-Umfang
-
drawPercentDescriptionOn: aView
-
Prozentausgabe der Diagrammstücke
-
drawPieChartOn: aView
-
get number of pieces
-
drawPiePiecesOn: aView
-
draw a filled arc in a box, given startAngle and endAngle.
-
redrawPieChartOn: aView
-
-
redrawPieChartOn: aView inArea: anArea
-
Instanzvariablen initialisieren
-
writeLabelOn: aView
-
initialization
-
initialize
-
private
-
fillAod
-
fills the Dictionaries in Array with Values
-
getAnzahl
-
ermittelt die Anzahl der belegten Diagrammstücke
-
getSumme
-
initialisiert die Instanzvariable summe mit der Gesammtsumme
|p chart piece holder|
chart := OrderedCollection new.
piece := Dictionary new.
piece at:#value put:50.
piece at:#color put:(Color red onDevice:Display).
chart add:piece.
piece := Dictionary new.
piece at:#value put:100.
piece at:#color put:(Color blue onDevice:Display).
chart add:piece.
p := PieChartWidget new.
p model:(holder := ValueHolder new).
p extent:300@300.
p pieChartName:'demo PieChart'.
p open.
holder value:chart.
Delay waitForSeconds:2.
1 to: 5 do:[:i |
piece := Dictionary new.
piece at:#value put:30.
piece at:#color put:(i odd ifTrue:[Color green onDevice:Display]
ifFalse:[Color magenta onDevice:Display]).
chart add:piece.
holder value:nil.
holder value:chart.
]
|
|p chart piece holder v|
chart := OrderedCollection new.
piece := Dictionary new.
piece at:#value put:50.
piece at:#color put:(Color red onDevice:Display).
chart add:piece.
piece := Dictionary new.
piece at:#value put:100.
piece at:#color put:(Color blue onDevice:Display).
chart add:piece.
p := PieChart new.
p model:(holder := chart asValue).
p pieChartName:'demo PieChart'.
p.
v := View new.
v extent:300@300.
v open.
Delay waitForSeconds:1.
p redrawPieChartOn:v.
|
|