NUmber formatting to display green and red in Google sheets - google-sheets-formula

I have a custom number formatting where I need to change the numbers from black for postive and red for negative
I have the format as: [$₹][>9999999]##\,##\,##\,##0.00;[$₹][>99999]##\,##\,##0.00;[$₹]##,##0.00;
The formatting is used to displaying lakh and crore number systems. I only need to display the colors.

Like this?
[$₹][green]##,##0.00;[$₹][red]##,##0.00;[$₹]##,##0.00;
Not sure about >999... conditions, you do not mention those.

Related

ZPL - How can we control width of the barcode in zpl

I am working on conversion of pdf in to ZPL. I am using zebra programming language(zpl).
I am trying to control the barcode(any barcode) width using By command.
^By4 is giving lower width and ^By5 is going out of the box.
My use case is I want to achieve narrow bar width in float number(here 4.5). We can not pass float number in By command.
Please let me know if we can achieve this using some other method in ZPL.
You don't mention what barcode format you're using. Some of them, like 2of5, can also accept the ratio parameter for ^BY. The default is ^BY2,3, changing that to ^BY2,2 can make a smaller version:
^XA
^POI
^CFO,20
^BY5,3
^FO100,400
^BJN,100,Y,N
^FD200940^FS
^BY5,2
^FO100,700
^BJN,100,Y,N
^FD200940^FS
^XZ
This generates two barcodes in 2of5, one with the default ratio and one with a smaller ratio. The second one has a tighter barcode that uses less space. Valid values are 2.0-3.0 (although many round off to the same values) so there is some flexibility. Please note, this only works with barcode formats that are not fixed ratio formats.
You can check the manual page for ^BY in the ZPL programmers guide, p123, for the table that shows valid values and which ones round off to the same value (ie, 2.0 and 2.1 give the same results)

Sass color transform calculation

I have two shades of the color blue (#1E95EF -> #1988DD), and need to figure out the color transformation that has happened in order to replicate it across other colors in my palette (red, green etc).
I've used combinations of darken()/lighten() & saturate()/desaturate() to eyeball the transformation, and have gotten it pretty close:
desaturate(darken(#1E95EF, 4.5%), 8%); === #1A88DC
But I need to get it exactly right, so that the small errors that I make with the percentage decimal points are not replicated across all of the colors. How can I figure out exactly what transformation has occurred?
Here is what I've tried:
sassmeister gist
In this snippet, the relevant classes to my example are .ga-primary and .ga-primary-hover
You can measure the differences between colors in different ways, depending on the color model/space you're using. Hex colors use RGB, but the HSL model will be more useful here. It records a color as 3 values: Hue, Saturation and Lightness.
We can use SASS's HSL functions to work out how each value of the color differs, and then selectively apply that difference to other colors:
$start-color: #1E95EF
$end-color: #1988DD
//We won't need the hue-difference in practice
$hue-difference: hue($start-color) - hue($end-color)
//These express the difference as a percentage
$saturation-difference: saturation($start-color) - saturation($end-color)
$lightness-difference: lightness($start-color) - lightness($end-color)
#function color-adjust($base-color)
//Apply the lightness and saturation changes but keep the original Hue
#return hsl(hue($base-color), saturation($base-color) + $saturation-difference, lightness($base-color) + $lightness-difference)
//To find the adjusted color, just pass whatever base color you like to the color-adjust function:
background: color-adjust(red)
Here's a demo with a few colors: http://codepen.io/anon/pen/bqOaZZ
Obviously that code can be compacted a lot - I'm thinking that what you really want is to define your variants as a set of Saturation/Lightness changes, and then apply them to your whole palette (rather than trying to 'reverse-engineer' it from one example pair). If you want help with something to do that, let me know!

How to make a QlikView dashboard with variances?

How can I make a dashboard in QlikView, showing variances for some results?
The final screen should:
Show the results.
Show up-or-down arrow for every result.
I'm pretty sure it is possible, as Google image search (for a keyword 'qlikview') shows such dashboard (I highlighted those arrows with a black rectangle):
To get those arrows you need to create an expression that tells you if the variance is positive or negative.
if(column(1)-column(2)>0,'Positive',
if(column(1)-column(2)<0,'Negative',
'Same'))
Now all we need to do is change the words Positive etc. to arrows. This is done in the expression editor.
Then you can just select one of the built in arrows which will paste some odd looking text but all it's saying is that instead of the word 'Positive' use the picture that is at 'qmem:///buitin/arrow_n_g.png'.
Giving a result like this.

how is the calculation of rgb values done in the dialog "windows color and appearance"

In Windows 7 and Windows XP you can find the "Window Color and Appearance" dialog under "Control Panel\Appearance and Personalization\Personalization".
Changing "Color1" of item "3D-Border" will result in a change of the following entries in the registry key
[HKEY_CURRENT_USER\Control Panel\Colors]
containing the resulting rgb-values:
Group1 (same values):
InactiveTitle, AppWorkspace, ButtonShadow, Graytext
Group2 (same values, different to those of group1):
Scrollbar, ButtonHilight
Does anyone know how these value are being calculated from the given rgb-values of "Color1"?
After searching the web without results and playing around with many values I did not happen to find a plausible way of how to do this.
Does anyone know the rules for this?
Any help would be appreciated.
I uploaded some demo values, systematically dealing with values in the lower parts. Also a text file comparing the affected registry key [HKEY_CURRENT_USER\Control Panel\Colors] after change of Color to Red (255 0 0).
When you set the "3D Border" color to red, it changed the "Button Face" color to red and interpolated this color to generate various lighter and darker shades of red, which were used to set some related color values.
The point is to create a consistent-looking theme with minimal effort. All you need to do is set the "base" color for 3D objects, and all of the other colors are automatically calculated to ensure that objects have the appropriate 3D appearance.
Some of these values, like the highlight and shadow colors used for 3D objects, are not directly configurable from the control panel applet. However, they can be set manually in the registry, and you can call the SetSysColors function to update currently running applications.
Why do you think you need to know the actual algorithm that Windows is using? What problem are you trying to solve? What are you going to use this information to do?
I do not imagine that the exact algorithm is documented anywhere. The code has been part of the OS since at least Windows 95.

d3.js calendar view - colours + custom date

I have a few questions regarding his calendar view of mine
http://bl.ocks.org/mhska/5333055
data ranges from 1 to 4317 so the colours are not very "evenly" distributed. is there any way to improve it? (i mean basically everything below 100 is just one red colour)
is there a way to change the date format when you hover over the field from yyy-mm-dd to dd-mm-yyyy?
how could one change the colour of fields with no data? (generally this means weekends)
at the moment the fileds with no data and with most data (over 1000) are of the same colour.
thanks a bunch.
You can change the date format that is displayed by adapting the line
date = d3.time.format("%Y-%m-%d")
More information on the specifiers can be found in the documentation.
For changing the colour, you need to provide a different function for mapping values to colours. It looks like you're currently mapping your input values to only 40 output colours.
.range(d3.range([40]))
Increasing this number might be a good starting point. Note that you can provide an arbitrary function, in particular you could handle missing values separately in it.

Resources