plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
17.13k stars 1.87k forks source link

table: Interpret fill and text color attribute arrays as periodic #2130

Open jackparmer opened 7 years ago

jackparmer commented 7 years ago

Alternating row colors doesn't translate very naturally to the workspace. It would be nice to have these shortcuts that override the other fill color attributes. It would also simplify table development in R and Python, as you wouldn't have to make an array of alternating colors every time.

image

alexcjohnson commented 7 years ago

Can we just allow these style attributes (fill and text colors) to be interpreted as periodic? So if you want even-odd you give length-2 arrays, but then if you want some other period you can do that too. Granted it would be awkward in the workspace if we want these to sometimes not be treated as data arrays but instead get set in the style panel, but I'm sure we can sort that out. Seem nicer than adding a bunch of new special-purpose attributes that restrict you to pure even-odd.

jackparmer commented 7 years ago

Good idea! Sounds good to me! I changed the issue title.

On Oct 30, 2017, at 12:08 AM, alexcjohnson notifications@github.com wrote:

Can we just allow these style attributes (fill and text colors) to be interpreted as periodic? So if you want even-odd you give length-2 arrays, but then if you want some other period you can do that too. Granted it would be awkward in the workspace if we want these to sometimes not be treated as data arrays but instead get set in the style panel, but I'm sure we can sort that out. Seem nicer than adding a bunch of new special-purpose attributes that restrict you to pure even-odd.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

jackparmer commented 7 years ago

Title changed from: "evenrowcolor and oddrowcolor shortcuts for table" To: "table: Interpret fill and text color attribute arrays as periodic"

alexcjohnson commented 7 years ago

cc @monfera - should be an easy one, perhaps combined with #2133 when you get a chance.

monfera commented 7 years ago

Periodic interpretation would be quite straightforward, will do!

etpinard commented 7 years ago

Looks like something might be off in the current implementation:

https://community.plot.ly/t/possible-bug-with-table-cell-font-colors/6867/4

marcstern14 commented 1 year ago

Has this been worked on at all? I'm getting a similar issue with font color using python.

alexcjohnson commented 1 year ago

@marcstern14 it has not - but we'd gladly accept a PR to add this. Should be pretty simple, just a matter of finding a few key places to add % whateverArray.length.