Пример #1
0
def update_output(start_date, end_date):
    if start_date is None:
        return update_bar_chart_layout(small_chart)
    elif end_date is None:
        return update_bar_chart_layout(small_chart)
    else:
        growth = time_df['ConvertedDate'].value_counts().sort_index()
        growth = growth.loc[start_date:end_date]

        if len(growth) == 0:
            return update_bar_chart_layout(small_chart)

        else:
            events = growth.to_frame().reset_index()
            events.rename(columns={'index':'Date', 'ConvertedDate':'Count'}, inplace=True)

            plot = px.line(events,
                              x='Date',
                              y='Count',
                              hover_name='Count',
                              hover_data={'Count':False},
                              render_mode='svg',
                              )

            plot.update_layout(yaxis=dict(visible=False))
            return plot
Пример #2
0
def hold_fx(start_date, end_date):
    if start_date is None:
        return update_bar_chart_layout(small_chart)
    elif end_date is None:
        return update_bar_chart_layout(small_chart)
    else:
        time_df.loc[:, 'ConvertedDate'] = pd.to_datetime(time_df.loc[:, 'ConvertedDate'].dt.date)
        growth = time_df.set_index('ConvertedDate')
        growth = growth.loc[start_date:end_date]
        if len(growth) == 0:
            return update_bar_chart_layout(small_chart)

        else:
            grouped_date = growth.groupby(growth.index)['Tribe'].count().cumsum()
            plot = px.line(grouped_date,
                              x=grouped_date.index,
                              y=grouped_date.values,
                              hover_name=grouped_date.values,
                              #hover_data={grouped_date.values:False},
                              #text='Count'
                              )
            plot.update_layout(yaxis=dict(visible=False))
            return plot
def update_output(start_date, end_date):
    if start_date is None:
        return update_bar_chart_layout(small_chart)
    elif end_date is None:
        return update_bar_chart_layout(small_chart)
    else:
        events = df.iloc[:,:2]
        events['CreatedDate'] = pd.to_datetime(events['CreatedDate']).dt.date
        events = events.set_index('CreatedDate')
        events.index = pd.to_datetime(events.index)
        events = events.loc[start_date:end_date]
        if len(events) == 0:
            return update_bar_chart_layout(small_chart)
        else:
            events = events[events['How_did_you_hear_about_Elite_Meet'].str.len() < 30]
            events.rename(columns={'How_did_you_hear_about_Elite_Meet':'Channel'}, inplace=True)
            values = events['Channel'].value_counts().to_frame().reset_index()
            values.rename(columns={'Channel':'Count', 'index': 'Channels'}, inplace=True)

            barchart = px.bar(values,
                              x='Channels',
                              y='Count',
                              orientation='v',
                              hover_name='Channels',
                              hover_data={'Count': False, 'Channels':False},
                              text='Count'
                              )

            update_bar_chart_layout(barchart, chart_title='Marketing Channels - Time Range', title_size=28)
            barchart.update_layout(
            xaxis = dict(
                tickmode = 'array',
                tickvals = []
            )
        )
            return barchart
Пример #4
0
filepath = 'data/Lead_' + timestamp
time_df = pd.read_csv(filepath + '.csv', usecols=['ConvertedDate'])
time_df.loc[:, 'ConvertedDate'] = pd.to_datetime(time_df.loc[:, 'ConvertedDate'])

#import tribe data and create options
tribe_df = pd.read_csv('data/updated_pilots.csv', usecols=['CreatedDate', 'Branch', 'Tribe'])
tribe_df.loc[:, 'CreatedDate'] = pd.to_datetime(tribe_df.loc[:, 'CreatedDate'])
tribes = tribe_df['Tribe'].unique()
tribe_selection = [{'label':val, 'value':val} for val in tribes]

#initiatlize overall bar chart
initial_barchart = go.Figure(go.Bar())
small_chart = go.Figure(go.Bar())

#update_bar_chart_layout(barchart)
update_bar_chart_layout(small_chart)


# LAYOUT #################################################################################################################
layout = html.Div(id='container', children=[
    dbc.Row([
        dbc.Col(children=html.H2(id='title',
                                 children='Elite Meet Growth',
                                 style=dict(
                                     fontSize=40,
                                     fontFamily='Times',
                                     marginLeft='25px',
                                     marginTop='20px'))
                ),
# EM Logo
        dbc.Col(width=2, children=
Пример #5
0
#set color scheme
colors = {
    'background1': '#111111',
    'background2': '#008080',
    'text': '#7FDBFF'
}
branch_colors = ['blue', 'green', 'red', 'skyblue']

#create figure object for map
# map_fig = go.Figure(go.Scattermapbox(mode='markers'))
# update_scatter_map_layout(map_fig)

#create figure object for bar graph
barchart = go.Figure(go.Bar())
update_bar_chart_layout(barchart, selector='Branch')

#LAYOUT
##########################################################################################################################

layout = html.Div(
    id='app-container',
    children=[
        html.Div(
            id='border',
            children=[
                dbc.Row([
                    dbc.Col(  #style=dict(backgroundColor='orange',
                        html.H2(id='title',
                                children='Elite Meet Membership',
                                style=dict(fontSize=40,
def update_bar(value):
    if value is None or len(value) == 0:
        return update_bar_chart_layout(small_chart)
    else:
        return plot_small_marketing_barplot(df, value)