Add cell formatting at run-time - slickgrid

I'm following the formatting example shown here:
http://6pac.github.io/SlickGrid/examples/example2-formatters.html
As per the example, the statusFormatter can return addClasses, removeClasses, text and tooltip. However, in my case, the user defines the conditions, and the formatting. For example, through a settings page, the user could specify:
The condition (i.e. ">3"),
The formatting associated with the condition (i.e. blue background with white text)
Hence, I don't have the ability to create the css file at design time. I have the conditions working. So then my colorFormatter returns
returnValue = `<div style="${css}">${value}</div>`
this then creates a cell, which looks like this (with a white border around it)
Ideally, I would like to pass in the dynamically generated css style back to the grid cell, so the white border doesn't show between the cell border and the formatting which I would like in the cell.

Related

Adding Text to Objects During Zooming

I am evaluating fabricjs and wondering if you can dynamically add text to shapes while you are zooming. So for example while zoomed out, the shapes are too small to show the text but as you zoom and they get to a certain size, the text can be shown. Or is this part of the base control? In other words if I add text to an object but it cannot be shown because it is too small it automatically hides?

Best container to display copiable non-editable text without a border in Javafx

I am looking for a GUI control element to store a multiline text. TextArea textArea works fine, but it has a border and doesn't fit textArea to text size unless some broilierplate code is added to compute int rowCount to set textArea.setPrefRowCount(rowCount).
Other options like Label don't support copiable text.
What is the most suitable way to display selectable, non-editable text without a scrollbar/empty rows?

How to add patterns or stripes to SSRS data cells instead of a color

IN SSRS:
I can only add Solid color fills to the data cells inside a matrix.
How do I add Stripes or Patterns as background fill instead of a solid color.
Is there a particular color code like '#xxxx' for stripes?
There are certain rows in my report that need to have stripes or patterns as backgrou fill.
Thanks
I have found some methods around this:
1- You can use image gradients to fill text boxes by right-clicking the cell and selecting text box properties. You can use the Fill tab to select a small image or item that has a gradient or pattern and apply it within your cell(s)/report.
2 - Another approach is to use a combination of Font/Color/Bold/Italic/Underline and Boarder colors/weight to achieve your desired result.
3 - Apply a gradient-style scheme to your report by using one or more colors and dynamically changing the hue as you go up or down the report. That way, the top could be darker than the bottom, or vis-versa.
I hope this helps.
Numerous fonts can be used.
Open the Character Map
Select Arial in the Font drop down
Scroll to near the bottom, select the cross character
Hit the Select button a number of times, grab as many characters as the SSRS textbox may require to fill its width
Click copy
In SSRS select the textbox then Ctrl-P to paste
Experiment with font size and font color to get the desired effect
Setting padding to zero may help
Setting row CanGrow to False may help
I find there is a little gap between cells vertically but it is close to perfect for me. There is likely to be a character in Arial or another font that works even better.

Powerpoint - want to define a color palette that is NOT a color scheme

I import Spotfire graphics into Powerpoint quite frequently. Spotfire has its own specific color palette, which aren't the standard colors used in powerpoint, at least I don't think so.
I often must create my own legend or for other reasons match the spotfire color palette, and I do this by entering the RGB codes for the spotfire colors. I would like to do this one time and have the spotfire color palette always available in powerpoint without having to re-type.
I do not think I want to use a color theme, because I want my colors to stay consistent if I end up using different templates (themes). That is, I don't want to call spotfire default blue "Accent 1", because if I change background templates (themes) I think it will overwrite Accent 1 with the new template's Accent 1.
So I want a color palette that is always available to me regardless of what theme I choose.
Any thoughts?
You're dismissing themes for all the right reasons. They wouldn't work for what you're after. You'd pretty much need to buy or write an add-in to do what you want.
For example, it might install n buttons on the toolbar/ribbon, where n = the number of colors you need on your palette. When the button is clicked it sets the fill, for example, of the currently selected shape/shapes to the appropriate color.
You could have different sets of buttons for fill, outline etc, or have the code figure out whether the user has pressed, eg the CTRL key. Click = set the fill, CTRL+Click = set the outline.
Because I was curious I decided to attempt to create a simple Add-In that will allow you to select a chart, series in the chart, and then apply colors.
You can download from Google Docs (revised link)
https://docs.google.com/file/d/0B1v0s8ldwHRYMFFPZ29FNmI0TkE/edit?usp=sharing
The file is saved as a PPTM to expose the code modules. Save As a PPAM and load the Add-in; it will be available from the Add-Ins command bar. I have tested briefly and seems to be working.
Here's the nuts & bolts of it:
First declared several custom colors as Public Const variables. These can be modified using the long value (converted from RGB) to suit whatever you need.
The macro requires that the selection be a Shape, and further that the Shape .HasChart = True. There is some logic to trap these conditions.
A user form has a ComboBox that populates with a list of Series from the selected chart, and 8 CommandButtons colored for each of the defined colors, will send that color to the chosen series.
You could add additional CommandButtons and colors as needed, or tweak the existing code to suit your specific needs.
Although the slide templates have a default color theme attached to them, you can switch slide templates and still use any XML color scheme at your disposal.

Alternating the background color of rows or text boxes

I have data coming from data base in crystal report by SAP with VS2010 SQLServer, displayed in text boxes since Crystal doesn't have data grids.
How can there I alternate the background colors of those text boxes?
Create a custom formula; call it 'Colorize':
//Color every other row as light tan (alter RGB to suit tastes)
Function (Numbervar row, Optional Numbervar Color := RGB(239,235,220))
If Remainder(row,2)=0 Then
Color
Else
crNoColor
Add the following to the Detail section's Background Color conditional-formatting formula:
Colorize(RecordNumber)
//or over-ride color
Colorize(RecordNumber, crSilver)
You can also use it with group header section by passing the GroupNumber keyword:
Colorize(GroupNumber)
If you are doing anything fancy w/ grouping, you may want to use a running-total formula:
//{#G1}
WhilePrintingRecords;
Numbervar i;
i:=1+1;
Add this formula to group-header section, then suppress it.
Change the grouper-header's conditional formula to:
WhilePrintingRecords;
Numbervar i;
Colorize(i);
There are two ways that I do this. The first is the easiest but least robust. In the details section, you can just add a background color formatting formula like this: if recordnumber mod 2 = 0 then crgray else crnocolor
The second is if you need more control over your formatting, say if you're not displaying the details section at all and just group footers/headers. It just involves keeping track of a single boolean variable. In the section that you want to flip-flop, add this to your background color formatting formula: whileprintingrecords;
booleanvar fliprow;
fliprow := not fliprow;
if fliprow then crgray else crnocolor
To achieve this for text boxes. You are going to create a custom formula, I created "Toggle"
WhilePrintingRecords;
Global booleanVar g_bGreyRow := Not(g_bGreyRow);
Then insert a text box and add the Toggle formula field. Then you will want to select the text box and format the text. Select the border tab and check the background box and in the custom formula editor add
Global booleanVar g_bGreyRow;
If g_bGreyRow
Then color(231, 231, 231)
Else crNoColor
Now your text box will toggle the background color on and off. There is one small issue though and that is you will see the text True or False. I fixed this by first selecting Edit Text... then select the text and right click for text formatting. I set the color of the text to white and the size to 1, then I changed the format of the Toggle text from true and false to T and F, this makes it basically non-visible. Also make sure to move your text box to the back. I use this method when I do not want or need the entire sections background to be changed and just a portion.

Resources