コード例 #1
0
        protected override void InitializeControls()
        {
            flexChart1 = new FlexChart();
            this.Chart = flexChart1;

            _chbPointsLegends = new CheckBoxEx("Display Series Points In Legends")
            {
                Checked = true
            };
            _chbPointsLegends.CheckedChanged += _chbPointsLegends_CheckedChanged;

            _chbLegendGroups = new CheckBoxEx("Display Legend Groups")
            {
                Checked = true
            };
            _chbLegendGroups.CheckedChanged += (s, e) =>
            {
                if (flexChart1.Series[0] == _customSeries)
                {
                    (_customSeries as SeriesWithPointLegendItems).ShowLegendGroups = _chbLegendGroups.Checked;
                    flexChart1.Invalidate();
                }
            };

            _chbLegendCustomIcons = new CheckBoxEx("Display Custom Icons")
            {
                Checked = true
            };
            _chbLegendCustomIcons.CheckedChanged += (s, e) =>
            {
                if (flexChart1.Series[0] == _customSeries)
                {
                    (_customSeries as SeriesWithPointLegendItems).ShowCustomIcons = _chbLegendCustomIcons.Checked;
                    flexChart1.Invalidate();
                }
            };

            _chbLegendNames = new CheckBoxEx("Display Legend Names")
            {
                Checked = true
            };
            _chbLegendNames.CheckedChanged += (s, e) =>
            {
                if (flexChart1.Series[0] == _customSeries)
                {
                    (_customSeries as SeriesWithPointLegendItems).ShowLegendNames = _chbLegendNames.Checked;
                    flexChart1.Invalidate();
                }
            };

            this.pnlControls.Controls.Add(_chbPointsLegends);
            this.pnlControls.Controls.Add(_chbLegendGroups);
            this.pnlControls.Controls.Add(_chbLegendCustomIcons);
            this.pnlControls.Controls.Add(_chbLegendNames);
        }
コード例 #2
0
        protected override void OnStart()
        {
            base.OnStart();

            //var h = new Handler(Looper.MainLooper);
            taskAction = new Action(() => {
                if (mList.Count > SIZE)
                {
                    mList.RemoveAt(0);
                }
                System.Random random = new System.Random();
                int temp             = random.Next(100);
                string time          = DateFormat.Format("mm:ss", new Date()).ToString();

                mList.Add(new ChartPoint(time, temp, temp + 10, temp + 20));

                mChart.ItemsSource = mList;

                // There is a issue on mList collection changed event handling. So we have below 4 lines code to refresh the chart.
                mChart.Series[0].Dispose();
                mChart.Series[1].Dispose();
                mChart.Series[2].Dispose();
                mChart.Invalidate();

                mHandler.PostDelayed(taskAction, 125);
            });

            mHandler.PostDelayed(taskAction, 125);
        }
コード例 #3
0
        private void _flexChart_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            var ms = stopwatch.ElapsedMilliseconds;

            stopwatch.Reset();
            if (ms <= 100)
            {
                if (ContentEditor == null || SelectedAnnotation == null)
                {
                    return;
                }
                //Show Annotation Editor
                if (HitTest(e.GetCurrentPoint(FlexChart).Position) == SelectedAnnotation && SelectedAnnotation.IsEditable())
                {
                    ShowContentEditor(this.SelectedAnnotation, e.GetCurrentPoint((Window.Current.Content as Frame).Content as MainPage).Position);
                }
            }
            else if (ms > 100)
            {
                HideContentEditor();
                _drawing = false;

                var pos = e.GetCurrentPoint(FlexChart).Position;
                SelectedAnnotation = HitTest(pos);

                if (AllowMove && SelectedAnnotation != null && e.GetCurrentPoint((UIElement)sender).Properties.IsLeftButtonPressed)
                {
                    _oldPoint   = pos;
                    _isDragging = true; //Start Dragging
                    Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.SizeAll, 1);
                }
                else
                {
                    var ht = FlexChart.HitTest(e.GetCurrentPoint(FlexChart).Position);
                    if (AllowAdd && e.GetCurrentPoint((UIElement)sender).Properties.IsLeftButtonPressed)
                    {
                        _start = pos;
                        if (NewAnnotationType == typeof(Text))
                        {
                            AddAnnotation(_start, e);
                            FlexChart.Invalidate();
                        }
                    }
                    else
                    {
                        SelectedAnnotation = null;
                        _flexChart.Invalidate();
                    }
                }
            }
            stopwatch.Start();
        }
コード例 #4
0
        protected override void InitializeControls()
        {
            flexChart1 = new FlexChart();
            this.Chart = flexChart1;

            _lLabelsGap  = new LabelEx("DataLabels Gap :");
            _udLabelsGap = new NumericUpDownEx {
                Minimum = 0, Maximum = 15, Increment = 1, Value = 10
            };
            _udLabelsGap.ValueChanged += (s, e) => { flexChart1.Invalidate(); };

            _chblabelBorder = new CheckBoxEx("Label Border");
            _chblabelBorder.CheckedChanged += (s, e) => { this.flexChart1.DataLabel.Border = _chblabelBorder.Checked; };

            this.pnlControls.Controls.Add(_lLabelsGap);
            this.pnlControls.Controls.Add(_udLabelsGap);
            this.pnlControls.Controls.Add(_chblabelBorder);
        }
コード例 #5
0
        private void _flexChart_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse)
            {
                _drawing = false;

                var p = e.GetCurrentPoint((UIElement)sender);
                if (p.Properties.IsLeftButtonPressed)
                {
                    if (AllowAdd)
                    {
                        _start = _end = new Point();
                    }
                    if (_isDragging)
                    {
                        UpdateRectCache(SelectedAnnotation);
                        _isDragging = false;
                        Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1);
                    }
                }
                FlexChart.Invalidate();
            }
        }