| @@ 212-284 (lines=73) @@ | ||
| 209 | continue |
|
| 210 | parameters_parameters_datas_len += 1 |
|
| 211 | start_detail_data_row_num = 9 + (parameters_parameters_datas_len + ca_len) * 6 |
|
| 212 | if has_data_flag: |
|
| 213 | time = times[0] |
|
| 214 | for time in times: |
|
| 215 | if len(time) > 0: |
|
| 216 | break |
|
| 217 | has_data = False |
|
| 218 | current_sheet_parameters_row_number = 7 |
|
| 219 | for i in range(8, len(time) + 6 + ca_len * 6 + len(category) * 6 + 2): |
|
| 220 | ws.row_dimensions[i].height = 42 |
|
| 221 | if len(time) > 0: |
|
| 222 | has_data = True |
|
| 223 | current_sheet_parameters_row_number = 7 + ca_len * 6 |
|
| 224 | if has_data: |
|
| 225 | ||
| 226 | max_row = start_detail_data_row_num + len(time) |
|
| 227 | ws['B6'].font = title_font |
|
| 228 | ws['B6'] = name + ' ' + _('Trend') |
|
| 229 | ||
| 230 | ws.row_dimensions[start_detail_data_row_num - 1].height = 60 |
|
| 231 | ws['B' + str(start_detail_data_row_num - 1)].fill = table_fill |
|
| 232 | ws['B' + str(start_detail_data_row_num - 1)].font = title_font |
|
| 233 | ws['B' + str(start_detail_data_row_num - 1)].border = f_border |
|
| 234 | ws['B' + str(start_detail_data_row_num - 1)].alignment = c_c_alignment |
|
| 235 | ws['B' + str(start_detail_data_row_num - 1)] = _('Datetime') |
|
| 236 | ||
| 237 | for i in range(0, len(time)): |
|
| 238 | col = 'B' |
|
| 239 | row = str(start_detail_data_row_num + i) |
|
| 240 | ws[col + row].font = title_font |
|
| 241 | ws[col + row].alignment = c_c_alignment |
|
| 242 | ws[col + row] = time[i] |
|
| 243 | ws[col + row].border = f_border |
|
| 244 | ||
| 245 | for i in range(0, ca_len): |
|
| 246 | # 38 title |
|
| 247 | col = format_cell.get_column_letter(3 + i) |
|
| 248 | ||
| 249 | ws[col + str(start_detail_data_row_num - 1)].fill = table_fill |
|
| 250 | ws[col + str(start_detail_data_row_num - 1)].font = title_font |
|
| 251 | ws[col + str(start_detail_data_row_num - 1)].alignment = c_c_alignment |
|
| 252 | ws[col + str(start_detail_data_row_num - 1)] = report['reporting_period']['names'][i] |
|
| 253 | ws[col + str(start_detail_data_row_num - 1)].border = f_border |
|
| 254 | ||
| 255 | for j in range(0, len(time)): |
|
| 256 | ||
| 257 | row = str(start_detail_data_row_num + j) |
|
| 258 | ws[col + row].font = title_font |
|
| 259 | ws[col + row].alignment = c_c_alignment |
|
| 260 | try: |
|
| 261 | ws[col + row] = round2(report['reporting_period']['values'][i][j], 3) if \ |
|
| 262 | len(report['reporting_period']['values'][i]) > 0 and \ |
|
| 263 | len(report['reporting_period']['values'][i]) > j and \ |
|
| 264 | report['reporting_period']['values'][i][j] is not None else '' |
|
| 265 | except Exception as e: |
|
| 266 | print('error 1 in excelexporters\\metertrend: ' + str(e)) |
|
| 267 | ||
| 268 | ws[col + row].border = f_border |
|
| 269 | # line |
|
| 270 | # 39~: line |
|
| 271 | line = LineChart() |
|
| 272 | line.title = report['reporting_period']['names'][i] |
|
| 273 | labels = Reference(ws, min_col=2, min_row=start_detail_data_row_num, max_row=max_row-1) |
|
| 274 | line_data = Reference(ws, min_col=3 + i, min_row=start_detail_data_row_num+1, max_row=max_row-1) |
|
| 275 | line.add_data(line_data, titles_from_data=True) |
|
| 276 | line.set_categories(labels) |
|
| 277 | line_data.smooth = True |
|
| 278 | line.x_axis.crosses = 'min' |
|
| 279 | line.height = 8.25 |
|
| 280 | line.width = 36 |
|
| 281 | chart_col = chr(ord('B')) |
|
| 282 | chart_cell = chart_col + str(7 + 6*i) |
|
| 283 | ||
| 284 | ws.add_chart(line, chart_cell) |
|
| 285 | ||
| 286 | #################################################################################################################### |
|
| 287 | # 12 is the starting line number of the last line chart in the report period |
|
| @@ 205-277 (lines=73) @@ | ||
| 202 | times = report['reporting_period']['timestamps'] |
|
| 203 | category = report['meter']['energy_category_name'] |
|
| 204 | start_detail_data_row_num = 9 + ca_len * 6 |
|
| 205 | if has_data_flag: |
|
| 206 | time = times[0] |
|
| 207 | for time in times: |
|
| 208 | if len(time) > 0: |
|
| 209 | break |
|
| 210 | has_data = False |
|
| 211 | current_sheet_parameters_row_number = 7 |
|
| 212 | for i in range(8, len(time) + 6 + ca_len * 6 + len(category) * 6 + 2): |
|
| 213 | ws.row_dimensions[i].height = 42 |
|
| 214 | if len(time) > 0: |
|
| 215 | has_data = True |
|
| 216 | current_sheet_parameters_row_number = 7 + ca_len * 6 |
|
| 217 | if has_data: |
|
| 218 | ||
| 219 | max_row = start_detail_data_row_num + len(time) |
|
| 220 | ws['B6'].font = title_font |
|
| 221 | ws['B6'] = name + ' ' + _('Trend') |
|
| 222 | ||
| 223 | ws.row_dimensions[start_detail_data_row_num - 1].height = 60 |
|
| 224 | ws['B' + str(start_detail_data_row_num - 1)].fill = table_fill |
|
| 225 | ws['B' + str(start_detail_data_row_num - 1)].font = title_font |
|
| 226 | ws['B' + str(start_detail_data_row_num - 1)].border = f_border |
|
| 227 | ws['B' + str(start_detail_data_row_num - 1)].alignment = c_c_alignment |
|
| 228 | ws['B' + str(start_detail_data_row_num - 1)] = _('Datetime') |
|
| 229 | ||
| 230 | for i in range(0, len(time)): |
|
| 231 | col = 'B' |
|
| 232 | row = str(start_detail_data_row_num + i) |
|
| 233 | ws[col + row].font = title_font |
|
| 234 | ws[col + row].alignment = c_c_alignment |
|
| 235 | ws[col + row] = time[i] |
|
| 236 | ws[col + row].border = f_border |
|
| 237 | ||
| 238 | for i in range(0, ca_len): |
|
| 239 | # 38 title |
|
| 240 | col = format_cell.get_column_letter(3 + i) |
|
| 241 | ||
| 242 | ws[col + str(start_detail_data_row_num - 1)].fill = table_fill |
|
| 243 | ws[col + str(start_detail_data_row_num - 1)].font = title_font |
|
| 244 | ws[col + str(start_detail_data_row_num - 1)].alignment = c_c_alignment |
|
| 245 | ws[col + str(start_detail_data_row_num - 1)] = report['reporting_period']['names'][i] |
|
| 246 | ws[col + str(start_detail_data_row_num - 1)].border = f_border |
|
| 247 | ||
| 248 | for j in range(0, len(time)): |
|
| 249 | ||
| 250 | row = str(start_detail_data_row_num + j) |
|
| 251 | ws[col + row].font = title_font |
|
| 252 | ws[col + row].alignment = c_c_alignment |
|
| 253 | try: |
|
| 254 | ws[col + row] = round2(report['reporting_period']['values'][i][j], 3) if \ |
|
| 255 | len(report['reporting_period']['values'][i]) > 0 and \ |
|
| 256 | len(report['reporting_period']['values'][i]) > j and \ |
|
| 257 | report['reporting_period']['values'][i][j] is not None else '' |
|
| 258 | except Exception as e: |
|
| 259 | print('error 1 in excelexporters\\metertrend: ' + str(e)) |
|
| 260 | ||
| 261 | ws[col + row].border = f_border |
|
| 262 | # line |
|
| 263 | # 39~: line |
|
| 264 | line = LineChart() |
|
| 265 | line.title = report['reporting_period']['names'][i] |
|
| 266 | labels = Reference(ws, min_col=2, min_row=start_detail_data_row_num, max_row=max_row-1) |
|
| 267 | line_data = Reference(ws, min_col=3 + i, min_row=start_detail_data_row_num+1, max_row=max_row-1) |
|
| 268 | line.add_data(line_data, titles_from_data=True) |
|
| 269 | line.set_categories(labels) |
|
| 270 | line_data.smooth = True |
|
| 271 | line.x_axis.crosses = 'min' |
|
| 272 | line.height = 8.25 |
|
| 273 | line.width = 36 |
|
| 274 | chart_col = chr(ord('B')) |
|
| 275 | chart_cell = chart_col + str(7 + 6*i) |
|
| 276 | ||
| 277 | ws.add_chart(line, chart_cell) |
|
| 278 | ||
| 279 | #################################################################################################################### |
|
| 280 | # Power Quality Analysis sheet |
|