Conditional styling a row, based on column valueChanging background cell of table depending on valueWhat is the difference between old style and new style classes in Python?Styling multi-line conditions in 'if' statements?Does Python have a ternary conditional operator?How do I sort a dictionary by value?How to access environment variable values?Renaming columns in pandasDelete column from pandas DataFrameHow to iterate over rows in a DataFrame in Pandas?Select rows from a DataFrame based on values in a column in pandasDeleting DataFrame row in Pandas based on column value
Are there any cons in using rounded corners for bar graphs?
What was the intention with the Commodore 128?
Attacking the Hydra
Scam? Phone call from "Department of Social Security" asking me to call back
Weird resistor with dots around it on the schematic
What is the spellcasting ability of a Barbarian Totem Warrior?
What should we do with manuals from the 80s?
What is the purpose/function of this power inductor in parallel?
When was "Fredo" an insult to Italian-Americans?
Do I need to start off my book by describing the character's "normal world"?
Understanding a part of the proof that sequence that converges to square root of two is decreasing.
Build a mob of suspiciously happy lenny faces ( ͡° ͜ʖ ͡°)
What modifiers are added to the attack and damage rolls of this unique longbow from Waterdeep: Dragon Heist?
Ghost house where the house only appeared once a year for it was the ghost
What is the opposite of "hunger level"?
What if a restaurant suddenly cannot accept credit cards, and the customer has no cash?
What are some tips and tricks for finding the cheapest flight when luggage and other fees are not revealed until far into the booking process?
QgsGeometry.length() giving wrong result?
Doesn't the speed of light limit imply the same electron can be annihilated twice?
Did Michelle Obama have a staff of 23; and Melania have a staff of 4?
Minimum population for language survival
Typesetting "hollow slash"
Why does Japan use the same type of AC power outlet as the US?
How do I ask for 2-3 days per week remote work in a job interview?
Conditional styling a row, based on column value
Changing background cell of table depending on valueWhat is the difference between old style and new style classes in Python?Styling multi-line conditions in 'if' statements?Does Python have a ternary conditional operator?How do I sort a dictionary by value?How to access environment variable values?Renaming columns in pandasDelete column from pandas DataFrameHow to iterate over rows in a DataFrame in Pandas?Select rows from a DataFrame based on values in a column in pandasDeleting DataFrame row in Pandas based on column value
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to style row based on a value of a column, I currently have this code:
import dash
import dash_table
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
app = dash.Dash(__name__)
print(["name": i, "id": i for i in df.columns])
app.layout = dash_table.DataTable(
id='table',
columns=["name": i, "id": i for i in df.columns],
data=df.to_dict("rows"),
style_data_conditional=[
'if':
'column_id': 'Number of Solar Plants',
'filter': '"Number of Solar Plants" > num(100)'
,
'backgroundColor': '#3D9970',
'color': 'white',
],
)
if __name__ == '__main__':
app.run_server(debug=True)
Which produces the following result:
But what I really want is for the rows (tr 1 and 8 in this case) to be styled with a green background, not just the cells.
What can I do to achieve this?
python python-3.x datatables styling plotly-dash
add a comment |
I would like to style row based on a value of a column, I currently have this code:
import dash
import dash_table
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
app = dash.Dash(__name__)
print(["name": i, "id": i for i in df.columns])
app.layout = dash_table.DataTable(
id='table',
columns=["name": i, "id": i for i in df.columns],
data=df.to_dict("rows"),
style_data_conditional=[
'if':
'column_id': 'Number of Solar Plants',
'filter': '"Number of Solar Plants" > num(100)'
,
'backgroundColor': '#3D9970',
'color': 'white',
],
)
if __name__ == '__main__':
app.run_server(debug=True)
Which produces the following result:
But what I really want is for the rows (tr 1 and 8 in this case) to be styled with a green background, not just the cells.
What can I do to achieve this?
python python-3.x datatables styling plotly-dash
If you don't mind putting in a bit of normal javascript, you can probably use a solution similar to what's given in this related question.
– 0 0
Mar 27 at 12:40
add a comment |
I would like to style row based on a value of a column, I currently have this code:
import dash
import dash_table
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
app = dash.Dash(__name__)
print(["name": i, "id": i for i in df.columns])
app.layout = dash_table.DataTable(
id='table',
columns=["name": i, "id": i for i in df.columns],
data=df.to_dict("rows"),
style_data_conditional=[
'if':
'column_id': 'Number of Solar Plants',
'filter': '"Number of Solar Plants" > num(100)'
,
'backgroundColor': '#3D9970',
'color': 'white',
],
)
if __name__ == '__main__':
app.run_server(debug=True)
Which produces the following result:
But what I really want is for the rows (tr 1 and 8 in this case) to be styled with a green background, not just the cells.
What can I do to achieve this?
python python-3.x datatables styling plotly-dash
I would like to style row based on a value of a column, I currently have this code:
import dash
import dash_table
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
app = dash.Dash(__name__)
print(["name": i, "id": i for i in df.columns])
app.layout = dash_table.DataTable(
id='table',
columns=["name": i, "id": i for i in df.columns],
data=df.to_dict("rows"),
style_data_conditional=[
'if':
'column_id': 'Number of Solar Plants',
'filter': '"Number of Solar Plants" > num(100)'
,
'backgroundColor': '#3D9970',
'color': 'white',
],
)
if __name__ == '__main__':
app.run_server(debug=True)
Which produces the following result:
But what I really want is for the rows (tr 1 and 8 in this case) to be styled with a green background, not just the cells.
What can I do to achieve this?
python python-3.x datatables styling plotly-dash
python python-3.x datatables styling plotly-dash
edited Mar 27 at 13:06
Hula Hula
asked Mar 27 at 12:34
Hula HulaHula Hula
2962 silver badges12 bronze badges
2962 silver badges12 bronze badges
If you don't mind putting in a bit of normal javascript, you can probably use a solution similar to what's given in this related question.
– 0 0
Mar 27 at 12:40
add a comment |
If you don't mind putting in a bit of normal javascript, you can probably use a solution similar to what's given in this related question.
– 0 0
Mar 27 at 12:40
If you don't mind putting in a bit of normal javascript, you can probably use a solution similar to what's given in this related question.
– 0 0
Mar 27 at 12:40
If you don't mind putting in a bit of normal javascript, you can probably use a solution similar to what's given in this related question.
– 0 0
Mar 27 at 12:40
add a comment |
1 Answer
1
active
oldest
votes
to fix your issue you just have to remove the column_id
parameter in your style_data_conditional
. So all the row will be colored in green.
You should do this:
style_data_conditional=[
'if':
'filter': '"Number of Solar Plants" > num(100)'
,
'backgroundColor': '#3D9970',
'color': 'white',
]
Wow that was easy... Thanks
– Hula Hula
Mar 27 at 13:35
you are welcome :-)
– Maaz
Mar 27 at 13:37
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377338%2fconditional-styling-a-row-based-on-column-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
to fix your issue you just have to remove the column_id
parameter in your style_data_conditional
. So all the row will be colored in green.
You should do this:
style_data_conditional=[
'if':
'filter': '"Number of Solar Plants" > num(100)'
,
'backgroundColor': '#3D9970',
'color': 'white',
]
Wow that was easy... Thanks
– Hula Hula
Mar 27 at 13:35
you are welcome :-)
– Maaz
Mar 27 at 13:37
add a comment |
to fix your issue you just have to remove the column_id
parameter in your style_data_conditional
. So all the row will be colored in green.
You should do this:
style_data_conditional=[
'if':
'filter': '"Number of Solar Plants" > num(100)'
,
'backgroundColor': '#3D9970',
'color': 'white',
]
Wow that was easy... Thanks
– Hula Hula
Mar 27 at 13:35
you are welcome :-)
– Maaz
Mar 27 at 13:37
add a comment |
to fix your issue you just have to remove the column_id
parameter in your style_data_conditional
. So all the row will be colored in green.
You should do this:
style_data_conditional=[
'if':
'filter': '"Number of Solar Plants" > num(100)'
,
'backgroundColor': '#3D9970',
'color': 'white',
]
to fix your issue you just have to remove the column_id
parameter in your style_data_conditional
. So all the row will be colored in green.
You should do this:
style_data_conditional=[
'if':
'filter': '"Number of Solar Plants" > num(100)'
,
'backgroundColor': '#3D9970',
'color': 'white',
]
answered Mar 27 at 13:13
MaazMaaz
1,3241 gold badge8 silver badges14 bronze badges
1,3241 gold badge8 silver badges14 bronze badges
Wow that was easy... Thanks
– Hula Hula
Mar 27 at 13:35
you are welcome :-)
– Maaz
Mar 27 at 13:37
add a comment |
Wow that was easy... Thanks
– Hula Hula
Mar 27 at 13:35
you are welcome :-)
– Maaz
Mar 27 at 13:37
Wow that was easy... Thanks
– Hula Hula
Mar 27 at 13:35
Wow that was easy... Thanks
– Hula Hula
Mar 27 at 13:35
you are welcome :-)
– Maaz
Mar 27 at 13:37
you are welcome :-)
– Maaz
Mar 27 at 13:37
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377338%2fconditional-styling-a-row-based-on-column-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you don't mind putting in a bit of normal javascript, you can probably use a solution similar to what's given in this related question.
– 0 0
Mar 27 at 12:40