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

Message ListMessage List     Post MessagePost Message

  Method to retrieve layers?
Posted by Mike on Apr-03-2012 23:23
Hi,

I can't seem to find a method to retrieve a lineLayer after I have added it to an XYChart. I would expect something like xyChart.getLineLayers or xyChart.getLayers to exist, but it doesn't seem to be there.

The core of the problem: I only have a XYChart object available and I want to add an InterLineLayer to this by using the first two lines in the LineLayer.

Thanks for helping,

Mike

  Re: Method to retrieve layers?
Posted by Peter Kwan on Apr-04-2012 03:13
Hi Mike,

In the current version of ChartDirector, the addLineLayer API will return the LineLayer added. However, if you discard the returned value, there is no other API that can get retrieve the LineLayer object.

Some programming languages (eg. PHP, Perl, Python, etc), allow you to add arbitrary members to an object. If you are using such a language, you can always store the returned LineLayer object to the XYChart object, so that you can retrieve it later.

For example, in PHP, it is like:

$c->myLineLayer = $c->addLineLayer(.....);

Later, your code can use $c->myLineLayer to retrieve the line layer you have added from the chart object $c.

If your programming language does not allow you to add a member to an object, you may consider to restructure your code, so that you pass both the XYChart and the LineLayer object to your subroutine. In some programming languages, you may be able to subclass YChart to create a class that can save the returned LineLayer object to be retrieved layer.

Finally, in the next version of ChartDirector, there is the getLayer API. Currently, release candidates are always available for the .NET and Java editions of ChartDirector. Please let me know if you are interested.

Regards
Peter Kwan