예제 #1
0
        num_handles = len(legend.legendHandles)
        _ = [legend.legendHandles[_].set_color(final_colors[_]) for _ in range(0, num_handles)]

        frame = legend.get_frame()
        frame.set_alpha(0)

    chart_tools.format_custom_line_segments(
        ax=ax,
        plug_dict=PLUG_DICT,
        p_dict=P_DICT,
        k_dict=K_DICT,
        logger=LOG,
        orient="horiz"
    )
    chart_tools.format_grids(p_dict=P_DICT, k_dict=K_DICT, logger=LOG)
    chart_tools.format_title(p_dict=P_DICT, k_dict=K_DICT, loc=(0.5, 0.98))
    chart_tools.format_axis_y_ticks(p_dict=P_DICT, k_dict=K_DICT, logger=LOG)

    try:
        chart_tools.save(logger=LOG)

    except OverflowError as err:
        if "date value out of range" in traceback.format_exc(err):
            LOG['Critical'].append(
                f"[{PAYLOAD['props']['name']}] Chart not saved. Try enabling Display Zero Bars in"
                f"device settings."
            )

except Exception as sub_error:
    tb = traceback.format_exc()
    tb_type = sys.exc_info()[1]
예제 #2
0
    if not P_DICT['textAreaBorder']:
        _ = [s.set_visible(False) for s in ax.spines.values()]

    # Transparent Charts Fill
    if P_DICT['transparent_charts'] and P_DICT['transparent_filled']:
        ax.add_patch(
            patches.Rectangle(
                (0, 0),
                1,
                1,
                transform=ax.transAxes,
                # facecolor=P_DICT['faceColor'],
                zorder=1))

    # =============================== Format Title ================================
    chart_tools.format_title(p_dict=P_DICT,
                             k_dict=K_DICT,
                             loc=(0.5, 0.98),
                             align='center')

    chart_tools.save(logger=LOG)

except Exception as sub_error:
    tb = traceback.format_exc()
    tb_type = sys.exc_info()[1]
    LOG['Debug'].append(f"[{CHART_NAME}] {tb}")
    LOG['Critical'].append(f"[{CHART_NAME}] Error type: {tb_type}")

json.dump(LOG, sys.stdout, indent=4)
예제 #3
0
                               loc='upper center',
                               bbox_to_anchor=(0.5, -0.05),
                               ncol=2,
                               prop={'size': float(P_DICT['legendFontSize'])})
            legend.legendHandles[0].set_color(P_DICT['currentWindColor'])
            legend.legendHandles[1].set_color(P_DICT['maxWindColor'])
            _ = [
                text.set_color(P_DICT['fontColor'])
                for text in legend.get_texts()
            ]
            frame = legend.get_frame()
            frame.set_alpha(0)

        chart_tools.format_title(p_dict=P_DICT,
                                 k_dict=K_DICT,
                                 loc=(0.025, 0.98),
                                 align='left',
                                 logger=LOG)

    # Set the tick label size
    font_color = PLUG_DICT['fontColor']
    if P_DICT['customSizeFont']:
        plt.xticks(fontsize=int(P_DICT['customTickFontSize']),
                   color=font_color)
        plt.yticks(fontsize=int(P_DICT['customTickFontSize']),
                   color=font_color)
    else:
        plt.xticks(fontsize=int(P_DICT['tickFontSize']), color=font_color)
        plt.yticks(fontsize=int(P_DICT['tickFontSize']), color=font_color)

    chart_tools.save(logger=LOG)