hp = plt.histPlot("S1", t, "X", 5).show() hp = plt.histPlot("S1", t, "X", 0, 10, 5).show() ep = plt.errorBarXY("S1", t, "X", "XLow", "XHigh", "Y", "YLow", "YHigh").show() epBy = plt.errorBarXYBy("S1", t, "X", "XLow", "XHigh", "Y", "YLow", "YHigh", "USym").show() ep2 = plt.errorBarX("S1", t, "X", "XLow", "XHigh", "Y").show() epBy2 = plt.errorBarXBy("S1", t, "X", "XLow", "XHigh", "Y", "USym").show() ep3 = plt.errorBarY("S1", t, "X", "Y", "YLow", "YHigh").show() epBy3 = plt.errorBarYBy("S1", t, "X", "Y", "YLow", "YHigh", "USym").show() doubles = [3, 4, 3, 5, 4, 5] time = 1491946585000000000 t = tt.newTable(tt.col("USym", ["A", "B", "A", "B", "A", "B"]), tt.doubleCol("Open", doubles), tt.doubleCol("High", doubles), tt.doubleCol("Low", doubles), tt.doubleCol("Close", doubles)) t = t.updateView("Time = new DateTime(time + (MINUTE * i))") ohlc = plt.ohlcPlot("Test1", t, "Time", "Open", "High", "Low", "Close") ohlcPlotBy = plt.figure().newChart(0)\ .chartTitle("Chart Title")\ .newAxes()\ .xLabel("X")\ .yLabel("Y")\ .ohlcPlotBy("Test1", t, "Time", "Open", "High", "Low", "Close", "USym") categories = ["Samsung", "Others", "Nokia", "Apple", "MSFT"] valuesD = [27.8, 55.3, 16.8, 17.1, 23.1]
def testColumnHolder(self): """ Test cases for <primitive>Col() methods & associated newTable() method """ holders = [] junk, tab = None, None with self.subTest(msg="byteCol"): holders.append(TableTools.byteCol("byteCol", self.nByteArray)) with self.subTest(msg="shortCol"): holders.append(TableTools.shortCol("shortCol", self.nShortArray)) with self.subTest(msg="intCol"): holders.append(TableTools.intCol("intCol", self.nIntArray)) with self.subTest(msg="longCol"): holders.append(TableTools.longCol("longCol", self.nLongArray)) with self.subTest(msg="floatCol"): holders.append(TableTools.floatCol("floatCol", self.floatList)) with self.subTest(msg="doubleCol"): holders.append(TableTools.doubleCol("doubleCol", self.nDoubleArray)) with self.subTest(msg="charCol"): holders.append(TableTools.charCol("charCol", self.nCharArray)) with self.subTest(msg="newTable with column holders"): self.assertGreater(len(holders), 0) # make sure that we even do something useful tab = TableTools.newTable(*holders) print("tab =\n{}".format(TableTools.html(tab))) del holders, tab holders = [] with self.subTest(msg="byteCol with list"): holders.append(TableTools.byteCol("byteList", self.intList)) with self.subTest(msg="shortCol with list"): holders.append(TableTools.shortCol("shortList", self.intList)) with self.subTest(msg="intCol with list"): holders.append(TableTools.intCol("intList", self.intList)) with self.subTest(msg="longCol with list"): holders.append(TableTools.longCol("longList", self.intList)) with self.subTest(msg="floatCol with list"): holders.append(TableTools.doubleCol("floatList", self.floatList)) with self.subTest(msg="doubleCol with list"): holders.append(TableTools.doubleCol("doubleList", self.floatList)) with self.subTest(msg="charCol with list"): holders.append(TableTools.charCol("charList", self.charList)) print('prim col from list = \n{}'.format( TableTools.html(TableTools.newTable(*holders)))) del holders holders = [] with self.subTest(msg="col with string array"): holders.append(TableTools.col("stringCol", self.nStringArray)) with self.subTest(msg="col with boolean array"): holders.append(TableTools.col("booleanCol", self.nBooleanArray)) with self.subTest(msg="col with time array"): holders.append(TableTools.col("timeCol", self.nTimeArray)) print('obj col = \n{}'.format( TableTools.html(TableTools.newTable(*holders)))) del holders holders = [] with self.subTest(msg="col with int list"): holders.append(TableTools.col("intList2", self.intList)) with self.subTest(msg="col with double list"): holders.append(TableTools.col("doubleList2", self.floatList)) with self.subTest(msg="col with char list"): holders.append(TableTools.col("stringList", self.stringList)) with self.subTest(msg="col with char list"): holders.append(TableTools.col("charList2", self.charList)) with self.subTest(msg="col with boolean list"): holders.append(TableTools.col("booleanList", self.booleanList)) with self.subTest(msg="col with time list"): holders.append(TableTools.col("timeList", self.timeList)) print('col from list = \n{}'.format( TableTools.html(TableTools.newTable(*holders)))) del holders holders = [] with self.subTest(msg="col with byte"): holders.append(TableTools.col("byteCol", self.nByteArray)) with self.subTest(msg="col with short"): holders.append(TableTools.col("shortCol", self.nShortArray)) with self.subTest(msg="col with int"): holders.append(TableTools.col("intCol", self.nIntArray)) with self.subTest(msg="col with long"): holders.append(TableTools.col("longCol", self.nLongArray)) with self.subTest(msg="col with float"): holders.append(TableTools.col("floatCol", self.nFloatArray)) with self.subTest(msg="col with double"): holders.append(TableTools.col("doubleCol", self.nDoubleArray)) with self.subTest(msg="col with char"): holders.append(TableTools.col("charCol", self.nCharArray)) print("primitive from col =\n{}".format( TableTools.html(TableTools.newTable(*holders)))) del holders