eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'PieChartWidget':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: PieChartWidget


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--PieChartWidget

Package:
stx:libwidg3
Category:
Views-Graphs
Version:
rev: 1.23 date: 2023/07/06 14:35:33
user: cg
file: PieChartWidget.st directory: libwidg3
module: stx stc-classLibrary: libwidg3

Description:


This is a demo widget programmed as a learning experience...

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.



[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

copyright

COPYRIGHT (c) 1998 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Instance protocol:

accessing
o  anzahl
return the value of the instance variable 'anzahl' (automatically generated)

o  anzahl: something
set the value of the instance variable 'anzahl' (automatically generated)

o  aoHilf
return the value of the instance variable 'aoHilf' (automatically generated)

o  aoHilf: something
set the value of the instance variable 'aoHilf' (automatically generated)

o  aod
return the value of the instance variable 'aod' (automatically generated)

o  aod: something
set the value of the instance variable 'aod' (automatically generated)

o  label
(comment from inherited method)
return the view's label - this is nil here

o  label: aString
(comment from inherited method)
set the view's label.
Ignored here.

o  middlePoint
return the value of the instance variable 'middlePoint' (automatically generated)

o  middlePoint: aPoint
set the value of the instance variable 'middlePoint' (automatically generated)

o  model: newModel
(comment from inherited method)
Set the model.
Here, if I am my own menuPerformer/menuHolder,
set the menuHolder and menuPerformer to the model.
This is a compatibility kludge,
since typically, ST-80 code expects the model to provide a menu
and perform it. If the model does not support a menu message,
it will be forwarded to the view.
Those apps which want the view to provide the (default) menu have to reset
this by sending #menuHolder: message (again)

o  newfont
return the value of the instance variable 'newfont' (automatically generated)

o  newfont: something
set the value of the instance variable 'newfont' (automatically generated)

o  oldfont
return the value of the instance variable 'oldfont' (automatically generated)

o  oldfont: something
set the value of the instance variable 'oldfont' (automatically generated)

o  pieChartName
return the value of the instance variable 'pieChartName' (automatically generated)

o  pieChartName: something
set the value of the instance variable 'pieChartName' (automatically generated)

o  rF
return the value of the instance variable 'rF' (automatically generated)

o  rF: something
set the value of the instance variable 'rF' (automatically generated)

o  radX
return the value of the instance variable 'radX' (automatically generated)

o  radX: something
set the value of the instance variable 'radX' (automatically generated)

o  radY
return the value of the instance variable 'radY' (automatically generated)

o  radY: something
set the value of the instance variable 'radY' (automatically generated)

o  style
return the value of the instance variable 'style' (automatically generated)

o  style: something
set the value of the instance variable 'style' (automatically generated)

o  summe
return the value of the instance variable 'summe' (automatically generated)

o  summe: something
set the value of the instance variable 'summe' (automatically generated)

accessing-color & font
o  backgroundColor
return the value of the instance variable 'backgroundColor' (automatically generated)

o  backgroundColor: something
set the value of the instance variable 'backgroundColor' (automatically generated)

o  foregroundColor
return the value of the instance variable 'foregroundColor' (automatically generated)

o  foregroundColor: something
set the value of the instance variable 'foregroundColor' (automatically generated)

change & update
o  delayedUpdateModel

o  update: something with: aParameter from: changedObject

drawing
o  drawLogo
put demo values into model

o  drawLogo2
zeichnet den pie-Umfang

o  drawPercentDescription
Prozentausgabe der Diagrammstücke

o  drawPieChart
get number of pieces

o  drawPiePieces
draw a filled arc in a box, given startAngle and endAngle.

o  redrawPieChart
compute spacing need for my used font.

o  writeLabel

event handling
o  redrawX: x y: y width: w height: h
(comment from inherited method)
redraw part of myself immediately, given logical coordinates
(if transformation is nonNil)
The default here is to redraw everything
- subclasses usually redefine this, adding more intelligence

o  sizeChanged: how from: oldExtentOrNil
my view has changed the size (not the contents)

hooks
o  postBuildWith: aBuilder
automatically generated by UIPainter ...

Usage example(s):

super postBuildWith:aBuilder

initialization
o  initialize
initialisierung und sein Kind

Usage example(s):

      self initialize

private
o  fillAod
fills the Dictionaries in Array with Values

o  getAnzahl
ermittelt die Anzahl der belegten Diagrammstücke

o  getSumme
initialisiert die Instanzvariable summe mit der Gesammtsumme

views
o  getPieChartWidget


Examples:


        |p chart piece holder|

        chart := OrderedCollection new.
        piece := Dictionary new.
        piece at:#value put:50.
        piece at:#color put:Color red.
        chart add:piece.

        piece := Dictionary new.
        piece at:#value put:100.
        piece at:#color put:Color blue.
        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] 
                                       ifFalse:[Color magenta]).
            chart add:piece.

            holder value:nil.
            holder value:chart.
        ]


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Wed, 27 Nov 2024 05:17:13 GMT