Variable Colours for Reports in gINT Part 1
[Editor] Disclosure: gINT Software is a Premier Sponsor of GeoPrac. [/Editor]
This article is a “How To” for a feature that is soon to be released for gINT Software. It is NOT available at the moment to the general public, so please, don’t bother contacting gINT Software asking where these features are. I have asked Salvatore Caronna (President of gINT Software) if it was OK for me to write this, so long as I let people know that this is a “future feature” and was told “Publish and be damned”. You have been warned.
This “How To” is in 2 parts. I shall be using 2 examples to demonstrate the ability to change the colour of something using data held in the database to determine how the colour is changed. The first example I shall use shall be the reasonably simple example of a Dynamic Probe Log, the second shall be a more complex Site Map report showing relative levels of a contaminant that is asked for at output time. There are of course many other uses that these principals can be applied to. I work with a data template structure that follows the AGS file structure very closely. For those of you not familiar with the AGS transfer format see here http://www.ags.org.uk/site/datatransfer/intro.cfm Obviously you can adapt the methods here to your own database structure.
Where I give details of colour values I will be using the standard format of RGB. For those who may not know, RGB stands for Red Green Blue, the main way 24bit colours are created by a PC. The values for the R, G & B components range from 0 to 255 for each.
RGB of R:0 G:0 B:0 is black
and R:255 G:255 B:255 is white
And to get a nice solid red R:255 G:0 B:0
To get different shades of red, for example, you would keep the R component the same and move the G and B components the same amount each. See below:
The Dynamic Probe Log
Below is an close up of our Dynamic Probe Log. It hasn’t changed much over the last 10 years and has served us well. Upon the Beta release of the functions I shall be detailing, it was the first (and most obvious) use I came up with.
As you can see, a bit of colour (around the bars) but a bit boring. What I shall be detailing is the ability to change the colour of the fill of the bars depending on the number of the blows for each increment, as in the example below:
As you can see, this looks a lot nicer (and flashier) but it also gives a much “stronger” visual impact for the higher blow counts. It really makes them jump out at you.
About The Dynamic Probe Log Report
The report is a Log report with a “Bar Chart Versus Depth” entity running down the middle of the log, with the blow counts shown to the left of each bar. The blow counts are stepped for 2 reasons; 1, they make it easier to read and 2, if they were stacked in a vertical column, I would have to reduce the text size to a ridiculously small setting to stop the bottom of one result from almost merging with the top of the result below, as we use a vertical scale for the log of 10m per page (that’s 100 blows to report on a page)
The main properties for the “Bar Chart Versus Depth” entity for the old “Grey” style log can be seen below, along with the Data Representation tab for the entity.
As you can see, nothing complicated at all in the Main tab, and the Data Representation tab simply tells gINT to fill the bars with a solid Light Grey fill and surround them in a Solid red line (for those interested the “Quantum Geo” colour is a custom colour created in the Colours section of SYMBOL DESIGN. R: 223 G: 63 B: 81) The Background Fill tab isn’t used at all. About as basic as it gets. As you can see from the Data Representation tab shot above, the fill colour is not variable, it can only be chosen from a dropdown list of colours, meaning you can only specify an overall colour for the bars in general. Notice that there is a Section Colour Expression in the Background Fill tab. This is what we shall be using to change the colour of each bar using the NEW (and at time of publishing, BETA function only) function of <<RGBColor(RED,GREEN,BLUE)>>. This is a function to make it a lot easier to specify colours “on the fly” eg. Not already in your colour dropdown list. The ability to do this has always been present in gINT. If you look at your colour list in SYMBOL DESIGN – Colours, you will see that the 1st column is “Colour” and that it contains a number. This is gINTs colour value and is arrived at by using the formula (Red + (Green * 256) + (Blue * (256 * 256))). Take the colour Meade 50% for example. Its gINT colour number is 10787342 and it is made up of R:14 G:154 B:164. Running this through the above formula gives (14+(154*256)+(164*(256 * 256))) which comes out at 14+39424+10747904 = 10787342. This is a rather long winded way of doing things and gets rather complicated if you need to specify a colour that is affected by data held in a project. To specify the Meade 50% colour (if you didn’t already have it in you colours dropdown) with the new function all you would need to do is to use <<RGBColor(14,154,164)>>. A lot clearer and easier to use.
Back to the coloured bars… As I stated above, we shall be using the Background Fill tab to change the colour of the individual bars in relation to their related Blow Count reading. This means removing the fill from the Data Representation tab of the entity.
The rest of the work is done in the Background Fill tab,
and mainly in the Section Colour Expression field. First, set your Fill Type(!Symbol) to solid to tell gINT to give the bar a solid fill (You can use this with Solid, Hatches, Tiles, Matl, Samp, Well and Gnrl fill types but NOT with the Bmp fill type), set your Override Fill Colour to “None” and then its into the Section Colour Expression. The expression is quite simple in itself
<<Let(blows = <<Calc(255 - (<<DPRB.DPRB_BLOW>> * 5.1))>>)>>_ <<RGBColor(255,<<Get(blows)>>,<<Get(blows)>>)>>
I have used the LET & GET functions as it makes the whole thing easier to work with. (If you haven’t used the LET & GET functions before have a rummage through gINTs most excellent Help File for details)
I chose to use shades of red for the bar fills, going from virtually white for very low readings through to solid red for the maximum readings You can use any colour you choose, just change the <<RGBColor(255,<<Get(blows)>>,<<Get(blows)>>)>> part of the function accordingly. What the function is saying in plain(ish) English is Let the variable called “blows” = 255 – (the blow count multiplied by 5.1), so if your blow count for that particular bar is 27 the “blows” = 255 – (27 * 5.1) eg. 255 – 137.7 = 117.3.
Two things to explain about the above, the * 5.1 part is derived from the fact that the maximum for any Dynamic Probe blow count is 50. The maximum colour value you can use is 255. 255 / 50 = 5.1 If you are using this method for another test adjust values accordingly. Secondly, the reason for the “255 –” part of the <<Let(blows = <<Calc(255 – (<<DPRB.DPRB_BLOW>> * 5.1))>>)>> is this. Solid red is R:255 G:0 B:0 Solid white is R:255 G:255 B:255. For a very light colour red (virtually white) for very low value blows you have to have your G and B values working BACKWARDS from 255 down, the same amount each, so for a light pink you would want values around R:255 G:200 B:200, this means that you have to SUBTRACT your “blows” * 5.1 from 255. The higher your blow count the larger the “blows” * 5.1 result is and therefore the lower the G and B components are, resulting in a stronger red, until you get to your maximum blow count of 50 * 5.1 = 255, resulting in a solid red values of R:255 G:0 B:0 The G and B values both = 255 – 255 = 0
A point to note:- The components must be between 0 and 255. Passed in values are converted to integers. If less than 0, 0 is used, if greater than 255, 255 is used. If any component is missing or non-numeric, 0 is used.
If you wanted to use shades of blue for your bars, you would just alter the function from <<RGBColor(255,<<Get(blows)>>,<<Get(blows)>>)>> to <<RGBColor(<<Get(blows)>>,<<Get(blows)>>, 255)>>. If you were using this for a test where the maximum obtainable result was 100, instead of 50, you would use <<Let(blows = <<Calc(255 – (<<DPRB.DPRB_BLOW>> * 2.55))>>)>> (255 maximum colour value divided by 100 maximum result value)
That’s about it really. I do hope that at least some of this has made sense. If you have any questions or want clarification about anything then leave a comment below or drop me a line to and I’ll do my best to help. Thanks for reading and look out for the second part of this “How To” coming soon to a monitor near you. To see the full logs in PDF format click here for the old log and here to view the new log in glorious Technicolour.
About the Author
My name is Miles Davis and I work for a company called Quantum Geotechnical Ltd (http://www.quantum-gb.co.uk/geotechnical/) in South Wales, UK. I have been a gINT user since version 3, back in the good old DOS days and have been a Beta Tester for the software since half way through version 4. In my spare time I run a gINT consultancy / development service under the name of gINTDev ( http://www.gintdev.co.uk/home.htm).