Hello,
I have a graph that I setup using the Range Selector example. I want to add a tooltip too it and but I am having issues. It seems that my IGChartViewDelegate is not connected. I have over ridden the ResolveTooltipView but it is never called. Is that the correct function to override, or could it be that I am missing something else?
Here are the relevant code snippets.
partial class RecordGraphViewController : UIViewController { [DllImport (Constants.CoreGraphicsLibrary)] static extern void CGRectDivide (CGRect rect, out CGRect slice, out CGRect remainder, nfloat amount, CGRectEdge edge); public static LoadingOverlay loadingOverlay; CEODataService service; public ItemNS ParentItem { get; set; } public RecordGraphViewController (IntPtr handle) : base (handle) { } public async override void ViewDidLoad () { base.ViewDidLoad ();
...
IGChartView chartView = new IGChartView (); chartRect.Inflate (-5, -35); chartView.Frame = chartRect; chartView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; chartView.ZoomDisplayType = IGChartZoom.IGChartZoomHorizontal; chartView.CrosshairsBackground = new UIColor(0.27f, 0.67f, 0.84f, 1.0f); chartView.CrosshairsThickness = 3; chartView.CrosshairsVisibility = IGCrosshairsVisibility.IGCrosshairsVisibilityVertical; chartView.TooltipPinLocation = IGTooltipPinLocation.IGTooltipPinLocationTop; chartView.Delegate = new ChartViewDelegate(); this.NavigationController.SetNavigationBarHidden (false, false); this.View.Add (chartView);
IGAreaSeries areaSeries = chartView.AddSeries (new Class ("IGAreaSeries"), "areaSeries", source, "xAxis", "yAxis") as IGAreaSeries;
}
public class ChartViewDelegate : Infragistics.IGChartViewDelegate { public override UIView ResolveTooltipView (IGChartView chartView, NSDictionary itemlist) { UIView tooltip = new UIView(new RectangleF(0, 0, 100, 30)); tooltip.BackgroundColor = UIColor.LightGray; if (itemlist.Count > 0) { string seriesKey = itemlist.Keys.GetValue(0).ToString(); double pointValue = ((IGCategoryPoint)itemlist.ValueForKey(new NSString(seriesKey))).Value; UILabel valueLabel = new UILabel(); valueLabel.BackgroundColor = UIColor.Clear; valueLabel.Text = String.Format("${0:0.00}", pointValue); valueLabel.SizeToFit(); valueLabel.Frame = new RectangleF(5, 5, (float)valueLabel.Frame.Size.Width, (float)valueLabel.Frame.Size.Height); tooltip.AddSubview(valueLabel); } return tooltip; } }
Hi Ryan,
I put together a sample that uses the area series with tooltips. Let me know if you have any issues.