eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'BarChartWidget':

Home

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

Class: BarChartWidget


Inheritance:

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

Package:
stx:libwidg3
Category:
Views-Graphs
Version:
rev: 1.20 date: 2023/11/29 15:21:33
user: cg
file: BarChartWidget.st directory: libwidg3
module: stx stc-classLibrary: libwidg3

Description:


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

hallo erstmal...

a simple BarChart, 

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:]
    minWidth        left Viewport limit 
    maxWidth        right Viewport limit
    maxHeight       top Viewport limit
    minHeight       bottom Viewport limit
    xAbstand        difference between vertical lines
    yMaxScale       limit of horizontal value
    anzahl          number of values
    summe           summe of all values
    maxWert         biggest value
    schrumpf        factor of ...
    aod             Aray of Dictionaries
    foregroundColor color for label
    backgroundColor color for background lines
    label1          name of bar chart
    style           fontstyle
    newfont 
    oldfont

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  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  barChartName
return the value of the instance variable 'barChartName' (automatically generated)

o  barChartName: something
set the value of the instance variable 'barChartName' (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  maxHeight
return the value of the instance variable 'maxHeight' (automatically generated)

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

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

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

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

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

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

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

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

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

o  model: newModel
set the value of the instance variable 'model' (automatically generated)

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  schrumpf
return the value of the instance variable 'schrumpf' (automatically generated)

o  schrumpf: something
set the value of the instance variable 'schrumpf' (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)

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

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

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

o  yMaxScale: something
set the value of the instance variable 'yMaxScale' (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  update: something with: aParameter from: changedObject

drawing
o  drawBarBars
draw some filled rectangle as like bars in a barChart.

o  drawBarChart
get number of bars

o  drawBarScale
xAbstand is a instanzVariable

o  drawBarScale2
xAbstand is a instanzVariable

o  drawLogo
put demo values into model

o  redrawBarChart
Instanzvariablen initialisieren

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

private
o  getAnzahl
ermittelt die Anzahl der belegten Diagrammstücke

o  getMaxWert
initialisiert die Instanzvariable maxWert mit dem größten Wert

o  getSumme
initialisiert die Instanzvariable summe mit der Gesamtsumme

o  standardColors

o  valuesDo: aBlock

views
o  getBarChartWidget


Examples:


        |p chart bars holder|

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

        bars := Dictionary new.
        bars at:#value put:100.
        bars at:#color put:Color blue.
        chart add:bars.

        p := BarChartWidget new.
        p model:(holder := ValueHolder new).
        p extent:400@250.
        p label:'demo BarChart'.
        p open.
        holder value:chart.
        Delay waitForSeconds:2.

        1 to: 5 do:[:i |
            bars := Dictionary new.
            bars at:#value put:30.

            bars at:#color put:(i odd ifTrue:[Color green] 
                                       ifFalse:[Color magenta]).
            chart add:bars.

            holder value:nil.
            holder value:chart.
        ]


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 05:49:25 GMT