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

Method initChart

QtChart/ToolTip.py:192–214  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.95

Calls 1

setRangeMethod · 0.45

Tested by

no test coverage detected