(self, bargraph)
| 109 | fontSizeChanged = pyqtSignal(int) # 字体大小改变信号 |
| 110 | |
| 111 | def __init__(self, bargraph): |
| 112 | super(GraphModifier, self).__init__() |
| 113 | |
| 114 | self.m_graph = bargraph # Q3DBars 实例 |
| 115 | |
| 116 | self.m_xRotation = 0.0 # 水平旋转角度 |
| 117 | self.m_yRotation = 0.0 # 垂直旋转角度 |
| 118 | self.m_fontSize = 30 |
| 119 | self.m_segments = 4 |
| 120 | self.m_subSegments = 3 |
| 121 | self.m_minval = -20.0 |
| 122 | self.m_maxval = 20.0 |
| 123 | self.m_temperatureAxis = QValue3DAxis() # 温度轴 |
| 124 | self.m_yearAxis = QCategory3DAxis() # 年份轴 |
| 125 | self.m_monthAxis = QCategory3DAxis() # 月份轴 |
| 126 | self.m_primarySeries = QBar3DSeries() # 主序列 |
| 127 | self.m_secondarySeries = QBar3DSeries() # 次序列 |
| 128 | self.m_barMesh = QAbstract3DSeries.MeshBevelBar # 预定义的网格类型 |
| 129 | self.m_smooth = False # 是否平滑 |
| 130 | |
| 131 | # 阴影以柔化的边缘高质量渲染 |
| 132 | self.m_graph.setShadowQuality(QAbstract3DGraph.ShadowQualitySoftMedium) |
| 133 | # 当前主题Q3DTheme设置背景是否可见 |
| 134 | self.m_graph.activeTheme().setBackgroundEnabled(False) |
| 135 | # 当前主题Q3DTheme设置字体 |
| 136 | self.m_graph.activeTheme().setFont( |
| 137 | QFont('Times New Roman', self.m_fontSize)) |
| 138 | # 当前主题Q3DTheme设置标签是使用彩色背景还是使用完全透明的背景绘制 |
| 139 | self.m_graph.activeTheme().setLabelBackgroundEnabled(True) |
| 140 | # 是否按比例将比例尺设置为单个系列比例尺来缩放比例 |
| 141 | self.m_graph.setMultiSeriesUniform(True) |
| 142 | |
| 143 | self.m_temperatureAxis.setTitle(Tr.get("Average temperature", "Average temperature")) |
| 144 | # 轴上的段数。这表明绘制了多少标签。要绘制的网格线的数量使用公式计算:segments * subsegments + 1。预设默认值为5。该值不能低于1 |
| 145 | self.m_temperatureAxis.setSegmentCount(self.m_segments) |
| 146 | # 轴上每个段内的子段数。 |
| 147 | # 除每个线段外,还在每个子线段之间绘制网格线。预设默认值为1。该值不能低于1。 |
| 148 | self.m_temperatureAxis.setSubSegmentCount(self.m_subSegments) |
| 149 | self.m_temperatureAxis.setRange(self.m_minval, self.m_maxval) |
| 150 | self.m_temperatureAxis.setLabelFormat(u"%.1f \N{degree sign}C") |
| 151 | |
| 152 | self.m_yearAxis.setTitle("Year") |
| 153 | self.m_monthAxis.setTitle("Month") |
| 154 | |
| 155 | self.m_graph.setValueAxis(self.m_temperatureAxis) |
| 156 | # 设置活动行的轴为年份 |
| 157 | self.m_graph.setRowAxis(self.m_yearAxis) |
| 158 | # 设置活动列的轴为月份 |
| 159 | self.m_graph.setColumnAxis(self.m_monthAxis) |
| 160 | |
| 161 | self.m_primarySeries.setItemLabelFormat( |
| 162 | "Oulu - @colLabel @rowLabel: @valueLabel") |
| 163 | # 设置网格类型 |
| 164 | self.m_primarySeries.setMesh(QAbstract3DSeries.MeshBevelBar) |
| 165 | self.m_primarySeries.setMeshSmooth(False) |
| 166 | |
| 167 | self.m_secondarySeries.setItemLabelFormat( |
| 168 | "Helsinki - @colLabel @rowLabel: @valueLabel") |
nothing calls this directly
no test coverage detected