Пример #1
0
        private void MChart_ChartTapped(object sender, C1TappedEventArgs e)
        {
            C1Point          point = e.GetPosition(mChart);
            ChartHitTestInfo info  = mChart.HitTest(point);
            // display hitTestInfo for each touch event
            string displayText = string.Empty;

            if (info != null)
            {
                displayText = chartElement + (info.ChartElement == null ? chartElementNone : info.ChartElement.ToString());
                if (info.Item != null)
                {
                    displayText += "\n" + seriesName + info.Series.Name + "\n" + pointIndex + info.PointIndex;
                    ChartPoint data = (ChartPoint)info.Item;

                    displayText += "\nX : " + data.Count;
                    if (info.Series.Name.Equals("sin(x)"))
                    {
                        displayText += " sin(x) : " + data.Sine;
                    }
                    else
                    {
                        displayText += " cos(x) : " + data.Cosine;
                    }
                }
            }
            else
            {
                displayText = "Well, this is not happening..";
            }
            mHitTestInfo.Text = displayText;
        }
Пример #2
0
        private void OnChartTapped(object sender, C1TappedEventArgs e)
        {
            var pt   = e.GetPosition(chart);
            var info = chart.HitTest(pt);

            if (info != null)
            {
                pointIndexLabel.Text = string.Format(NSBundle.MainBundle.LocalizedString("Point Index", "Point Index") + "{0}", info.PointIndex);
                xyValuesLabel.Text   = string.Format(NSBundle.MainBundle.LocalizedString("X Y Values", "X Y Values") + " X: {0}, Y: {1:F2}", info.X, info.Y);

                if (info.Series != null)
                {
                    seriesLabel.Text = string.Format(NSBundle.MainBundle.LocalizedString("SeriesName", "SeriesName") + "{0}", info.Series.Name);
                }
                else
                {
                    seriesLabel.Text = NSBundle.MainBundle.LocalizedString("SeriesName", "SeriesName");
                }
                chartElementLabel.Text = string.Format(NSBundle.MainBundle.LocalizedString("Chart element", " Chart element") + "{0}", info.ChartElement.ToString());
            }
        }
        private void Sunburst_Tapped(object sender, C1TappedEventArgs e)
        {
            CGPoint          p           = e.GetPosition(sunburst);
            ChartHitTestInfo hitTestInfo = this.sunburst.HitTest(p);

            if (hitTestInfo == null || hitTestInfo.Item == null)
            {
                popup.Hidden = true;
                return;
            }

            if (hitTestInfo.Item is IChartModel)
            {
                UIView view = ((IChartModel)hitTestInfo.Item).GetUserView(popup.Frame);
                view.Frame            = new CGRect(0, 0, popup.Frame.Width, popup.Frame.Height);
                popup.BackgroundColor = UIColor.Clear;
                foreach (UIView v in popup)
                {
                    v.RemoveFromSuperview();
                }
                popup.AddSubview(view);
                popup.Hidden = false;
            }
        }
Пример #4
0
 private void OnTapped(object sender, C1TappedEventArgs e)
 {
     _isScrolling = false;
     HandleClick(e.OriginalEventArgs, true);
     Point position = e.GetPosition(null);
     if (!Util.Util.ContainsFocus(_grid) || _grid.ActiveEditor == null || !_grid.HitTestProjectionWorkaround(position).Contains(_grid.ActiveEditor))
     {
         Util.Util.SetFocus(_grid);
     }
 }