Skip to content
This repository
Browse code

more gchart update

git-svn-id: https://pyjamas.svn.sourceforge.net/svnroot/pyjamas/trunk@1606 7a2bd370-bda8-463c-979e-2900ccfb811e
  • Loading branch information...
commit abcce90f9f1e03dd2f054c1818b2e6e1e6ee23f2 1 parent bef4325
authored August 31, 2009
17  examples/gcharttestapp/GChartTestApp.py
@@ -8,6 +8,9 @@
8 8
 from pyjamas.chart import GChart
9 9
 
10 10
 from TestGChart00 import TestGChart00 
  11
+from TestGChart01 import TestGChart01 
  12
+from TestGChart02 import TestGChart02 
  13
+
11 14
 from GChartExample00 import GChartExample00 
12 15
 from GChartExample00a import GChartExample00a
13 16
 from GChartExample01 import GChartExample01 
@@ -154,7 +157,7 @@ def onModuleLoad():
154 157
     #    addChart(GChartExample04b())
155 158
     #    addChart(GChartExample05())
156 159
     #addChart(GChartExample06())
157  
-    addChart(GChartExample07())
  160
+    #addChart(GChartExample07())
158 161
     #    addChart(GChartExample08())
159 162
     #    addChart(GChartExample09())
160 163
     #    addChart(GChartExample10())
@@ -174,7 +177,7 @@ def onModuleLoad():
174 177
     #      addChart(GChartExample18())
175 178
     #      addChart(GChartExample18a())
176 179
     #      addChart(GChartExample19())
177  
-    addChart(GChartExample20())
  180
+    #addChart(GChartExample20())
178 181
     #      addChart(GChartExample20a())
179 182
     #addChart(GChartExample21())
180 183
     #      addChart(GChartExample22())
@@ -191,10 +194,10 @@ def onModuleLoad():
191 194
     #    
192 195
     #)
193 196
     #    addChart(TestGChart00())
194  
-    #    addChartNoUpdate(TestGChart01(0,0))
195  
-    #    addChartNoUpdate(TestGChart01(1,0))
196  
-    #    addChartNoUpdate(TestGChart01(2,0))
197  
-    #    addChartNoUpdate(TestGChart01(3,0))
  197
+    #addChartNoUpdate(TestGChart01(0,0))
  198
+    #addChartNoUpdate(TestGChart01(1,0))
  199
+    #addChartNoUpdate(TestGChart01(2,0))
  200
+    #addChartNoUpdate(TestGChart01(3,0))
198 201
     #    addChartNoUpdate(TestGChart01(0,1))
199 202
     #    addChartNoUpdate(TestGChart01(1,1))
200 203
     #    addChartNoUpdate(TestGChart01(2,1))
@@ -204,7 +207,7 @@ def onModuleLoad():
204 207
     #    addChartNoUpdate(TestGChart01(2,2))
205 208
     #    addChartNoUpdate(TestGChart01(3,2))
206 209
     #    addChart(TestGChart01a())
207  
-    #    addChart(TestGChart02())
  210
+    addChart(TestGChart02())
208 211
     #    addChart(TestGChart03())
209 212
     #    addChart(TestGChart04())
210 213
     #    addChart(TestGChart04a())
77  examples/gcharttestapp/TestGChart01.py
... ...
@@ -0,0 +1,77 @@
  1
+import GChartTestAppUtil
  2
+
  3
+from pyjamas.chart.GChart import GChart
  4
+from pyjamas.chart import GChartConsts
  5
+from pyjamas.chart import AnnotationLocation
  6
+from pyjamas.chart import SymbolType
  7
+
  8
+from pyjamas.ui.Button import Button
  9
+
  10
+msg = [["Check: all chart elements except labels red",
  11
+"Check: missing image icon appears on points and plot area.",
  12
+"Check: no missing image icon appears on chart area or points",
  13
+"Check: missing image icons appear on points and plot area iff IP connection is down (otherwise, 3D pies)"],
  14
+["Check: all points red",
  15
+"Check: missing image icon appears on all points",
  16
+"Check: no missing image icon appears on chart",
  17
+"Check: missing image icons appear on points iff IP connection is down (otherwise, 3D pies)."],
  18
+["Check: plot area red",
  19
+"Check: missing image icon appears on plot area",
  20
+"Check: no missing image icon appears on plot area",
  21
+"Check: missing image icon appears on plot area iff IP connection is down (otherwise, 3D pies)."]]
  22
+
  23
+imageURL = [
  24
+    "red.gif",
  25
+    "no-such-file.gif",
  26
+    "gchart.gif",
  27
+    "http://chart.apis.google.com/chart?cht=p3&chd=t:100&chs=500x200"
  28
+]
  29
+
  30
+"""* Simple a chart with just one point on it, used for testing
  31
+** methods for telling GChart to look for the blank gif in
  32
+** the host page, rather than the module base, directory. """
  33
+class TestGChart01 (GChart):
  34
+    def __init__(self, imageId, targetArea):
  35
+        GChart.__init__(self, XChartSize=500,YChartSize=200)
  36
+        self.setChartTitle(GChartTestAppUtil.getTitle(self)+" imageId="+str(imageId)+ " targetArea=" + str(targetArea))
  37
+
  38
+        self.setChartFootnotes(msg[targetArea][imageId])
  39
+        self.addCurve()
  40
+        if targetArea==0:
  41
+            self.setBlankImageURL(imageURL[imageId])
  42
+
  43
+        elif targetArea == 1:
  44
+            self.getCurve().getSymbol().setImageURL(imageURL[imageId])
  45
+
  46
+        elif targetArea == 2:
  47
+            self.setPlotAreaImageURL(imageURL[imageId])
  48
+
  49
+        if targetArea==0:
  50
+            if self.getBlankImageURL() != imageURL[imageId]:
  51
+                raise IllegalStateException("getBlankImageURL method failed.")
  52
+
  53
+
  54
+        elif targetArea == 1:
  55
+            if self.getCurve().getSymbol().getImageURL() != imageURL[imageId]:
  56
+                raise IllegalStateException("getImageURL method failed.")
  57
+
  58
+
  59
+        elif targetArea == 2:
  60
+            if self.getPlotAreaImageURL() != imageURL[imageId]:
  61
+                raise IllegalStateException("getPlotAreaImageURL method failed.");
  62
+
  63
+
  64
+
  65
+        self.getCurve().getSymbol().setModelHeight(1)
  66
+        self.getCurve().getSymbol().setModelWidth(1)
  67
+        self.getCurve().getSymbol().setBorderWidth(0)
  68
+        self.getCurve().addPoint(1, 1)
  69
+        self.getCurve().addPoint(2, 2)
  70
+        self.getCurve().addPoint(3, 3)
  71
+        self.getCurve().setLegendLabel("Curve 0")
  72
+        # restore default blank image URL for any future tests
  73
+        self.update()
  74
+        self.setBlankImageURL(GChartConsts.DEFAULT_BLANK_IMAGE_URL)
  75
+
  76
+
  77
+
92  examples/gcharttestapp/TestGChart02.py
... ...
@@ -0,0 +1,92 @@
  1
+import GChartTestAppUtil
  2
+from pyjamas.chart.GChart import GChart
  3
+from pyjamas.chart import SymbolType
  4
+
  5
+symbolTypes = [\
  6
+    SymbolType.BOX_CENTER,
  7
+    SymbolType.BOX_EAST,
  8
+    SymbolType.BOX_NORTH,
  9
+    SymbolType.BOX_NORTHEAST,
  10
+    SymbolType.BOX_NORTHWEST,
  11
+    SymbolType.BOX_SOUTH,
  12
+    SymbolType.BOX_SOUTHEAST,
  13
+    SymbolType.BOX_SOUTHWEST,
  14
+    SymbolType.BOX_WEST,
  15
+    SymbolType.HBAR_EAST,
  16
+    SymbolType.HBAR_NORTHEAST,
  17
+    SymbolType.HBAR_NORTHWEST,
  18
+    SymbolType.HBAR_SOUTHEAST,
  19
+    SymbolType.BOX_SOUTHWEST,
  20
+    SymbolType.HBAR_WEST,
  21
+    SymbolType.HBAR_NEXT,
  22
+    SymbolType.HBAR_PREV,
  23
+    SymbolType.NONE,
  24
+    SymbolType.VBAR_NORTH,
  25
+    SymbolType.VBAR_NORTHEAST,
  26
+    SymbolType.VBAR_NORTHWEST,
  27
+    SymbolType.VBAR_SOUTH,
  28
+    SymbolType.VBAR_SOUTHEAST,
  29
+    SymbolType.VBAR_SOUTHWEST,
  30
+    SymbolType.VBAR_NEXT,
  31
+    SymbolType.VBAR_PREV,
  32
+    SymbolType.XGRIDLINE,
  33
+    SymbolType.Y2GRIDLINE,
  34
+    SymbolType.YGRIDLINE
  35
+]
  36
+symbolNames = [ \
  37
+    "BOX_CENTER",
  38
+    "BOX_EAST",
  39
+    "BOX_NORTH",
  40
+    "BOX_NORTHEAST",
  41
+    "BOX_NORTHWEST",
  42
+    "BOX_SOUTH",
  43
+    "BOX_SOUTHEAST",
  44
+    "BOX_SOUTHWEST",
  45
+    "BOX_WEST",
  46
+    "HBAR_EAST",
  47
+    "HBAR_NORTHEAST",
  48
+    "HBAR_NORTHWEST",
  49
+    "HBAR_SOUTHEAST",
  50
+    "BOX_SOUTHWEST",
  51
+    "HBAR_WEST",
  52
+    "HBAR_NEXT",
  53
+    "HBAR_PREV",
  54
+    "NONE",
  55
+    "VBAR_NORTH",
  56
+    "VBAR_NORTHEAST",
  57
+    "VBAR_NORTHWEST",
  58
+    "VBAR_SOUTH",
  59
+    "VBAR_SOUTHEAST",
  60
+    "VBAR_SOUTHWEST",
  61
+    "VBAR_NEXT",
  62
+    "VBAR_PREV",
  63
+    "XGRIDLINE",
  64
+    "Y2GRIDLINE",
  65
+    "YGRIDLINE"
  66
+]
  67
+
  68
+"""* Simple chart that uses every possible symbol type."""
  69
+class TestGChart02 (GChart):
  70
+    def __init__(self):
  71
+        GChart.__init__(self, XChartSize=400,YChartSize=400) # bit bigger so 29 curve legend fits
  72
+        self.setChartTitle(GChartTestAppUtil.getTitle(self))
  73
+        self.setChartFootnotes("Check: Rendering consistent with SymbolType on legend.")
  74
+        for i in range(len(symbolTypes)):
  75
+            self.addCurve()
  76
+            self.getCurve(i).addPoint(i, i)
  77
+            self.getCurve(i).getSymbol().setSymbolType(symbolTypes[i])
  78
+            self.getCurve(i).getSymbol().setHeight(7)
  79
+            self.getCurve(i).getSymbol().setWidth(7)
  80
+            self.getCurve(i).setLegendLabel(i + " " + symbolNames[i])
  81
+        
  82
+        self.setLegendFontSize(8)
  83
+        self.getXAxis().setTickLabelFontSize(8)
  84
+        self.getXAxis().setHasGridlines(True)
  85
+        self.getXAxis().setTickCount(symbolTypes.length)
  86
+        self.getYAxis().setTickLabelFontSize(8)
  87
+        self.getYAxis().setHasGridlines(True)
  88
+        self.getYAxis().setTickCount(symbolTypes.length)
  89
+        
  90
+    
  91
+
  92
+
2  library/pyjamas/chart/Double.py
@@ -9,4 +9,4 @@
9 9
 def isNaN(num):
10 10
     """ returns True if number is "not a number"
11 11
     """
12  
-    return num > MAX_VALUE or num < MIN_VALUE
  12
+    return num == NaN

0 notes on commit abcce90

Please sign in to comment.
Something went wrong with that request. Please try again.