File: GChartExample01.py

package info (click to toggle)
pyjamas 0.7~%2Bpre2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,656 kB
  • ctags: 12,331
  • sloc: python: 74,493; php: 805; sh: 291; makefile: 59; xml: 9
file content (27 lines) | stat: -rw-r--r-- 928 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

from pyjamas.chart.GChart import GChart
from pyjamas.chart import SymbolType

"""*
* Defines a bar-chart of x*x vs. x, with gridlines.
"""
class GChartExample01(GChart):
    def __init__(self):
        GChart.__init__(self)
        self.setChartTitle("<b>x<sup>2</sup> vs x</b>")
        self.setChartSize(150, 150)
        self.addCurve()
        for i in range(10):
            self.getCurve().addPoint(i,i*i)
        self.getCurve().setLegendLabel("x<sup>2</sup>")
        self.getCurve().getSymbol().setSymbolType(SymbolType.VBAR_SOUTH)
        self.getCurve().getSymbol().setBackgroundColor("red")
        self.getCurve().getSymbol().setBorderColor("black")
        self.getCurve().getSymbol().setModelWidth(1.0)
        self.getXAxis().setAxisLabel("<b>x</b>")
        self.getXAxis().setHasGridlines(True)
        self.getYAxis().setAxisLabel("<b>x<sup>2</sup></b>")
        self.getYAxis().setHasGridlines(True)