Code Duplication    Length = 73-75 lines in 2 locations

excelexporters/spaceenergycategory.py 1 location

@@ 293-367 (lines=75) @@
290
            len(reporting_period_data['toppeaks']) == 0:
291
        has_ele_peak_flag = False
292
293
    if has_ele_peak_flag:
294
        ws['B12'].font = title_font
295
        ws['B12'] = name+' 分时电耗'
296
297
        ws['B13'].fill = table_fill
298
        ws['B13'].font = name_font
299
        ws['B13'].alignment = c_c_alignment
300
        ws['B13'].border = f_border
301
302
        ws['C13'].fill = table_fill
303
        ws['C13'].font = name_font
304
        ws['C13'].alignment = c_c_alignment
305
        ws['C13'].border = f_border
306
        ws['C13'] = '分时电耗'
307
308
        ws['B14'].font = title_font
309
        ws['B14'].alignment = c_c_alignment
310
        ws['B14'] = '尖'
311
        ws['B14'].border = f_border
312
313
        ws['C14'].font = title_font
314
        ws['C14'].alignment = c_c_alignment
315
        ws['C14'].border = f_border
316
        ws['C14'] = round(reporting_period_data['toppeaks'][0], 0)
317
318
        ws['B15'].font = title_font
319
        ws['B15'].alignment = c_c_alignment
320
        ws['B15'] = '峰'
321
        ws['B15'].border = f_border
322
323
        ws['C15'].font = title_font
324
        ws['C15'].alignment = c_c_alignment
325
        ws['C15'].border = f_border
326
        ws['C15'] = round(reporting_period_data['onpeaks'][0], 0)
327
328
        ws['B16'].font = title_font
329
        ws['B16'].alignment = c_c_alignment
330
        ws['B16'] = '平'
331
        ws['B16'].border = f_border
332
333
        ws['C16'].font = title_font
334
        ws['C16'].alignment = c_c_alignment
335
        ws['C16'].border = f_border
336
        ws['C16'] = round(reporting_period_data['midpeaks'][0], 0)
337
338
        ws['B17'].font = title_font
339
        ws['B17'].alignment = c_c_alignment
340
        ws['B17'] = '谷'
341
        ws['B17'].border = f_border
342
343
        ws['C17'].font = title_font
344
        ws['C17'].alignment = c_c_alignment
345
        ws['C17'].border = f_border
346
        ws['C17'] = round(reporting_period_data['offpeaks'][0], 0)
347
348
        pie = PieChart()
349
        labels = Reference(ws, min_col=2, min_row=14, max_row=17)
350
        pie_data = Reference(ws, min_col=3, min_row=14, max_row=17)
351
        pie.add_data(pie_data, titles_from_data=True)
352
        pie.set_categories(labels)
353
        pie.height = 5.25  # cm 1.05*5 1.05cm = 30 pt
354
        pie.width = 9
355
        # pie.title = "Pies sold by category"
356
        s1 = pie.series[0]
357
        s1.dLbls = DataLabelList()
358
        s1.dLbls.showCatName = False  # 标签显示
359
        s1.dLbls.showVal = True  # 数量显示
360
        s1.dLbls.showPercent = True  # 百分比显示
361
        # s1 = CharacterProperties(sz=1800)     # 图表中字体大小 *100
362
363
        ws.add_chart(pie, "D13")
364
365
    else:
366
        for i in range(12, 18 + 1):
367
            ws.row_dimensions[i].height = 0.1
368
        # end_row 10
369
        # start_row 12
370
    ################################################

excelexporters/spacecost.py 1 location

@@ 237-309 (lines=73) @@
234
            len(reporting_period_data['toppeaks']) == 0:
235
        has_ele_peak_flag = False
236
237
    if has_ele_peak_flag:
238
        ws['B12'].font = title_font
239
        ws['B12'] = name + '分时用电成本'
240
241
        ws['B13'].fill = table_fill
242
        ws['B13'].font = name_font
243
        ws['B13'].alignment = c_c_alignment
244
        ws['B13'].border = f_border
245
246
        ws['C13'].fill = table_fill
247
        ws['C13'].font = name_font
248
        ws['C13'].alignment = c_c_alignment
249
        ws['C13'].border = f_border
250
        ws['C13'] = '分时用电成本'
251
252
        ws['B14'].font = title_font
253
        ws['B14'].alignment = c_c_alignment
254
        ws['B14'] = '尖'
255
        ws['B14'].border = f_border
256
257
        ws['C14'].font = title_font
258
        ws['C14'].alignment = c_c_alignment
259
        ws['C14'].border = f_border
260
        ws['C14'] = round(reporting_period_data['toppeaks'][0], 0)
261
262
        ws['B15'].font = title_font
263
        ws['B15'].alignment = c_c_alignment
264
        ws['B15'] = '峰'
265
        ws['B15'].border = f_border
266
267
        ws['C15'].font = title_font
268
        ws['C15'].alignment = c_c_alignment
269
        ws['C15'].border = f_border
270
        ws['C15'] = round(reporting_period_data['onpeaks'][0], 0)
271
272
        ws['B16'].font = title_font
273
        ws['B16'].alignment = c_c_alignment
274
        ws['B16'] = '平'
275
        ws['B16'].border = f_border
276
277
        ws['C16'].font = title_font
278
        ws['C16'].alignment = c_c_alignment
279
        ws['C16'].border = f_border
280
        ws['C16'] = round(reporting_period_data['midpeaks'][0], 0)
281
282
        ws['B17'].font = title_font
283
        ws['B17'].alignment = c_c_alignment
284
        ws['B17'] = '谷'
285
        ws['B17'].border = f_border
286
287
        ws['C17'].font = title_font
288
        ws['C17'].alignment = c_c_alignment
289
        ws['C17'].border = f_border
290
        ws['C17'] = round(reporting_period_data['offpeaks'][0], 0)
291
292
        pie = PieChart()
293
        labels = Reference(ws, min_col=2, min_row=14, max_row=17)
294
        pie_data = Reference(ws, min_col=3, min_row=13, max_row=17)
295
        pie.add_data(pie_data, titles_from_data=True)
296
        pie.set_categories(labels)
297
        pie.height = 5.25
298
        pie.width = 9
299
        s1 = pie.series[0]
300
        s1.dLbls = DataLabelList()
301
        s1.dLbls.showCatName = False
302
        s1.dLbls.showVal = True
303
        s1.dLbls.showPercent = True
304
305
        ws.add_chart(pie, "D13")
306
307
    else:
308
        for i in range(12, 18 + 1):
309
            ws.row_dimensions[i].height = 0.1
310
311
    ##################################
312
    current_row_flag = 19