Dear Infragistics Support team,I have been using xamDataChart to present live data, and have 3 questions regarding this since I was unable to find the solution neither in SampleBrowser nor on this Forum. I am receiving data every second and representing it with LineSeries. 600 data points are the maximum to be shown - Starting from 10 minutes into the chart I am deleting the oldest point and showing the new one.1. Is there a way to set the limits for the zooming? Let's say I want 1 second (on X axis) to be the maximum. Or maybe to have 5x, 10x zoom i.e.? The best solution would be to set the limit on both Horizontal and Vertical Zoom.2. I have left the Interval and MinorInterval of the CategoryXAxis to be automatically set (Strokes are set) because the performance is better than when using MinorInterval=1. Although the behavior is very nice at the moment, I would ideally change the density of the labels dynamically - first it could be every point, then every 10th, then every 30th etc. As soon as I zoom in I would show label for every second again.3. Is it possible to make automatically zooming in after the 60seconds? So, I would have a maximum of 600 datapoints but would force a window of 60 datapoints. (the third point is the least important and basically a backup for point 2)Chart Example is shown at the screenshot.Thank you very much in advance,Milan
Hi Milan,
1.) The XamDataChart doesn't restrict the zooming level so you'll have to restrict it yourself. You can do this by handling the WindowRectChanged event and then setting the XamDataChart.WindowRect to the specific size you want. WindowRect is a rectangle that represents the current view of the chart and it's values range from 0 to 1. Since it is a rectangle it has an X and Y value which represent where in the chart the top left of the view should be. Width and Height control the size of the view.
So with this knowledge it's possible to restrict the zoom level to some desired range just by updating the WindowRect with new values.
2.) This is definitely doable. You can use the CategoryXAxis.UnscaleValue method in order to find out what the minimum and maximum visible data points are and then adjust the axis Interval accordingly. For example:
var minimumVisibleIndex = (int)xAxis.UnscaleValue(dataChart.Viewport.X);var maximumVisibleIndex = (int)xAxis.UnscaleValue(dataChart.Viewport.Width);
var distance = maximumVisibleIndex - minimumVisibleIndex;if (distance < 10) // if 10 points are visible xAxis.Interval = 1;else if (distance < 50) // if 50 points are visible xAxis.Interval = 5;
3.) This is another instance where updating the WindowRect could get this working for you. For example, if you had 600 data points and you only wanted 60 visible you would set the WindowRect.Width to 0.1 (60 / 600).
Let me know if you have any questions.
Hi again Rob and Infragistics Team,I have managed to come around the requests I had originally thanks to Rob's previous remarks (but with using WindowRectMinWidth also). Thanks again. However, I still have some opened issues/questions.Is there a special reason why there is only WindowRectMinWidth, and not also a WindowRectMinHeight parameter? The later would fit me perfectly in keeping the Scale Ratio of Window Height/Width, and enable me to fit both of original requests no.1 and no.3 work together. At the moment I am using WindowRectMinWidth to set the maximal zoom depending on the number of values on the chart, while at the same time I am redrawing a Rectangle with the fixed Width in order to show maximally 60 values (OnRefreshCompleted event). The last thing I would need is to be able to fix the WindowRectangle ratio so the zooming of y-axis would continue while the x-axis is blocked. But I guess two of my requests are a bit contradictory?Thank you in advance,Milan
Also,I have now found out this old topic on your forum - http://es.infragistics.com/community/forums/t/55945.aspx, which gives me an even simpler solution to my request no.3. I can just force a rectangle size (and add autoscroll) by using chart.WindowScaleHorizontal.But sadly, this is still in contrast to my will to have both the window rectangle maximum (60 values) and zoom-in maximization in both axes ( WindowRectMinWidth enables me maximizing zoom on x axis)Milan
WindowRectMinWidth should actually be influencing both the width and height already. For example, if I set the WindowRectMinWidth to 0.5 and I try to zoom in it will stop the zoom on both the X and Y axis and the WindowRect.Width and WindowRect.Height will both be clamped to 0.5. Are you not seeing that behavior?
If you want to stop the Height at a different zoom value than the Width then you'll need to manually check if the WindowRect.Height has passed your minimum value and then set it to that value to clamp it.
Hi Rob,Yes, I have noticed that behavior, but I guess that I have more specific need in order to make both things work.Anyways, I have managed to pull it through somehow - with always calculating new WindowRectMinWidth and RectMaxWidth as long as new data arrive. This enabled me to show a maximum 60 (out of 600) values in a fixed window, but to zoom in to a certain minimum and then have this fixed window smaller until zooming out back to the RectMaxWidth.Also, I have added "autoscroll" behavior depending on the position of the horizontal zoombar. I guess you could consider implementing some of this functionalities in the future?All the best,Milan
I will. Thanks
Not sure what the "autoscroll" behavior would entail but if you'd like to see any of this stuff added to the product in the future you can submit them as product ideas here: http://ideas.infragistics.com