Skip to content

Commit 9f6c80a

Browse files
committed
Use a list of floats in the simple sample
Signed-off-by: Joe Friedrichsen <[email protected]>
1 parent ca34529 commit 9f6c80a

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

examples/sample/sample.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""This example demonstrates how to open/update a Streamlit application using nipanel package."""
22

3-
import itertools
4-
import math
53
import pathlib
64

75
import nipanel
@@ -18,13 +16,7 @@
1816
panel.set_value("sample_int", 42)
1917
panel.set_value("sample_float", 3.14)
2018
panel.set_value("sample_bool", True)
21-
22-
x_values = [
23-
float(x) for x in itertools.takewhile(lambda p: p < 2 * math.pi, itertools.count(0, 0.05))
24-
]
25-
y_values = [math.sin(x) for x in x_values]
26-
panel.set_value("x_values", x_values)
27-
panel.set_value("y_values", y_values)
19+
panel.set_value("float_values", [1.1, 2.2, 3.3])
2820

2921
input("Press Enter to close the panel...")
3022

examples/sample/sample_panel.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Streamlit application script for displaying values using nipanel package."""
22

3-
import pandas as pd
43
import streamlit as st
54

65
import nipanel
@@ -16,22 +15,11 @@
1615
st.write("Integer")
1716
st.write("Float")
1817
st.write("Boolean")
19-
st.write("Line")
18+
st.write("List")
2019

2120
with col2:
2221
st.write(panel.get_value("sample_string"))
2322
st.write(panel.get_value("sample_int"))
2423
st.write(panel.get_value("sample_float"))
2524
st.write(panel.get_value("sample_bool"))
26-
st.line_chart(
27-
data=pd.DataFrame(
28-
{
29-
"x": panel.get_value("x_values"),
30-
"y": panel.get_value("y_values"),
31-
}
32-
),
33-
x="x",
34-
y="y",
35-
x_label="x",
36-
y_label="sin(x)",
37-
)
25+
st.write(panel.get_value("float_values"))

0 commit comments

Comments
 (0)