|
Linear Meter Dynamic Bar Color? |
Posted by Steve Valliere on Mar-28-2018 20:40 |
|
Linear meters support a number of useful color options for the scale, one of my favorites being the gradients. I would love to be able to have an option for the value bar's color to match the scale color at the current value. This would cause the value bar to slowly change color as the value increased (or decreased) when using a gradient. When using discrete color zones, the value bar would clearly show (by color) which zone contained the current value, making it easier to see from a distance whether an alarm condition exists.
As usual, I'm sure that I can find a way to manually set the bar color. For discrete color zones, this would not be too difficult to add to my own app. However, matching the gradient selected by ChartDirector seems more problematic. I can imagine cumbersome ways that might work in an customer program, but it seems that ChartDirector has all the necessary data at hand and could do this internally, if there was a color option to match the scale zone color.
Is this possible now? If not, might it be in the future? |
Re: Linear Meter Dynamic Bar Color? |
Posted by Steve Valliere on Mar-28-2018 22:13 |
|
Sorry, I meant BAR METERS rather than Linear. |
Re: Linear Meter Dynamic Bar Color? |
Posted by Peter Kwan on Mar-29-2018 23:48 |
|
Hi Steve,
I have tried to use a ColorAxis to obtain the color given the data value, and it appears to work.
I am not sure which programming language you are using, so I just use C++ as an example:
// Create a dummy chart with a dummy contour layer, so we can get the color axis
XYChart temp(1, 1);
ColorAxis *cAxis = temp.addContourLayer(DoubleArray(), DoubleArray(), DoubleArray())->colorAxis();
// Set the color scale to the color axis and obtain the barColor using the data value
cAxis->setColorScale(DoubleArray(smoothColorScale, smoothColorScaleArraySize));
int barColor = cAxis->getColor(value);
// Now add the bar using the barColor
m->addBar(0, value, barColor, Chart::glassEffect(Chart::NormalGlare, Chart::Top), 4);
Hope this can help.
Regards
Peter Kwan |
|