-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
feature:st.vega_lite_chartRelated to the `st.vega_lite_chart` elementRelated to the `st.vega_lite_chart` elementpriority:P2Medium-high priority - fix within one monthMedium-high priority - fix within one monthstatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected
Description
Checklist
- I have searched the existing issues for similar issues.
- I added a very descriptive title to this issue.
- I have provided sufficient information below to help reproduce this issue.
Summary
- create vega_lite_chart and populate it with some data
- keep first and last values in the array the same as before BUT add several data points to the data but also change some data in the middle
- Following code only checks first and last items in the array and determines that whole array is the same as before therefore no need to re-render middle parts which is absolutely wrong:
streamlit/frontend/src/lib/components/elements/ArrowVegaLiteChart/ArrowVegaLiteChart.tsx
Line 504 in 0ed20b1
// (this is a very light check, and not guaranteed to be right!)
Reproducible Code Example
import pandas as pd
import streamlit as st
data1 = {
"VALUE": [420, 380, 390],
"DATE": [50, 60, 70]
}
data = pd.DataFrame(data1)
data2 = {
"VALUE": [420, 200, 390, 600],
"DATE": [50, 60, 70, 80]
}
if st.button(label="change"):
data = pd.DataFrame(data2)
st.vega_lite_chart(
data=pd.DataFrame(data),
spec={
"autosize": {
"type": "fit",
"contains": "padding",
"resize": True,
},
"title": "test",
"layer": [
{
"layer": [
{
"mark": "line",
},
],
"encoding": {
"x": {
"field": "DATE",
"title": "",
"type": "quantitative",
},
"y": {
"field": "VALUE",
"title": "",
"type": "quantitative",
},
},
},
],
},
use_container_width=True,
theme="streamlit",
)
st.vega_lite_chart(
data=pd.DataFrame(data2),
spec={
"autosize": {
"type": "fit",
"contains": "padding",
"resize": True,
},
"title": "test",
"layer": [
{
"layer": [
{
"mark": "line",
},
],
"encoding": {
"x": {
"field": "DATE",
"title": "",
"type": "quantitative",
},
"y": {
"field": "VALUE",
"title": "",
"type": "quantitative",
},
},
},
],
},
use_container_width=True,
theme="streamlit",
)
Steps To Reproduce
run the code and click "change" button
Expected Behavior
charts become the same
Current Behavior
charts are different
Is this a regression?
- Yes, this used to work in a previous version.
Debug info
it's been there for past 2 years or so
Additional Information
No response
Are you willing to submit a PR?
- Yes, I am willing to submit a PR!
github-actions
Metadata
Metadata
Assignees
Labels
feature:st.vega_lite_chartRelated to the `st.vega_lite_chart` elementRelated to the `st.vega_lite_chart` elementpriority:P2Medium-high priority - fix within one monthMedium-high priority - fix within one monthstatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected