Cell colorization in a table in Livecode...
Paul Dupuis
paul at researchware.com
Wed Aug 7 13:47:12 EDT 2024
My second color question of the day.
We current have a analytical view in our app which shows a table of
frequencies. The number of rows and columns are driven by user data and
can becomes a large number (I've heard all the arguments that users
should not ever view tables of hundreds of rows by hundreds of columns
as a person can't digest that much data - and our customer are quite
clear that they want to view such data in this fashion).
We currently use a Datagrid. Each cell has a numerical integer value,
0-n. We want to colorize the cells on a gradient, say from white to
green (as an example) which we'd map the gradient colors with 0 being
white and max(N) being green and color each cell accordingly.
This can be done relatively easily in the Datagrid by a small bit of
custom code that looks at the cell value and sets the background color
of the field (that is the cell) to the appropriate color.
We have been migrating all uses of Datagrids to Polygrids where the
columns are driven by user data since the number of columns could exceed
roughly 300, which at the default column width, bumps up against the
32,767 pixel width limit of the Datagrid. The Polygrid does not have
this width limit, which is why we've been replacing Datagrids with
Polygrids.
Now, our current problem is that there does not appear to be any tricks
to having variable cell background colors in a Polygrid. Row colors: yes
Alternate Row colors: Yes, Highlight color: Yes, possibly even
highlighting different cell via the pgHilitedData property: maybe
(haven't tested yet, but they'd all be 1 color).
I am not really familiar with the PolyList widget (vs PolyGrid). Has
anyone figured out how to do a spreadsheet-like table in either the
PolyGrid or PolyList with individual cell background coloring?
If not, I'll stick with the Datagrid and add a check for the columns x
widths exceeding the 32K px threshold and just warn the researcher we
can't handler that much data (which dings our product vs competition!)
More information about the use-livecode
mailing list