Jump to content

Gradiant from an array of value

Recommended Posts



I'am looking since a few time, without any success, a function which return me a gradient (Tcolor) from an array of double (or integer) value.


For example :


 REVENUE_ARRAY: array [1 .. 5] of integer= (10,15,30,45,60);


Result with a gradient from Yellow to red :

10 => Yellow


30 => Orange


60 => Red


My purpose is to fill a MAP ShapeFile items (Devexpress MAP) with a gradient which correspond to a Revenue array ( REVENUE_ARRAY)

Share this post

Link to post

So since you can't find one, just write your own. It shouldn't be terribly difficult. You could probably even calculate the RGB value based on the number given.

Share this post

Link to post

FMX has a TGradient non-visual class, I’ve used it in the past. Might be worth looking at, though I notice your referring to TColor  rather than TAlphaColor so it might not be applicable.

Share this post

Link to post
Posted (edited)

Yes it's not so complicated. But find an already done (and tested) function is often less time lost.


Some component has this kind of function but not always easy to find/extract.


Finally a colleague, which has code a lot on assembler on Atari 68000/68030 (Doom version) , took a nasty pleasure to code this function with a lot of SHR and boolean operator 😉. So it will not take a lot of time to execute even on  CPU with 8 Mhz clock speed 😉




Edited by FabDev

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now