I am trying to implement color scales like in Excel. I found a previous ticket about this issue (https://www.flexmonster.com/question/how-do-i-implement-color-scales-like-excel/) but the example does not appear to be working. Is there an issue in the example or something I am missing. This looks like it would solve by problem.
Hello, Jason,
Thank you for reaching out to us.
We found a minor issue with a condition in the example, which is why the colors stopped applying.
You are welcome to see the updated version of the JSFiddle where the color scales work well: http://jsfiddle.net/flexmonster/om72q9ch/.
Please let us know if everything works for you as well.
Kind regards,
Vera
Thanks for the update. Is there a simple way to specify adding the color scale to only show for a specific column? In the example, how can I set it so it only shows on the Bakery column?
Thanks.
Hello, Jason,
Thank you for your reply.
We are happy to hear that the color scale works.
As for applying the color scale to only a specific column:
Yes, you could define a more detailed condition in the customizeCell
hook to color cells of a specific column.
Here is a JSFiddle example for illustration purposes: https://jsfiddle.net/flexmonster/59vybLgd/.
In the example, we use the data.columns
and data.rows
properties of the CellDataObject to color cells related only to "Bakery"
(see lines 36-56
in the provided JSFiddle).
Also, you are welcome to check out our customizing the grid tutorial for more examples.
Please let us know if this helps.
Kind regards,
Vera
Thanks for the update, that is what I was looking for. I was not sure how to correctly identify the column and your example helped.