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

Message ListMessage List     Post MessagePost Message

  Semi-transparent labels on gauges
Posted by Electron Shepherd on Jun-02-2017 22:22
I'm drawing a gauge that has a range, say from 0 - 20. I'm also tracking the maximum value displayed, which I can't predict, and then updating the range on the gauge. For example, if I'm currently using a range of 0 - 20, but the current value is 31, I'll use a range of 0 - 40. I track the maximum over a period, and use the maximum from the period as the basis for the range.

What I really have is a form of auto-scaling gauge. This works well, but when I change the scale, it "jumps", as you would expect. What I tried to do was to progressively add transparency to the values I pass into setMeterColors over a period of a couple of seconds until I had 100% transparency, then change the range, and then progressively change the transparency back to zero. This would give the effect of the old labels "fading out" and then the new labels "fading in", and so not jumping.

However, the transparency of the labels does not change - they simple stay a solid colour. If instead of changing the label colours, I modify the background in the same way, by adding transparency to the colour passed in to addScaleBackground, the background fades out and in as expected, so I think my colour processing logic is OK.

Am I doing something wrong, or does the setMeterColors function not support transparency?

  Re: Semi-transparent labels on gauges
Posted by Peter Kwan on Jun-03-2017 03:03
Hi Electron Shepherd,

Is it possible your code first use setMeterColors, then later calls BaseChart.setLabelStyle?

The BaseChart.setLabelStyle also sets the label color with an optional parameter, and if this parameter is not provided, the default is black. See:

http://www.advsofteng.com/doc/cdcpp.htm#BaseMeter.setLabelStyle.htm

If the above is the case, please either set the label color in BaseChart.setLabelStyle, like:

m->setLabelStyle("ariali.ttf", 16, 0xc0000000);

or you may move the setMeterColors line after setLabelStyle.

Hope this can help.

Regards
Peter Kwan

  Re: Semi-transparent labels on gauges
Posted by Electron Shepherd on Jun-03-2017 03:53
Peter

You are a genius! Many thanks - that has sorted out the problem for me.