I'm on the main branch of Panel trying to help rh1 in https://discourse.holoviz.org/t/how-to-use-pn-indicator-trend/6670.
I can see that a date_range does not work as the plot_x value for Trend indicator.
import pandas as pd
import panel as pn
import numpy as np
data = pd.DataFrame(
{
"Date": pd.date_range(start="2020-01-01", periods=12, freq="M"),
"Sales": [100, 120, 150, 130, 110, 140, 160, 180, 200, 220, 250, 230],
}
)
data["x"] = list(range(len(data["Date"])))
pn.indicators.Trend(
data=data,
plot_x="Date",
plot_y="Sales",
styles={"color": "#1f77b4"},
height=200,
width=400,
).servable()

Workaround
Use a simple column of integers
import pandas as pd
import panel as pn
import numpy as np
data = pd.DataFrame(
{
"Date": pd.date_range(start="2020-01-01", periods=12, freq="M"),
"Sales": [100, 120, 150, 130, 110, 140, 160, 180, 200, 220, 250, 230],
}
)
data["x"] = list(range(len(data["Date"])))
pn.indicators.Trend(
data=data,
plot_x="x",
plot_y="Sales",
styles={"color": "#1f77b4"},
height=200,
width=400,
).servable()

I'm on the
mainbranch of Panel trying to help rh1 in https://discourse.holoviz.org/t/how-to-use-pn-indicator-trend/6670.I can see that a
date_rangedoes not work as theplot_xvalue for Trend indicator.Workaround
Use a simple column of integers