Please see the attached picture it say more than my words. I would like to get the X,Y coordinates the points at top and right where a ScatterLineSerie leaves (enters) the viewport. (I am not sure I am using the term viewport correctly). Please note that in the picture that is _one_ line series so it has multiple points to get.
I plan to catch some event (please recommend) when the zoom or the pan are changing then get the actual collection the X, Y coordinates.
I strongly hope this is possible, because this on of the requirement of my project to display labels there. (I do know how to position a UI element if I know the X,Y)
Picture: http://screencast.com/t/09wwYO2k9r
Thanks in advance
Hello Justin,
Thank you for your post. The event that I would recommend handling to achieve this functionality is the ActualWindowRectChanged event of the XamDataChart. In this event handler, I would recommend getting the axes that you are using in the XamDataChart to determine the viewport and it will also help to get the unscaled values of the maximum and minimum x and y values.
You will also need the WindowRect for the following, which you can get using XamDataChart1.WindowRect. To determine the min and max visible x and y values, you will need to use the GetUnscaledValue method on the axes. After you get these values, you will need a collection to hold the visible points on your scatter line series. You can do this by looping through your ItemsSource collection and comparing the min and max visible x and y values to each point in your ItemsSource. If the values are between these visible values, create a Point for it, and add it to a new collection of type Point.
After that, you can find the highest and lowest values in that collection and set them to a point value, which you can display.
I have attached a sample application that demonstrates the above using three scatter line series.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewDeveloper Support Engineer IInfragistics Inc.www.infragistics.com/support
Hi Andrew
Thanks for your work, I tried. Unfortunately I can not use your solution for my case because of 2 reasons:
1) Your algorithm collects the visible points of a scatterlineserie. Please note that the serie line is visible between the serie points also. In my case (in the pic I've attached in my original question), there are no points in the viewable rectangle at all, of course the line is drawn between that points, so we are viewing the line. (not the points)
2) The pic I've attached that is _one_ line just crosses the rectangle more. It is possible for _one_ scatterline to move out and in to the rectangle. Imagine a simple zigzag a bit zoomed in.
Now I would like to get _all_ points coordinates where the drawed line leaves the rectange at a) top b) right.
Thanks in advance.
The line that you see on the ScatterLineSeries is of type Path. To get the point where that Path leaves the viewport on the right side and the top side would have to be done with the points on the graph.
To achieve this, I would recommend looping through the ItemsSource of the series, checking each x and y value as you do so. If that point is inside the viewport and the very next one is outside of it, record those points into separate collections to isolate them. Later, you can check if these points go out through the right side by checking if the outer point’s x value is greater than the maximum visible x value or if they go out through the top side by checking if the outer point’s y value is greater than the maximum visible y value.
From there, since you know the maximum visible y value, you can determine where the line between the inner and outer points meets the edge of the viewport of the XamDataChart, and once you have that point, you can render a label there with that value on it.
Alternatively, if you would like to see an easier functionality for doing this possible implemented in a future service release, consider submitting a new product idea at http://ideas.infragistics.com.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.- Notifications whenever new information regarding your idea becomes available.- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.- Allow you to shape the future of our products by requesting new controls and products altogether.- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).
2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)
3. Add your product idea and be sure to be specific and provide as much detail as possible. Be sure to include a link to this forum thread so that our product management team can view it for reference.
Thanks, sounds a hard work... but anyway