lineSeries = QLineSeries()
pen = QPen(QtGui.QColor(0, 200, 176))
pen.setWidth(3)
lineSeries.setPen(pen)
lineSeries.setPointsVisible(True)
lineSeries.append(0, 6)
lineSeries.append(25, 6)
lineSeries.append(50, 6)
lineSeries.append(75, 6)
lineSeries.append(100, 6)
#创建图表
self.chart = QChart()
self.chart.legend().hide()
self.chart.addSeries(lineSeries)
#chart.createDefaultAxes()
"""
axis=QValueAxis()
axis.setRange(0, 75)
axis.setLabelsColor(QtGui.QColor(255, 255, 255))
#axis.setLabelFormat("%d")
axis.setTickCount(4)
axis.setGridLineVisible(False)
self.chart.setAxisX(axis)
"""
axisX = QCategoryAxis()
axisX.append("0",0)
axisX.append("5分",25)
axisX.append("10分",50)
axisX.append("15分",75)
axisX.append("20分",100)
axisX.setLabelsColor(QtGui.QColor(255, 255, 255))
axisX.setGridLineVisible(False)
axisX.setLabelsPosition(QCategoryAxis.AxisLabelsPositionOnValue)
self.chart.setAxisX(axisX)
lineSeries.attachAxis(axisX)
axis=QValueAxis()
axis.setRange(0, 6)
axis.setLabelsColor(QtGui.QColor(255, 255, 255))#调整字体颜色
axis.setLabelFormat("%d")
axis.setTickCount(3)
axis.setGridLineVisible(False)
self.chart.setAxisY(axis)
self.chart.setBackgroundVisible(False)
#chart.setBorderColor((43, 56, 70))
#self.chart.setTitle('今日出勤统计')
#图表视图
lineSeries.attachAxis(axisX)
lineSeries.attachAxis(axis)
chartView = QChartView(self.chart,Form)
chartView.setRenderHint(QPainter.Antialiasing)
chartView.setGeometry(QtCore.QRect(220, 360, 500, 350))
chartView.setStyleSheet("border-color: rgb(43, 56, 70);\n"
"font: 14pt \"AcadEref\";\n"
"color: rgb(255, 255, 255);\n"
"\n"
"border: none;")
lineSeries1 = QLineSeries()
lineSeries1.append(0, 0)
lineSeries1.append(456, 1)
lineSeries1.append(495, 1)
lineSeries1.append(495, 0)
lineSeries1.append(610, 1)
lineSeries1.append(690, 1)
lineSeries1.append(700, 0)
lineSeries1.append(805, 1)
lineSeries1.append(861, 1)
lineSeries1.append(862, 0)
lineSeries1.append(877, 1)
lineSeries1.append(950, 1)
lineSeries1.append(951, 0)
lineSeries1.append(1080, 1)
lineSeries1.append(1119, 1)
lineSeries1.append(1120, 0)
lineSeries1.append(1200, 0)
lineSeries1.setPointsVisible(True)
pen = QPen(QtGui.QColor(36, 170, 242))
pen.setWidth(3)
lineSeries1.setPen(pen)
#创建图表
self.chart1 = QChart()
self.chart1.legend().hide()
self.chart1.addSeries(lineSeries1)
#chart.createDefaultAxes()
"""
axis=QValueAxis()
axis.setRange(0, 75)
axis.setLabelsColor(QtGui.QColor(255, 255, 255))
#axis.setLabelFormat("%d")
axis.setTickCount(4)
axis.setGridLineVisible(False)
self.chart1.setAxisX(axis)
"""
axisX = QCategoryAxis()
axisX.append("0",0)
axisX.append("5分",300)
axisX.append("10分",600)
axisX.append("15分",900)
axisX.append("20分",1200)
axisX.setLabelsColor(QtGui.QColor(255, 255, 255))
axisX.setGridLineVisible(False)
axisX.setLabelsPosition(QCategoryAxis.AxisLabelsPositionOnValue)
self.chart1.setAxisX(axisX)
lineSeries1.attachAxis(axisX)
axis=QValueAxis()
axis.setRange(0, 1)
axis.setLabelsColor(QtGui.QColor(255, 255, 255))#调整字体颜色
axis.setLabelFormat("%d")
axis.setTickCount(2)
axis.setGridLineVisible(False)
self.chart1.setAxisY(axis)
self.chart1.setBackgroundVisible(False)
#chart.setBorderColor((43, 56, 70))
#self.chart1.setTitle('今日出勤统计')
#图表视图
chartView1 = QChartView(self.chart1,Form)
chartView1.setRenderHint(QPainter.Antialiasing)
chartView1.setGeometry(QtCore.QRect(730, 360, 500, 350))
chartView1.setStyleSheet("border-color: rgb(43, 56, 70);\n"
"font: 14pt \"AcadEref\";\n"
"color: rgb(255, 255, 255);\n"
"\n"
"border: none;")