-
-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap Labels for the Trend Indicator #2229
Labels
type: enhancement
Minor feature or improvement to an existing feature
Milestone
Comments
Hi @tlmille2 Thanks for reporting. It would help a lot of you provided a minimum, reproducible example and a screenshot of the problem. Could you do that? And please add the css of the temporary fix or a true fix. Thanks. Thanks. |
philippjfr
added
the
type: enhancement
Minor feature or improvement to an existing feature
label
Apr 23, 2021
@MarcSkovMadsen - Here's a reproducible example and screenshot Exampleimport pandas as pd
import panel as pn
data = [[1, 10, 15], [2, 15, 20], [3, 20, 25],
[4, 25, 30], [5, 30, 35], [6, 35, 40],
[7, 40, 45], [8, 45, 50], [9, 50, 55]]
df = pd.DataFrame(data, columns = ['week', 'TEST_LONG_NAME_WITH_UNDERSCORE_1', 'TEST_LONG_NAME_WITH_UNDERSCORE_2'])
columns = df.columns
list_of_trend = []
for i in columns:
data = df[['week', i]]
data = data.rename(columns={"week": "x", i: "y"})
trend = pn.indicators.Trend(title=i, data=data, width=200, height=200, plot_type='area')
list_of_trend.append(trend)
pn.Row(list_of_trend[0], list_of_trend[1], list_of_trend[2]) Temporary Fix Using MarginsThe temporary fix is to add margins to the indicator widget import pandas as pd
import panel as pn
data = [[1, 10, 15], [2, 15, 20], [3, 20, 25],
[4, 25, 30], [5, 30, 35], [6, 35, 40],
[7, 40, 45], [8, 45, 50], [9, 50, 55]]
df = pd.DataFrame(data, columns = ['week', 'TEST_LONG_NAME_WITH_UNDERSCORE_1', 'TEST_LONG_NAME_WITH_UNDERSCORE_2'])
columns = df.columns
list_of_trend = []
for i in columns:
data = df[['week', i]]
data = data.rename(columns={"week": "x", i: "y"})
trend = pn.indicators.Trend(title=i, data=data, width=200, height=200, plot_type='area', margin=(25, 50))
list_of_trend.append(trend)
pn.Row(list_of_trend[0], list_of_trend[1], list_of_trend[2]) |
Thanks @tlmille2! |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When your labels are a long number of character's, with underscores, the Trend Indicator doesn't wrap the labels. The long label names will then 'misbehave' their css properties. Padding the Trend Indicator is a temporary fix, but it would be nice if a trend indicator can support wrapping of labels.
The text was updated successfully, but these errors were encountered: