Skip to content

Commit

Permalink
change viz
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmajestic committed Feb 25, 2024
1 parent 31fc458 commit 6ddc1a1
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions odds.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,23 @@ async def get_calcs():
grouped = grouped.sort_values('mean', ascending=False)

# Create a Plotly chart
fig = go.Figure(data=[
go.Bar(name='Average', x=grouped['bookmaker'], y=grouped['mean']),
go.Bar(name='Total', x=grouped['bookmaker'], y=grouped['sum'])
])

# Change the bar mode
fig.update_layout(barmode='group')
fig = go.Figure()

# Add a bar chart for the average price difference
fig.add_trace(go.Bar(name='Average', x=grouped['bookmaker'], y=grouped['mean']))

# Add a line chart for the total price difference with a second y-axis
fig.add_trace(go.Scatter(name='Total', x=grouped['bookmaker'], y=grouped['sum'], yaxis='y2'))

# Update the layout to include the second y-axis
fig.update_layout(
yaxis2=dict(
title='Total',
overlaying='y',
side='right'
),
barmode='group'
)

# Convert the Plotly chart to HTML and return it
html = fig.to_html(full_html=False)
Expand Down

0 comments on commit 6ddc1a1

Please sign in to comment.