MCPcopy Index your code
hub / github.com/PyQt5/PyQt / initChart

Method initChart

QtChart/ToolTip2.py:190–212  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

188 (name, point.x(), point.y()))
189
190 def initChart(self):
191 self._chart = QChart(title="Line Chart")
192 self._chart.setAcceptHoverEvents(True)
193 dataTable = [
194 [120, 132, 101, 134, 90, 230, 210],
195 [220, 182, 191, 234, 290, 330, 310],
196 [150, 232, 201, 154, 190, 330, 410],
197 [320, 332, 301, 334, 390, 330, 320],
198 [820, 932, 901, 934, 1290, 1330, 1320]
199 ]
200 for i, data_list in enumerate(dataTable):
201 series = QLineSeries(self._chart)
202 for j, v in enumerate(data_list):
203 series.append(j, v)
204 series.setName("Series " + str(i))
205 series.setPointsVisible(True) # 显示原点
206 series.hovered.connect(self.onSeriesHoverd)
207 self._chart.addSeries(series)
208 self._chart.createDefaultAxes() # 创建默认的轴
209 self._chart.axisX().setTickCount(7) # x轴设置7个刻度
210 self._chart.axisY().setTickCount(7) # y轴设置7个刻度
211 self._chart.axisY().setRange(0, 1500) # 设置y轴范围
212 self.setChart(self._chart)
213
214
215if __name__ == "__main__":

Callers 1

__init__Method · 0.95

Calls 1

setRangeMethod · 0.45

Tested by

no test coverage detected