RowStyle Dynamically - jspdf

I am working on the jsPDF library in one of my projects, where I have a colors array coming from the database for each row there is a color, so I want to assign that individual color to a respective row, by using "willDrawCell" and assigning doc.setFillColor(COLOR_CODE), by doing so I am only able to assign a single color to all rows, but actually I want to assign each row different color depends upon the array of colors coming from database.

Related

FileMaker Pro TextColor as a calculation for a field in a table

I have a list of colors that we use and I am creating an app where I am storing the RGB values of those colors in 3 fields R, G & B. Then I have another text field in which I used this ██████ Unicode block of text and used a script to SET FIELD and then calculated the TEXT COLOR of this field to display the correct color as per RGB values by using script trigger whenever the RGB values are modified. Everything works well.
Now what I want to do it display all the color names and the correct color in a portal. The problem is all the RGB values are taken from the current record and so my portal shows different color names but the Unicode block of text is always in the same color. Any ideas on how can I correctly incorporate this? I tried Googling and even skimmed through the documentation of FileMaker but could not figure out a workaround.
Thanks!
It is difficult to understand your structure. If you have "a list of colors" then you should have a table of Colors, with fields for R, G, B and a calculation field for displaying the swatch - all in the same table.
A portal to such table will show one row per record - and each row will show the fields from the corresponding record, including the swatch field.
There should be no need to use any scripts or script triggers for this.

Sequential updates to ranges in Google Sheets API via pygsheets

I'm trying to update some cell ranges with defined format, but I'm running into a problem when the ranges overlap. For example, if I have a range of cells A1:C3 and I want to set cells A2:B2 to have a green background color, and then to have them all have bold font style, the result is only the latter - the background color of the previous cells is overwritten by the bold style. If I do it in the reverse order, the cells have green background but no bold font.
I'm using pygsheets library and this is roughly how my calls work:
# wks is a worksheet object from the created spreadsheet
wks.range("A2:B2", "range").apply_format(L_GREEN_BG, fields="userEnteredFormat")
wks.range("A1:C3", "range").apply_format(BOLD, fields="userEnteredFormat")
The BOLD and L_GREEN_BG are cell objects initialized with a dictionary in json-like format specified by Google Sheets API to match these updates.
My question is: is there any way to not overwrite previously made changes? Doing it sequentially like this would be a lot more handy than making more complex updates to singular cells.
if you want other properties to be unchanged, be more specific on the fields. So in your first case set fields='userEnteredFormat\backgroundColor' and in your second request "userEnteredFormat\textFormat"
OK, upon reading the source code of the pygsheets library I think I know why this happens. The apply_format method sends a repeatCell request, which basically copies all of the provided cell's properties and applies them to the all of the cells in provided range. So when I provide a cell (the BOLD/L_GREEN_BG objects, which are just a dummy cell objects with only one property defined) with only bold font style, all of the cells in range get all of it's properties, along with default values. Every other subsequent call works similarly.

How would I alternate row colors whenever a value changes in any column?

I'm trying to get Google Sheets to alternate row colors whenever any cell in the row is different from the cell above it (within a specified range).For instance:
I found a few related solutions (this one for example), but they all base the alternation on only one column's changes; the MATCH function only applies to a one-dimensional range.
Is there any way to accomplish this with multiple columns?
=ARRAYFORMULA(ISODD(MATCH($A2&$B2&$C2&$D2,UNIQUE($A$2:$A&$B$2:$B&$C$2:$C&$D$2:$D),0)))

jspfd- autotable: How to add different colors to cells in same column

I am trying to change the color of specific cells depending on a certain value. More specifically, the cells should either appear red, orange or green. I am able to do so if the table conists of only one row by changing the color of the whole column like this:
columnStyles: {
"columnA": {fillColor: [r,g,b]}
},
Unfortunately, most of the tables I am working with consist of more than one row and thus it is often the case that two cells in the same columns must have different colors.
How can I change the color of one specific cell? In the documentation of the jspdf-autotable plugin I often read about a cell hook, though I don't know how to use this...

Editing labels of series in Google Spreadsheets

I have data listed in columns as below and by highlighting it all including the names and the units and then clicking Insert -> Diagram..., I can easily make the following graph:
The labels are correct LabelA, Labelb, and LabelC in this case.
But if the label names are not in the same column as the data, then I cannot make this graph. In the data structure below where names and data are in different columns, I again highlight all data cells as well as their units and names (by holding down the ctrl button and clicking all the cells with the cursor):
It is clear that the software does not know that it should assign the names as labels. Is there a method to make the graph show the correct labeling as in the first scenario but with the second scenario's data structure?
you could combine the data in another place with formula:
={{A1,C1,E1};{B4:B6,D4:D6,F4:F6}}
and then plot the diagram as usual.

Resources