MCPcopy Create free account
hub / github.com/PyQt5/PyQt / generateRandomData

Method generateRandomData

QtChart/ScatterChart.py:60–79  ·  view source on GitHub ↗
(self, listCount, valueMax, valueCount)

Source from the content-addressed store, hash-verified

58 chart.addSeries(series)
59
60 def generateRandomData(self, listCount, valueMax, valueCount):
61 # 生成模拟随机数据
62 random.seed()
63
64 dataTable = []
65
66 for i in range(listCount):
67 dataList = []
68 yValue = 0.0
69 f_valueCount = float(valueCount)
70
71 for j in range(valueCount):
72 yValue += random.uniform(0, valueMax) / f_valueCount
73 value = QPointF(j + random.random() * valueMax / f_valueCount, yValue)
74 label = 'Slice ' + str(i) + ':' + str(j)
75 dataList.append((value, label))
76
77 dataTable.append(dataList)
78
79 return dataTable
80
81
82if __name__ == '__main__':

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected