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

Message ListMessage List     Post MessagePost Message

  Multi-Bar Chart
Posted by ilharess on Jan-07-2009 18:08
Hi all,

I was wondering is there a limit for the layers added in the Multi-Bar Chart? I have 15 layers to put in.. But I can only put in up till layer 5.. After that it shows an error

Tried to call "addDataSet(double[], int, java.lang.String)", but cannot convert argument 1 to the desired type.

My code for this is:

layer = c.addBarLayer(cd.side);
layer.addDataSet(data0, "0xff8080", "");
layer.addDataSet(data1, "0x80ff80", "");
layer.addDataSet(data2, "0x8080ff", "");
layer.addDataSet(data3, "0x99CCff", "");
layer.addDataSet(data4, "0x9900ff", "");
layer.addDataSet(data5, "0x0099ff", "");
.
.
.

It somehow stops recognizing addDataSet after 5th layer.. Any idea why?


Regards,
ilharess

  Re: Multi-Bar Chart
Posted by Peter Kwan on Jan-08-2009 02:04
Hi ilharess,

ChartDirector does not have a built-in limit to the number of layers. Thousands of layers are common in ChartDirector applications. The practical limit is the memory available in the system.

The error "cannot convert argument 1 to the desired type" means that the first argument (the data0, data1, data2, in your code) is not an array of numbers. Either it is not an array, or it is an array but contains at least one element which is not a number. (That element can be a text string, or just empty, or contain other things.)

To check if this is the cause of the problem, suppose the code works up to data4, but not for data5. Now if you comment out data0, data1, data2, data3, data4 and using just data5, the code still should not work and produce the same error. This shows that the error is released to the data, not to the number of layers.

To diagnose the problem, you may want to display the elements of the array in the web page. Check to see if some of the elements are non-numbers. Also, check to see if there an empty element at the beginning or the end or in the middle of the array.

(The empty element is hard to see in the output, so when you display an element, please also include brackets to enclose the element. In this way, if you see a pair of bracket enclosing nothing, you know there is an empty element.)

Hope this can help.

Regards
Peter Kwan

  Re: Multi-Bar Chart
Posted by ilharess on Jan-08-2009 11:40
Hi Peter,

Thanks for the reply.. The data is in array.. But some of it is null.. So that was what created the problem.. Thank you again Peter..

Regards,
ilharess