| @@ 178-420 (lines=243) @@ | ||
| 175 | len(reporting_period_data['names']) == 0: |
|
| 176 | has_names_data_flag = False |
|
| 177 | ||
| 178 | if has_names_data_flag: |
|
| 179 | ws['B' + str(current_row_number)].font = title_font |
|
| 180 | ws['B' + str(current_row_number)] = name + ' 报告期节约' |
|
| 181 | ||
| 182 | current_row_number += 1 |
|
| 183 | ||
| 184 | category = reporting_period_data['names'] |
|
| 185 | ca_len = len(category) |
|
| 186 | ||
| 187 | ws['B' + str(current_row_number)].fill = table_fill |
|
| 188 | ||
| 189 | col = 'C' |
|
| 190 | ||
| 191 | for i in range(0, ca_len): |
|
| 192 | ws[col + str(current_row_number)].fill = table_fill |
|
| 193 | ws[col + str(current_row_number)].font = name_small_font |
|
| 194 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 195 | ws[col + str(current_row_number)].border = f_border |
|
| 196 | ws[col + str(current_row_number)] = \ |
|
| 197 | reporting_period_data['names'][i] + " (基线-实际) (" + reporting_period_data['units'][i] + ")" |
|
| 198 | ||
| 199 | col = chr(ord(col) + 1) |
|
| 200 | ||
| 201 | ws[col + str(current_row_number)].fill = table_fill |
|
| 202 | ws[col + str(current_row_number)].font = name_small_font |
|
| 203 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 204 | ws[col + str(current_row_number)].border = f_border |
|
| 205 | ws[col + str(current_row_number)] = '吨标准煤 (基线-实际) (TCE)' |
|
| 206 | ||
| 207 | col = chr(ord(col) + 1) |
|
| 208 | ||
| 209 | ws[col + str(current_row_number)].fill = table_fill |
|
| 210 | ws[col + str(current_row_number)].font = name_small_font |
|
| 211 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 212 | ws[col + str(current_row_number)].border = f_border |
|
| 213 | ws[col + str(current_row_number)] = '吨二氧化碳排放 (基线-实际) (TCO2E)' |
|
| 214 | ||
| 215 | col = chr(ord(col) + 1) |
|
| 216 | ||
| 217 | current_row_number += 1 |
|
| 218 | ||
| 219 | ws['B' + str(current_row_number)].font = title_font |
|
| 220 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 221 | ws['B' + str(current_row_number)].border = f_border |
|
| 222 | ws['B' + str(current_row_number)] = '节约' |
|
| 223 | ||
| 224 | col = 'C' |
|
| 225 | ||
| 226 | for i in range(0, ca_len): |
|
| 227 | ws[col + str(current_row_number)].font = name_font |
|
| 228 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 229 | ws[col + str(current_row_number)].border = f_border |
|
| 230 | ws[col + str(current_row_number)] = round(reporting_period_data['subtotals_saving'][i], 2) |
|
| 231 | ||
| 232 | col = chr(ord(col) + 1) |
|
| 233 | ||
| 234 | ws[col + str(current_row_number)].font = name_font |
|
| 235 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 236 | ws[col + str(current_row_number)].border = f_border |
|
| 237 | ws[col + str(current_row_number)] = round(reporting_period_data['total_in_kgce_saving'], 2) |
|
| 238 | ||
| 239 | col = chr(ord(col) + 1) |
|
| 240 | ||
| 241 | ws[col + str(current_row_number)].font = name_font |
|
| 242 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 243 | ws[col + str(current_row_number)].border = f_border |
|
| 244 | ws[col + str(current_row_number)] = round(reporting_period_data['total_in_kgco2e_saving'], 2) |
|
| 245 | ||
| 246 | col = chr(ord(col) + 1) |
|
| 247 | ||
| 248 | current_row_number += 1 |
|
| 249 | ||
| 250 | ws['B' + str(current_row_number)].font = title_font |
|
| 251 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 252 | ws['B' + str(current_row_number)].border = f_border |
|
| 253 | ws['B' + str(current_row_number)] = '单位面积值' |
|
| 254 | ||
| 255 | col = 'C' |
|
| 256 | ||
| 257 | for i in range(0, ca_len): |
|
| 258 | ws[col + str(current_row_number)].font = name_font |
|
| 259 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 260 | ws[col + str(current_row_number)].border = f_border |
|
| 261 | ws[col + str(current_row_number)] = round(reporting_period_data['subtotals_per_unit_area_saving'][i], 2) |
|
| 262 | ||
| 263 | col = chr(ord(col) + 1) |
|
| 264 | ||
| 265 | ws[col + str(current_row_number)].font = name_font |
|
| 266 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 267 | ws[col + str(current_row_number)].border = f_border |
|
| 268 | ws[col + str(current_row_number)] = round(reporting_period_data['total_in_kgco2e_per_unit_area_saving'], 2) |
|
| 269 | ||
| 270 | col = chr(ord(col) + 1) |
|
| 271 | ||
| 272 | ws[col + str(current_row_number)].font = name_font |
|
| 273 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 274 | ws[col + str(current_row_number)].border = f_border |
|
| 275 | ws[col + str(current_row_number)] = round(reporting_period_data['total_in_kgce_per_unit_area_saving'], 2) |
|
| 276 | ||
| 277 | col = chr(ord(col) + 1) |
|
| 278 | ||
| 279 | current_row_number += 1 |
|
| 280 | ||
| 281 | ws['B' + str(current_row_number)].font = title_font |
|
| 282 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 283 | ws['B' + str(current_row_number)].border = f_border |
|
| 284 | ws['B' + str(current_row_number)] = '环比' |
|
| 285 | ||
| 286 | col = 'C' |
|
| 287 | ||
| 288 | for i in range(0, ca_len): |
|
| 289 | ws[col + str(current_row_number)].font = name_font |
|
| 290 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 291 | ws[col + str(current_row_number)].border = f_border |
|
| 292 | ws[col + str(current_row_number)] = str( |
|
| 293 | round(reporting_period_data['increment_rates_saving'][i] * 100, 2)) + '%' \ |
|
| 294 | if reporting_period_data['increment_rates_saving'][i] is not None else '-' |
|
| 295 | ||
| 296 | col = chr(ord(col) + 1) |
|
| 297 | ||
| 298 | ws[col + str(current_row_number)].font = name_font |
|
| 299 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 300 | ws[col + str(current_row_number)].border = f_border |
|
| 301 | ws[col + str(current_row_number)] = str( |
|
| 302 | round(reporting_period_data['increment_rate_in_kgce_saving'] * 100, 2)) + '%' \ |
|
| 303 | if reporting_period_data['increment_rate_in_kgce_saving'] is not None else '-' |
|
| 304 | ||
| 305 | col = chr(ord(col) + 1) |
|
| 306 | ||
| 307 | ws[col + str(current_row_number)].font = name_font |
|
| 308 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 309 | ws[col + str(current_row_number)].border = f_border |
|
| 310 | ws[col + str(current_row_number)] = str( |
|
| 311 | round(reporting_period_data['increment_rate_in_kgco2e_saving'] * 100, 2)) + '%' \ |
|
| 312 | if reporting_period_data['increment_rate_in_kgco2e_saving'] is not None else '-' |
|
| 313 | ||
| 314 | col = chr(ord(col) + 1) |
|
| 315 | ||
| 316 | current_row_number += 2 |
|
| 317 | ||
| 318 | ws['B' + str(current_row_number)].font = title_font |
|
| 319 | ws['B' + str(current_row_number)] = name + ' 吨标准煤(TCE)占比' |
|
| 320 | ||
| 321 | current_row_number += 1 |
|
| 322 | table_start_row_number = current_row_number |
|
| 323 | chart_start_row_number = current_row_number |
|
| 324 | ||
| 325 | ws['B' + str(current_row_number)].fill = table_fill |
|
| 326 | ||
| 327 | ws['C' + str(current_row_number)].fill = table_fill |
|
| 328 | ws['C' + str(current_row_number)].font = name_small_font |
|
| 329 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
|
| 330 | ws['C' + str(current_row_number)].border = f_border |
|
| 331 | ws['C' + str(current_row_number)] = '吨标准煤(TCE)占比' |
|
| 332 | ||
| 333 | current_row_number += 1 |
|
| 334 | ||
| 335 | for i in range(0, ca_len): |
|
| 336 | ws['B' + str(current_row_number)].font = title_font |
|
| 337 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 338 | ws['B' + str(current_row_number)].border = f_border |
|
| 339 | ws['B' + str(current_row_number)] = reporting_period_data['names'][i] |
|
| 340 | ||
| 341 | ws['C' + str(current_row_number)].font = name_font |
|
| 342 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
|
| 343 | ws['C' + str(current_row_number)].border = f_border |
|
| 344 | ws['C' + str(current_row_number)] = round(reporting_period_data['subtotals_in_kgce_saving'][i], 2) |
|
| 345 | ||
| 346 | current_row_number += 1 |
|
| 347 | ||
| 348 | table_end_row_number = current_row_number - 1 |
|
| 349 | ||
| 350 | if ca_len < 4: |
|
| 351 | current_row_number = current_row_number - ca_len + 4 |
|
| 352 | ||
| 353 | current_row_number += 1 |
|
| 354 | ||
| 355 | pie = PieChart() |
|
| 356 | pie.title = '吨标准煤(TCE)占比' |
|
| 357 | labels = Reference(ws, min_col=2, min_row=table_start_row_number + 1, max_row=table_end_row_number) |
|
| 358 | pie_data = Reference(ws, min_col=3, min_row=table_start_row_number, max_row=table_end_row_number) |
|
| 359 | pie.add_data(pie_data, titles_from_data=True) |
|
| 360 | pie.set_categories(labels) |
|
| 361 | pie.height = 5.25 |
|
| 362 | pie.width = 9 |
|
| 363 | s1 = pie.series[0] |
|
| 364 | s1.dLbls = DataLabelList() |
|
| 365 | s1.dLbls.showCatName = False |
|
| 366 | s1.dLbls.showVal = True |
|
| 367 | s1.dLbls.showPercent = True |
|
| 368 | ws.add_chart(pie, 'D' + str(chart_start_row_number)) |
|
| 369 | ||
| 370 | ws['B' + str(current_row_number)].font = title_font |
|
| 371 | ws['B' + str(current_row_number)] = name + ' 吨二氧化碳排放(TCO2E)占比' |
|
| 372 | ||
| 373 | current_row_number += 1 |
|
| 374 | table_start_row_number = current_row_number |
|
| 375 | chart_start_row_number = current_row_number |
|
| 376 | ||
| 377 | ws['B' + str(current_row_number)].fill = table_fill |
|
| 378 | ||
| 379 | ws['C' + str(current_row_number)].fill = table_fill |
|
| 380 | ws['C' + str(current_row_number)].font = name_small_font |
|
| 381 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
|
| 382 | ws['C' + str(current_row_number)].border = f_border |
|
| 383 | ws['C' + str(current_row_number)] = '吨二氧化碳排放(TCO2E)占比' |
|
| 384 | ||
| 385 | current_row_number += 1 |
|
| 386 | ||
| 387 | for i in range(0, ca_len): |
|
| 388 | ws['B' + str(current_row_number)].font = title_font |
|
| 389 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 390 | ws['B' + str(current_row_number)].border = f_border |
|
| 391 | ws['B' + str(current_row_number)] = reporting_period_data['names'][i] |
|
| 392 | ||
| 393 | ws['C' + str(current_row_number)].font = name_font |
|
| 394 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
|
| 395 | ws['C' + str(current_row_number)].border = f_border |
|
| 396 | ws['C' + str(current_row_number)] = round(reporting_period_data['subtotals_in_kgco2e_saving'][i], 2) |
|
| 397 | ||
| 398 | current_row_number += 1 |
|
| 399 | ||
| 400 | table_end_row_number = current_row_number - 1 |
|
| 401 | ||
| 402 | if ca_len < 4: |
|
| 403 | current_row_number = current_row_number - ca_len + 4 |
|
| 404 | ||
| 405 | current_row_number += 1 |
|
| 406 | ||
| 407 | pie = PieChart() |
|
| 408 | pie.title = '吨二氧化碳排放(TCO2E)占比' |
|
| 409 | labels = Reference(ws, min_col=2, min_row=table_start_row_number + 1, max_row=table_end_row_number) |
|
| 410 | pie_data = Reference(ws, min_col=3, min_row=table_start_row_number, max_row=table_end_row_number) |
|
| 411 | pie.add_data(pie_data, titles_from_data=True) |
|
| 412 | pie.set_categories(labels) |
|
| 413 | pie.height = 5.25 |
|
| 414 | pie.width = 9 |
|
| 415 | s1 = pie.series[0] |
|
| 416 | s1.dLbls = DataLabelList() |
|
| 417 | s1.dLbls.showCatName = False |
|
| 418 | s1.dLbls.showVal = True |
|
| 419 | s1.dLbls.showPercent = True |
|
| 420 | ws.add_chart(pie, 'D' + str(chart_start_row_number)) |
|
| 421 | ||
| 422 | ############################################# |
|
| 423 | ||
| @@ 178-420 (lines=243) @@ | ||
| 175 | len(reporting_period_data['names']) == 0: |
|
| 176 | has_names_data_flag = False |
|
| 177 | ||
| 178 | if has_names_data_flag: |
|
| 179 | ws['B' + str(current_row_number)].font = title_font |
|
| 180 | ws['B' + str(current_row_number)] = name + ' 报告期节约' |
|
| 181 | ||
| 182 | current_row_number += 1 |
|
| 183 | ||
| 184 | category = reporting_period_data['names'] |
|
| 185 | ca_len = len(category) |
|
| 186 | ||
| 187 | ws['B' + str(current_row_number)].fill = table_fill |
|
| 188 | ||
| 189 | col = 'C' |
|
| 190 | ||
| 191 | for i in range(0, ca_len): |
|
| 192 | ws[col + str(current_row_number)].fill = table_fill |
|
| 193 | ws[col + str(current_row_number)].font = name_small_font |
|
| 194 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 195 | ws[col + str(current_row_number)].border = f_border |
|
| 196 | ws[col + str(current_row_number)] = \ |
|
| 197 | reporting_period_data['names'][i] + " (基线-实际) (" + reporting_period_data['units'][i] + ")" |
|
| 198 | ||
| 199 | col = chr(ord(col) + 1) |
|
| 200 | ||
| 201 | ws[col + str(current_row_number)].fill = table_fill |
|
| 202 | ws[col + str(current_row_number)].font = name_small_font |
|
| 203 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 204 | ws[col + str(current_row_number)].border = f_border |
|
| 205 | ws[col + str(current_row_number)] = '吨标准煤 (基线-实际) (TCE)' |
|
| 206 | ||
| 207 | col = chr(ord(col) + 1) |
|
| 208 | ||
| 209 | ws[col + str(current_row_number)].fill = table_fill |
|
| 210 | ws[col + str(current_row_number)].font = name_small_font |
|
| 211 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 212 | ws[col + str(current_row_number)].border = f_border |
|
| 213 | ws[col + str(current_row_number)] = '吨二氧化碳排放 (基线-实际) (TCO2E)' |
|
| 214 | ||
| 215 | col = chr(ord(col) + 1) |
|
| 216 | ||
| 217 | current_row_number += 1 |
|
| 218 | ||
| 219 | ws['B' + str(current_row_number)].font = title_font |
|
| 220 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 221 | ws['B' + str(current_row_number)].border = f_border |
|
| 222 | ws['B' + str(current_row_number)] = '节约' |
|
| 223 | ||
| 224 | col = 'C' |
|
| 225 | ||
| 226 | for i in range(0, ca_len): |
|
| 227 | ws[col + str(current_row_number)].font = name_font |
|
| 228 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 229 | ws[col + str(current_row_number)].border = f_border |
|
| 230 | ws[col + str(current_row_number)] = round(reporting_period_data['subtotals_saving'][i], 2) |
|
| 231 | ||
| 232 | col = chr(ord(col) + 1) |
|
| 233 | ||
| 234 | ws[col + str(current_row_number)].font = name_font |
|
| 235 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 236 | ws[col + str(current_row_number)].border = f_border |
|
| 237 | ws[col + str(current_row_number)] = round(reporting_period_data['total_in_kgce_saving'], 2) |
|
| 238 | ||
| 239 | col = chr(ord(col) + 1) |
|
| 240 | ||
| 241 | ws[col + str(current_row_number)].font = name_font |
|
| 242 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 243 | ws[col + str(current_row_number)].border = f_border |
|
| 244 | ws[col + str(current_row_number)] = round(reporting_period_data['total_in_kgco2e_saving'], 2) |
|
| 245 | ||
| 246 | col = chr(ord(col) + 1) |
|
| 247 | ||
| 248 | current_row_number += 1 |
|
| 249 | ||
| 250 | ws['B' + str(current_row_number)].font = title_font |
|
| 251 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 252 | ws['B' + str(current_row_number)].border = f_border |
|
| 253 | ws['B' + str(current_row_number)] = '单位面积值' |
|
| 254 | ||
| 255 | col = 'C' |
|
| 256 | ||
| 257 | for i in range(0, ca_len): |
|
| 258 | ws[col + str(current_row_number)].font = name_font |
|
| 259 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 260 | ws[col + str(current_row_number)].border = f_border |
|
| 261 | ws[col + str(current_row_number)] = round(reporting_period_data['subtotals_per_unit_area_saving'][i], 2) |
|
| 262 | ||
| 263 | col = chr(ord(col) + 1) |
|
| 264 | ||
| 265 | ws[col + str(current_row_number)].font = name_font |
|
| 266 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 267 | ws[col + str(current_row_number)].border = f_border |
|
| 268 | ws[col + str(current_row_number)] = round(reporting_period_data['total_in_kgco2e_per_unit_area_saving'], 2) |
|
| 269 | ||
| 270 | col = chr(ord(col) + 1) |
|
| 271 | ||
| 272 | ws[col + str(current_row_number)].font = name_font |
|
| 273 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 274 | ws[col + str(current_row_number)].border = f_border |
|
| 275 | ws[col + str(current_row_number)] = round(reporting_period_data['total_in_kgce_per_unit_area_saving'], 2) |
|
| 276 | ||
| 277 | col = chr(ord(col) + 1) |
|
| 278 | ||
| 279 | current_row_number += 1 |
|
| 280 | ||
| 281 | ws['B' + str(current_row_number)].font = title_font |
|
| 282 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 283 | ws['B' + str(current_row_number)].border = f_border |
|
| 284 | ws['B' + str(current_row_number)] = '环比' |
|
| 285 | ||
| 286 | col = 'C' |
|
| 287 | ||
| 288 | for i in range(0, ca_len): |
|
| 289 | ws[col + str(current_row_number)].font = name_font |
|
| 290 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 291 | ws[col + str(current_row_number)].border = f_border |
|
| 292 | ws[col + str(current_row_number)] = str( |
|
| 293 | round(reporting_period_data['increment_rates_saving'][i] * 100, 2)) + '%' \ |
|
| 294 | if reporting_period_data['increment_rates_saving'][i] is not None else '-' |
|
| 295 | ||
| 296 | col = chr(ord(col) + 1) |
|
| 297 | ||
| 298 | ws[col + str(current_row_number)].font = name_font |
|
| 299 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 300 | ws[col + str(current_row_number)].border = f_border |
|
| 301 | ws[col + str(current_row_number)] = str( |
|
| 302 | round(reporting_period_data['increment_rate_in_kgce_saving'] * 100, 2)) + '%' \ |
|
| 303 | if reporting_period_data['increment_rate_in_kgce_saving'] is not None else '-' |
|
| 304 | ||
| 305 | col = chr(ord(col) + 1) |
|
| 306 | ||
| 307 | ws[col + str(current_row_number)].font = name_font |
|
| 308 | ws[col + str(current_row_number)].alignment = c_c_alignment |
|
| 309 | ws[col + str(current_row_number)].border = f_border |
|
| 310 | ws[col + str(current_row_number)] = str( |
|
| 311 | round(reporting_period_data['increment_rate_in_kgco2e_saving'] * 100, 2)) + '%' \ |
|
| 312 | if reporting_period_data['increment_rate_in_kgco2e_saving'] is not None else '-' |
|
| 313 | ||
| 314 | col = chr(ord(col) + 1) |
|
| 315 | ||
| 316 | current_row_number += 2 |
|
| 317 | ||
| 318 | ws['B' + str(current_row_number)].font = title_font |
|
| 319 | ws['B' + str(current_row_number)] = name + ' 吨标准煤(TCE)占比' |
|
| 320 | ||
| 321 | current_row_number += 1 |
|
| 322 | table_start_row_number = current_row_number |
|
| 323 | chart_start_row_number = current_row_number |
|
| 324 | ||
| 325 | ws['B' + str(current_row_number)].fill = table_fill |
|
| 326 | ||
| 327 | ws['C' + str(current_row_number)].fill = table_fill |
|
| 328 | ws['C' + str(current_row_number)].font = name_small_font |
|
| 329 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
|
| 330 | ws['C' + str(current_row_number)].border = f_border |
|
| 331 | ws['C' + str(current_row_number)] = '吨标准煤(TCE)占比' |
|
| 332 | ||
| 333 | current_row_number += 1 |
|
| 334 | ||
| 335 | for i in range(0, ca_len): |
|
| 336 | ws['B' + str(current_row_number)].font = title_font |
|
| 337 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 338 | ws['B' + str(current_row_number)].border = f_border |
|
| 339 | ws['B' + str(current_row_number)] = reporting_period_data['names'][i] |
|
| 340 | ||
| 341 | ws['C' + str(current_row_number)].font = name_font |
|
| 342 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
|
| 343 | ws['C' + str(current_row_number)].border = f_border |
|
| 344 | ws['C' + str(current_row_number)] = round(reporting_period_data['subtotals_in_kgce_saving'][i], 2) |
|
| 345 | ||
| 346 | current_row_number += 1 |
|
| 347 | ||
| 348 | table_end_row_number = current_row_number - 1 |
|
| 349 | ||
| 350 | if ca_len < 4: |
|
| 351 | current_row_number = current_row_number - ca_len + 4 |
|
| 352 | ||
| 353 | current_row_number += 1 |
|
| 354 | ||
| 355 | pie = PieChart() |
|
| 356 | pie.title = '吨标准煤(TCE)占比' |
|
| 357 | labels = Reference(ws, min_col=2, min_row=table_start_row_number + 1, max_row=table_end_row_number) |
|
| 358 | pie_data = Reference(ws, min_col=3, min_row=table_start_row_number, max_row=table_end_row_number) |
|
| 359 | pie.add_data(pie_data, titles_from_data=True) |
|
| 360 | pie.set_categories(labels) |
|
| 361 | pie.height = 5.25 |
|
| 362 | pie.width = 9 |
|
| 363 | s1 = pie.series[0] |
|
| 364 | s1.dLbls = DataLabelList() |
|
| 365 | s1.dLbls.showCatName = False |
|
| 366 | s1.dLbls.showVal = True |
|
| 367 | s1.dLbls.showPercent = True |
|
| 368 | ws.add_chart(pie, 'D' + str(chart_start_row_number)) |
|
| 369 | ||
| 370 | ws['B' + str(current_row_number)].font = title_font |
|
| 371 | ws['B' + str(current_row_number)] = name + ' 吨二氧化碳排放(TCO2E)占比' |
|
| 372 | ||
| 373 | current_row_number += 1 |
|
| 374 | table_start_row_number = current_row_number |
|
| 375 | chart_start_row_number = current_row_number |
|
| 376 | ||
| 377 | ws['B' + str(current_row_number)].fill = table_fill |
|
| 378 | ||
| 379 | ws['C' + str(current_row_number)].fill = table_fill |
|
| 380 | ws['C' + str(current_row_number)].font = name_small_font |
|
| 381 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
|
| 382 | ws['C' + str(current_row_number)].border = f_border |
|
| 383 | ws['C' + str(current_row_number)] = '吨二氧化碳排放(TCO2E)占比' |
|
| 384 | ||
| 385 | current_row_number += 1 |
|
| 386 | ||
| 387 | for i in range(0, ca_len): |
|
| 388 | ws['B' + str(current_row_number)].font = title_font |
|
| 389 | ws['B' + str(current_row_number)].alignment = c_c_alignment |
|
| 390 | ws['B' + str(current_row_number)].border = f_border |
|
| 391 | ws['B' + str(current_row_number)] = reporting_period_data['names'][i] |
|
| 392 | ||
| 393 | ws['C' + str(current_row_number)].font = name_font |
|
| 394 | ws['C' + str(current_row_number)].alignment = c_c_alignment |
|
| 395 | ws['C' + str(current_row_number)].border = f_border |
|
| 396 | ws['C' + str(current_row_number)] = round(reporting_period_data['subtotals_in_kgco2e_saving'][i], 2) |
|
| 397 | ||
| 398 | current_row_number += 1 |
|
| 399 | ||
| 400 | table_end_row_number = current_row_number - 1 |
|
| 401 | ||
| 402 | if ca_len < 4: |
|
| 403 | current_row_number = current_row_number - ca_len + 4 |
|
| 404 | ||
| 405 | current_row_number += 1 |
|
| 406 | ||
| 407 | pie = PieChart() |
|
| 408 | pie.title = '吨二氧化碳排放(TCO2E)占比' |
|
| 409 | labels = Reference(ws, min_col=2, min_row=table_start_row_number + 1, max_row=table_end_row_number) |
|
| 410 | pie_data = Reference(ws, min_col=3, min_row=table_start_row_number, max_row=table_end_row_number) |
|
| 411 | pie.add_data(pie_data, titles_from_data=True) |
|
| 412 | pie.set_categories(labels) |
|
| 413 | pie.height = 5.25 |
|
| 414 | pie.width = 9 |
|
| 415 | s1 = pie.series[0] |
|
| 416 | s1.dLbls = DataLabelList() |
|
| 417 | s1.dLbls.showCatName = False |
|
| 418 | s1.dLbls.showVal = True |
|
| 419 | s1.dLbls.showPercent = True |
|
| 420 | ws.add_chart(pie, 'D' + str(chart_start_row_number)) |
|
| 421 | ||
| 422 | ############################################# |
|
| 423 | ||