Permalink
Browse files

more gchart update

git-svn-id: https://pyjamas.svn.sourceforge.net/svnroot/pyjamas/trunk@1606 7a2bd370-bda8-463c-979e-2900ccfb811e
  • Loading branch information...
1 parent bef4325 commit abcce90f9f1e03dd2f054c1818b2e6e1e6ee23f2 lkcl committed Aug 31, 2009
View
17 examples/gcharttestapp/GChartTestApp.py
@@ -8,6 +8,9 @@
from pyjamas.chart import GChart
from TestGChart00 import TestGChart00
+from TestGChart01 import TestGChart01
+from TestGChart02 import TestGChart02
+
from GChartExample00 import GChartExample00
from GChartExample00a import GChartExample00a
from GChartExample01 import GChartExample01
@@ -154,7 +157,7 @@ def onModuleLoad():
# addChart(GChartExample04b())
# addChart(GChartExample05())
#addChart(GChartExample06())
- addChart(GChartExample07())
+ #addChart(GChartExample07())
# addChart(GChartExample08())
# addChart(GChartExample09())
# addChart(GChartExample10())
@@ -174,7 +177,7 @@ def onModuleLoad():
# addChart(GChartExample18())
# addChart(GChartExample18a())
# addChart(GChartExample19())
- addChart(GChartExample20())
+ #addChart(GChartExample20())
# addChart(GChartExample20a())
#addChart(GChartExample21())
# addChart(GChartExample22())
@@ -191,10 +194,10 @@ def onModuleLoad():
#
#)
# addChart(TestGChart00())
- # addChartNoUpdate(TestGChart01(0,0))
- # addChartNoUpdate(TestGChart01(1,0))
- # addChartNoUpdate(TestGChart01(2,0))
- # addChartNoUpdate(TestGChart01(3,0))
+ #addChartNoUpdate(TestGChart01(0,0))
+ #addChartNoUpdate(TestGChart01(1,0))
+ #addChartNoUpdate(TestGChart01(2,0))
+ #addChartNoUpdate(TestGChart01(3,0))
# addChartNoUpdate(TestGChart01(0,1))
# addChartNoUpdate(TestGChart01(1,1))
# addChartNoUpdate(TestGChart01(2,1))
@@ -204,7 +207,7 @@ def onModuleLoad():
# addChartNoUpdate(TestGChart01(2,2))
# addChartNoUpdate(TestGChart01(3,2))
# addChart(TestGChart01a())
- # addChart(TestGChart02())
+ addChart(TestGChart02())
# addChart(TestGChart03())
# addChart(TestGChart04())
# addChart(TestGChart04a())
View
77 examples/gcharttestapp/TestGChart01.py
@@ -0,0 +1,77 @@
+import GChartTestAppUtil
+
+from pyjamas.chart.GChart import GChart
+from pyjamas.chart import GChartConsts
+from pyjamas.chart import AnnotationLocation
+from pyjamas.chart import SymbolType
+
+from pyjamas.ui.Button import Button
+
+msg = [["Check: all chart elements except labels red",
+"Check: missing image icon appears on points and plot area.",
+"Check: no missing image icon appears on chart area or points",
+"Check: missing image icons appear on points and plot area iff IP connection is down (otherwise, 3D pies)"],
+["Check: all points red",
+"Check: missing image icon appears on all points",
+"Check: no missing image icon appears on chart",
+"Check: missing image icons appear on points iff IP connection is down (otherwise, 3D pies)."],
+["Check: plot area red",
+"Check: missing image icon appears on plot area",
+"Check: no missing image icon appears on plot area",
+"Check: missing image icon appears on plot area iff IP connection is down (otherwise, 3D pies)."]]
+
+imageURL = [
+ "red.gif",
+ "no-such-file.gif",
+ "gchart.gif",
+ "http://chart.apis.google.com/chart?cht=p3&chd=t:100&chs=500x200"
+]
+
+"""* Simple a chart with just one point on it, used for testing
+** methods for telling GChart to look for the blank gif in
+** the host page, rather than the module base, directory. """
+class TestGChart01 (GChart):
+ def __init__(self, imageId, targetArea):
+ GChart.__init__(self, XChartSize=500,YChartSize=200)
+ self.setChartTitle(GChartTestAppUtil.getTitle(self)+" imageId="+str(imageId)+ " targetArea=" + str(targetArea))
+
+ self.setChartFootnotes(msg[targetArea][imageId])
+ self.addCurve()
+ if targetArea==0:
+ self.setBlankImageURL(imageURL[imageId])
+
+ elif targetArea == 1:
+ self.getCurve().getSymbol().setImageURL(imageURL[imageId])
+
+ elif targetArea == 2:
+ self.setPlotAreaImageURL(imageURL[imageId])
+
+ if targetArea==0:
+ if self.getBlankImageURL() != imageURL[imageId]:
+ raise IllegalStateException("getBlankImageURL method failed.")
+
+
+ elif targetArea == 1:
+ if self.getCurve().getSymbol().getImageURL() != imageURL[imageId]:
+ raise IllegalStateException("getImageURL method failed.")
+
+
+ elif targetArea == 2:
+ if self.getPlotAreaImageURL() != imageURL[imageId]:
+ raise IllegalStateException("getPlotAreaImageURL method failed.");
+
+
+
+ self.getCurve().getSymbol().setModelHeight(1)
+ self.getCurve().getSymbol().setModelWidth(1)
+ self.getCurve().getSymbol().setBorderWidth(0)
+ self.getCurve().addPoint(1, 1)
+ self.getCurve().addPoint(2, 2)
+ self.getCurve().addPoint(3, 3)
+ self.getCurve().setLegendLabel("Curve 0")
+ # restore default blank image URL for any future tests
+ self.update()
+ self.setBlankImageURL(GChartConsts.DEFAULT_BLANK_IMAGE_URL)
+
+
+
View
92 examples/gcharttestapp/TestGChart02.py
@@ -0,0 +1,92 @@
+import GChartTestAppUtil
+from pyjamas.chart.GChart import GChart
+from pyjamas.chart import SymbolType
+
+symbolTypes = [\
+ SymbolType.BOX_CENTER,
+ SymbolType.BOX_EAST,
+ SymbolType.BOX_NORTH,
+ SymbolType.BOX_NORTHEAST,
+ SymbolType.BOX_NORTHWEST,
+ SymbolType.BOX_SOUTH,
+ SymbolType.BOX_SOUTHEAST,
+ SymbolType.BOX_SOUTHWEST,
+ SymbolType.BOX_WEST,
+ SymbolType.HBAR_EAST,
+ SymbolType.HBAR_NORTHEAST,
+ SymbolType.HBAR_NORTHWEST,
+ SymbolType.HBAR_SOUTHEAST,
+ SymbolType.BOX_SOUTHWEST,
+ SymbolType.HBAR_WEST,
+ SymbolType.HBAR_NEXT,
+ SymbolType.HBAR_PREV,
+ SymbolType.NONE,
+ SymbolType.VBAR_NORTH,
+ SymbolType.VBAR_NORTHEAST,
+ SymbolType.VBAR_NORTHWEST,
+ SymbolType.VBAR_SOUTH,
+ SymbolType.VBAR_SOUTHEAST,
+ SymbolType.VBAR_SOUTHWEST,
+ SymbolType.VBAR_NEXT,
+ SymbolType.VBAR_PREV,
+ SymbolType.XGRIDLINE,
+ SymbolType.Y2GRIDLINE,
+ SymbolType.YGRIDLINE
+]
+symbolNames = [ \
+ "BOX_CENTER",
+ "BOX_EAST",
+ "BOX_NORTH",
+ "BOX_NORTHEAST",
+ "BOX_NORTHWEST",
+ "BOX_SOUTH",
+ "BOX_SOUTHEAST",
+ "BOX_SOUTHWEST",
+ "BOX_WEST",
+ "HBAR_EAST",
+ "HBAR_NORTHEAST",
+ "HBAR_NORTHWEST",
+ "HBAR_SOUTHEAST",
+ "BOX_SOUTHWEST",
+ "HBAR_WEST",
+ "HBAR_NEXT",
+ "HBAR_PREV",
+ "NONE",
+ "VBAR_NORTH",
+ "VBAR_NORTHEAST",
+ "VBAR_NORTHWEST",
+ "VBAR_SOUTH",
+ "VBAR_SOUTHEAST",
+ "VBAR_SOUTHWEST",
+ "VBAR_NEXT",
+ "VBAR_PREV",
+ "XGRIDLINE",
+ "Y2GRIDLINE",
+ "YGRIDLINE"
+]
+
+"""* Simple chart that uses every possible symbol type."""
+class TestGChart02 (GChart):
+ def __init__(self):
+ GChart.__init__(self, XChartSize=400,YChartSize=400) # bit bigger so 29 curve legend fits
+ self.setChartTitle(GChartTestAppUtil.getTitle(self))
+ self.setChartFootnotes("Check: Rendering consistent with SymbolType on legend.")
+ for i in range(len(symbolTypes)):
+ self.addCurve()
+ self.getCurve(i).addPoint(i, i)
+ self.getCurve(i).getSymbol().setSymbolType(symbolTypes[i])
+ self.getCurve(i).getSymbol().setHeight(7)
+ self.getCurve(i).getSymbol().setWidth(7)
+ self.getCurve(i).setLegendLabel(i + " " + symbolNames[i])
+
+ self.setLegendFontSize(8)
+ self.getXAxis().setTickLabelFontSize(8)
+ self.getXAxis().setHasGridlines(True)
+ self.getXAxis().setTickCount(symbolTypes.length)
+ self.getYAxis().setTickLabelFontSize(8)
+ self.getYAxis().setHasGridlines(True)
+ self.getYAxis().setTickCount(symbolTypes.length)
+
+
+
+
View
2 library/pyjamas/chart/Double.py
@@ -9,4 +9,4 @@
def isNaN(num):
""" returns True if number is "not a number"
"""
- return num > MAX_VALUE or num < MIN_VALUE
+ return num == NaN

0 comments on commit abcce90

Please sign in to comment.