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

Message ListMessage List     Post MessagePost Message

  layer.getXIndexOf issue
Posted by Niket on Apr-03-2014 19:27
Hi,

   I am facing very strange issue. Actually i have plotted a graph having multiple y - axis
against one x - axis which is time stamp scale. i am plotting graph using file having
information for different parameters. There is also a pause button to pause the chart.

In pause when i move mouse over chart area it shows track line. For displaying trackline i
am using layer.getXIndexOf(xValue) where xValue is time in hh:mm:ss:fff which is converted
in ticks internally by chart director.

The problem is when i fix the track line somewhere in chart and perform zoom on chart it
display the vertical line but not the value for parameter on the track line. i tried to debug it,
i found that layer.getXIndexOf(xValue) sometimes return -1 as it was not able to find
timestamp in ak double array which is a member of Layer class having time in ticks .

why is this happening only sometime. even for same timestamp it able to find the index but
sometime it did not find index and return -1 as value.

Thanks in advance.

Regards
Niket

  Re: layer.getXIndexOf issue
Posted by Peter Kwan on Apr-04-2014 03:23
Hi Niket,

Without the exact code, it is hard to trouble-shoot the issue. My guess is that for some
reason, the xValue does not match exactly with any of the timestamps in your chart. There
should be an exact match if the xValue is obtain from the same chart object that handles
the layer.getXIndexOf(xValue). For example, the xValue can be obtained from
layer.getNearestXValue using the same chart object.

If the xValue is obtained from a different chart (eg. the previous chart), it may not match
exactly with the chart being plot. For example, for web applications, ChartDirector may not
send the full data to the browser. It only sends sufficient information to ensure you can
obtain the xValue for every mouse cursor position. It means if the plot area contains 600
horizontal pixels and you have 3500 timestamps, ChartDirector may only send 600
timestamps, one for each pixel, to the browser. So on the browser side, each chart object
may contain a different subset of the timestamps, and a timestamp obtained from a
previous chart may not exist on the current chart for the purpose of processing track
cursor.

If the above is the cause of the problem, you may add a "tolerance" parameter to
getXIndexOf to see if it helps. It is like "layer.getXIndexOf(xValue, 20)". With the code,
ChartDirector will find the nearest value within 20 units from xValue.

Regards
Peter Kwan

  Re: layer.getXIndexOf issue
Posted by Niket on Apr-08-2014 02:20
Attachments:
Hi Peter,

   I have changed the sample code of zoom with track line , i am sending you a rar file having one source code, one snapshot where you can see that only track line appeared without dataset value, one exe but i am not attaching the netchartdir_cp.dll as it is too big for the post.  Please go through the code, just run the exe for get to know what is happening, just select cursor radio button and move mouse in the middle of chart plot area and press click of mouse button , so that cursor will freeze there, now select zoomIn radio button and try to zoom by drawing rectangle in which your cursor shoud come. by trying once or twice i am sure you will able to see the scenario.
One thing i observed that for less x value it is working fine but for more value say 10000 it is working but not in the way that it should be .
Please let me know where am i wrong. Thanks in advance.



Regards
Niket
TrackLineTest.rar
TrackLineTest.rar

64.33 Kb

  Re: layer.getXIndexOf issue
Posted by Peter Kwan on Apr-09-2014 01:19
Hi Niket,

Sorry for this problem. The problem is due to a known issue in ChartDirector.

The problem is as described in my previous message - that the getXIndexOf for a chart
object is accurate only if the xValue is obtained from the same chart object. The reason is
because the internal tables in ChartDirector is only accurate enough to handle mouse
interactions, which are always using integer pixel coordinates. If the xValue is obtained
through mouse interactions (eg. using getNearestXValue) from a chart object, it is always
usable in that chart object. If the xValue is obtained from other means, the getXIndexOf
may not be accurate enough to find an exact match.

Whereas the above is reasonable for web applications, we think it is an unnecessarily
restriction for desktop applications. We had issued a patch that can address the above
issues:

http://www.advsofteng.com/netchartdir511p1.zip

Please kindly try the above updated netchartdir.dll / netchartdir_cp.dll to see if this can
solve the problem.

Regards
Peter Kwan