This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function callback(selection){ | |
let response = await fetch("/callback?data="+selection); | |
if (response.ok) { | |
let result = await response.json(); | |
Plotly.newPlot('chart1', result, {}); | |
} else { | |
alert(response.status); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> | |
<script src='https://cdn.plot.ly/plotly-latest.min.js'></script> | |
</head> | |
<body> | |
<div class="jumbotron"> | |
<h1>Weather Data</h1> | |
<p class="lead"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<div class="jumbotron"> | |
<h1>Weather Data</h1> | |
<p class="lead"> | |
Some graphs about the weather in London in 2020 | |
</p> | |
</div> | |
<div class="row"> | |
<div class="col-sm-2 p-2 ml-4 mb-1"> | |
<button type="button" class="btn btn-secondary">Select chart from list:</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> | |
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> | |
<script src='https://cdn.plot.ly/plotly-latest.min.js'></script> | |
<py-env> | |
- matplotlib | |
- pandas | |
- plotly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Countries | |
clist = df['country'].unique() | |
country = st.selectbox("Select a country:", clist) | |
col1, col2 = st.columns(2) | |
fig = px.line(df[df['country'] == country], | |
x="year", y="gdpPercap", title="GDP per Capita") | |
col1.plotly_chart(fig, use_container_width=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Continents | |
contlist = df['continent'].unique() | |
continent = st.selectbox("Select a continent:", contlist) | |
col1, col2 = st.columns(2) | |
fig = px.line(df[df['continent'] == continent], | |
x = "year", y = "gdpPercap", | |
title = "GDP per Capita",color = 'country') | |
col1.plotly_chart(fig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import pandas as pd | |
import plotly.express as px | |
st.set_page_config(layout="wide") | |
df = pd.DataFrame(px.data.gapminder()) | |
def countryData(): | |
# Countries code goes here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(): | |
import streamlit as st | |
import pandas as pd | |
import plotly.express as px | |
df = pd.DataFrame(px.data.gapminder()) | |
# Continents/Country code goes here | |
# This code allows you to run the app standalone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message = """ | |
__Select an application from the list below__ | |
""" | |
import streamlit as st | |
st.set_page_config(layout = "wide") # optional | |
from stlib import countryData | |
from stlib import continentData | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message = """ | |
__Select an application from the list below__ | |
""" | |
import json | |
import streamlit as st | |
import importlib | |
import stlib # default library name for apps | |
from stlib import libContents | |
NewerOlder