ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Query ColorScale for color of a value
Posted by Dean Davis on Jun-17-2015 03:34
I've added a ColorScale to a LinearMeter chart. Is there a function to call to figure out the
color for a specific value on that scale?

  Re: Query ColorScale for color of a value
Posted by Peter Kwan on Jun-17-2015 15:43
Hi Dean,

Unluckily, there is no API to obtain the color from a data value. The only method is to
compute the color with your own code. As the color scale are provided from your code, it
should have the necessary information to compute the colors from the values. Basically, for
a given value, your code would need to determine which two "color stops" contain the
value, then interpolate the colors. (Each of the RGB components of a color is just a number
from 0 to 255, and so they can be interpolated.)

Regards
Peter Kwan

  Re: Query ColorScale for color of a value
Posted by Dean Davis on Jun-18-2015 02:18
Thanks for the advice.
This is exactly what I did and now on the bar thermometer example my bar's color matches
the scale's color at the set value.