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

Message ListMessage List     Post MessagePost Message

  Checking addScatterLayer Array
Posted by Thom on Jun-03-2012 06:33
I'm using the following code and I need the ability to check if the array (sub1) is populated but struggling with the correct syntax. What is best way to do this?

c.addScatterLayer(null, new ArrayMath(data0).selectEQZ(new ArrayMath(         pointTypeACR).sub(1).result(), Chart.NoValue).result(), "AC (R) M",
Chart.TriangleSymbol, 13, Chart.Transparent, 0xff0000);

  Re: Checking addScatterLayer Array
Posted by Thom on Jun-04-2012 22:22
Peter,

Any thoughts on this?

Thank you,

Thom

  Re: Checking addScatterLayer Array
Posted by Peter Kwan on Jun-04-2012 23:22
Hi Thom,

I am not sure exactly which array you are referring to, and exactly what is meant by "populated".

There is no array (sub1) in your code. Instead, there seems to be two arrays data0 and pointTypeACR. Also, the two ArrayMath objects are generating additional unnamed arrays in your code, so there is a total of 4 arrays there.

By "populated", I assume you mean the the array contains a valid value (there is at least a value that is not Chart.NoValue). You can check the array easily using an if/then statement. For example:

//assume this is the array you want to check
double[] myArray = new ArrayMath(data0).selectEQZ(new ArrayMath(         pointTypeACR).sub(1).result(), Chart.NoValue).result();

boolean isPopulated = false;
for (int i = 0; i < myArray.length; ++i) {
   if (myArray[i] != Chart.NoValue) {
      isPopulated = true;
      break;
   }
}

Hope this can help.

Regards
Peter Kwan

  Re: Checking addScatterLayer Array
Posted by Thom on Jun-04-2012 23:28
Peter,

As always, thank you.

This is exactly what I needed.

Thom