10-10-2008 10:48 AM
Hi,
I am trying to provide a switch to change intensity scale on a CWGraph3D widget from linear to logarithmic and in the process I am getting a COMException:
"Color map values must be greater than zero when using a logarihmic color map"
Here's the code snippet ( I am using VS 2005 and Measurement Studio 8.1):
private AxCW3DGraphLib.AxCWGraph3D mGraph3D;
//..... lot's of code
void SetLogScale(bool log)
{
mGraph3D.Axes.Item(3).Log = log;
mGraph3D.Plots.Item(1).ColorMapLog = log;
}
The problems are twofold:
1) log ColorMapLog works when set a checkbox in VS designer , so why it does not work in the above code?
2) Moreover I failed to change ColorMapValues in the above routine, for example when I insert the below
if (log)
{
double[] colVals = mGraph3D.Plots.Item(1).ColorMapValues as double[];
for (int i=0; i<colVals.Length; i++)
{
colVals[i]=Math.Pow(10.0,i); // set a silly decade scale
}
}
The ColorMapValues seem to be unchanged after the above code is executed.
Any ideas what I might be doing wrong?
Puzzled
Piotr
10-13-2008 06:25 PM
I found it 🙂
1) Do not use mGraph3D.Plots.Item(1).ColorMapLog (i.e. set it to false)
2) Use mGraph3D.Plots.Item(1).ColorMapAutoScale=false
3) Calculate ColorMapValues yourself
I wish there was a better documentation
Piotr