I really like the way that IGRangeSelector looks but is it possible to capture any events of changing the selection?
It would really be great if I could figure out what part of the chart of selected and provide additional actions beyond just zooming / scrolling functionality
Hello Aleksandr,
I am glad you are enjoying the IGRangeSelector. The IGRangeSelector uses the functionality of the IGChartView so any events would come off that control. Off the IGChartViewDelegate is a -chartViewDidZoom and -chartViewDidScroll delegate method which would be raised when selection thumbs are adjusted or the range area shifted.
What extra functionality are you trying to add to the chart when zooming / scrolling?
We have a column chart that shows performance of an investment by date. We calculate various statistics related to that performance. we would like select a range of dates using selector and recalculate our statistics.
Hey Aleksandr,
Ok so I attached a project that shows how this would work. It uses the two delegate methods mentioned earlier to update the NSLog.
In the IGColumnSeries the X-axis is an IGCategoryXAxis. This type of axis has two helper properties added to it called .visibleMaximumValue and .visibleMinimumValue. These helper properties will let you know which data point indexes are currently being displayed in the viewable area. These values are floats because the data being displayed may be partially displayed. This is easy to see in a column chart as you can have part of the column displayed for a data element.
Attached is a sample showing the code for this.
However I found a bug when putting this together. When using the IGRangeSelector the delegate methods were being suppressed. I wrote this up as issue # 159448 and will have our support staff link this issue your account so you can be notified when the fix become available. So for the time being the sample will raise the delegate methods when using the screen interaction on the chart itself (pinch zooming and swipe scrolling). Sorry for the inconvenience in this matter.
Thank you for reply. Pinching does not really replicate the functionality of the range selector. We are really looking for more of the range selector not scroll functionality.
In any case when I tried the pinching method in your project the min and max values returned were always the same (0 and 400).
The weird part is that the DidScroll and DidZoom events do fire when the ZoomDisplayType is set to None but of course the ZoomContentOffset is alway 0,0 and the min max values stay constant as well.
See attached screenshot of the functionality that we are trying to create. We calculate various statistics over the entire history of the investment but would like to use range selector to calculate over the selected historical time span only.
I actually tried it both ways- with one chart and with two as in the in the example. The results seems to be the same.
There are definitely bugs in this control.
I actually thought that my application of that was obvious given the name of the control - RangeSelector. I am happy to work with two charts but once again the range selector does not seem to work as intended. Looking forward to a fix.
OK now I see what you are doing. Thanks for the images, it helps explain the issue.
If the set up I think you are using is correct, then what you are doing is outside of what the IGRangeSelector is designed to do. The design of the control is to hook up to an external chart and control it's zoom and scrolling. Via it's contentView we allow a view to be placed into the IGRangeSelector to give some more context to what the zooming area is going to be. That would be consistent with the results you are seeing. Because the Chart inside of the IGRangeSelector would never move, only the sliders above it. So I wouldn't expect the min/max values to move or the zoomContentOffset to change.
However it is an interesting use case and I think with a little modification the IGRangeSelector could probably provide the information necessary to figure out the information on the inner chart via a delegate method.