public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			chart.BindingX = "Name";
			chart.Series.Add(new Series(chart, "Sales, Sales", "Sales"));
			chart.Series.Add(new Series(chart, "Expenses, Expenses", "Expenses"));
			chart.Series.Add(new Series(chart, "Downloads, Downloads", "Downloads"));
			chart.ItemsSource = SalesData.GetSalesDataList();

			chart.ChartType = ChartType.Line;

			MyMarkerView view = new MyMarkerView(chart.LineMarker);
			view.MarkerRender = new MyMarkerRender(view);
			chart.LineMarker.Content = view;
			chart.LineMarker.IsVisible = true;
			chart.LineMarker.Alignment = XuniChartMarkerAlignment.BottomRight;
			chart.LineMarker.Lines = XuniChartMarkerLines.Vertical;
			chart.LineMarker.Interaction = XuniChartMarkerInteraction.Move;
			chart.LineMarker.DragContent = true;
			chart.LineMarker.SeriesIndex = -1;
			chart.LineMarker.VerticalLineColor = UIColor.Gray;
			chart.LineMarker.VerticalPosition = 0;

			chart.AddSubview(view);

		}
예제 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            chart.BindingX = "Name";
            chart.Series.Add(new Series(chart, "Sales, Sales", "Sales"));
            chart.Series.Add(new Series(chart, "Expenses, Expenses", "Expenses"));
            chart.Series.Add(new Series(chart, "Downloads, Downloads", "Downloads"));
            chart.ItemsSource = SalesData.GetSalesDataList();

            chart.ChartType = ChartType.Line;

            MyMarkerView view = new MyMarkerView(chart.LineMarker);

            view.MarkerRender                  = new MyMarkerRender(view);
            chart.LineMarker.Content           = view;
            chart.LineMarker.IsVisible         = true;
            chart.LineMarker.Alignment         = XuniChartMarkerAlignment.BottomRight;
            chart.LineMarker.Lines             = XuniChartMarkerLines.Vertical;
            chart.LineMarker.Interaction       = XuniChartMarkerInteraction.Move;
            chart.LineMarker.DragContent       = true;
            chart.LineMarker.SeriesIndex       = -1;
            chart.LineMarker.VerticalLineColor = UIColor.Gray;
            chart.LineMarker.VerticalPosition  = 0;

            chart.AddSubview(view);
        }
예제 #3
0
            public override void RenderMarker()
            {
                if (_view == null)
                {
                    return;
                }

                MyMarkerView view       = (MyMarkerView)_view;
                var          dataPoints = view.Marker.DataPoints;

                if (dataPoints == null || dataPoints.Length == 0)
                {
                    return;
                }

                view.lblToday.Text = dataPoints[0].ValueX + " \n";

                for (int i = 0; i < dataPoints.Length; i++)
                {
                    switch (dataPoints[i].SeriesName)
                    {
                    case "TSB":
                        txtTSB.Text = String.Format("TSB: {0}", dataPoints[i].Value);
                        break;

                    case "ATL":
                        txtATL.Text = String.Format("ATL: {0}", dataPoints[i].Value);
                        break;

                    case "CTL":
                        txtCTL.Text = String.Format("CTL: {0}", dataPoints[i].Value);
                        break;

                    case "DAYLI LOAD":
                        txtDailyTSS.Text = String.Format("Daily Load: {0}", dataPoints[i].Value);
                        break;

                    case "DAYLI IF":
                        txtDailyIF.Text = String.Format("Daily IF: {0}", dataPoints[i].Value);
                        break;
                    }
                }
            }
예제 #4
0
            public override void RenderMarker()
            {
                if (_view != null)
                {
                    MyMarkerView view       = (MyMarkerView)_view;
                    var          dataPoints = view.Marker.DataPoints;

                    if (dataPoints != null && dataPoints.Length > 0)
                    {
                        string str = "";
                        str += dataPoints[0].ValueX + " \n";

                        for (int i = 0; i < dataPoints.Length - 1; i++)
                        {
                            str += string.Format("{0} {1:C0}", dataPoints[i].SeriesName, dataPoints[i].Value);
                        }

                        str += string.Format("{0} {1:C0}", dataPoints[dataPoints.Length - 1].SeriesName, dataPoints[dataPoints.Length - 1].Value);

                        view.Content.Text  = str;
                        view.Content.Lines = 4;
                    }
                }
            }
예제 #5
0
        void InitPerformanceGraph()
        {
            foreach (var chart in chartContent.Subviews)
            {
                chart.RemoveFromSuperview();
            }
            chartContent.LayoutIfNeeded();

            pData = GetPerformance();

            if (pData == null)
            {
                return;
            }

            mPChart = new FlexChart();

            mPChart.Frame = new CGRect(0, 0, chartContent.Frame.Width, chartContent.Frame.Height);
            chartContent.AddSubview(mPChart);

            mPChart.Palette         = XuniPalettes.Modern;
            mPChart.BackgroundColor = UIColor.Clear;
            mPChart.ChartType       = ChartType.SplineArea;
            mPChart.BindingX        = pData.categoryField;
            mPChart.IsAnimated      = false;
            mPChart.ItemsSource     = pData.GetSalesDataList();
            mPChart.SymbolSize      = 3;

            mPChart.Legend.Position   = Position.None;
            mPChart.Tooltip.IsVisible = false;

            mPChart.AxisX.LabelsVisible  = false;
            mPChart.AxisX.MajorTickWidth = 0;
            mPChart.AxisX.LineWidth      = 0.5f;

            mPChart.AxisY.LabelsVisible    = false;
            mPChart.AxisY.LineColor        = UIColor.Orange.ColorWithAlpha(ALPHA_AXIS);
            mPChart.AxisY.MajorTickWidth   = 0;
            mPChart.AxisY.MajorGridVisible = false;
            mPChart.AxisY.LabelsVisible    = false;
            mPChart.AxisY.LineWidth        = 2;

            for (int i = 0; i < pData.valueAxes.Count; i++)
            {
                var  axis  = pData.valueAxes[i];
                Axis cAxis = new Axis(i % 2 == 0 ? Position.Left : Position.Right, mPChart);
                cAxis.AxisName         = axis.id;
                cAxis.LineColor        = FromHexString(axis.axisColor);
                cAxis.MajorTickWidth   = 0;
                cAxis.MajorGridVisible = false;
                cAxis.LabelsVisible    = false;
                cAxis.AxisLineVisible  = false;

                mPChart.AxesArray.Add(cAxis);
            }

            foreach (var series in pData.graphs)
            {
                Series cSeries = new Series(mPChart, series.valueField, series.title);
                cSeries.AxisYname = series.valueAxis;

                UIColor sColor = FromHexString(series.lineColor);

                switch (series.valueField)
                {
                case "tsb":
                    symTSB.BackgroundColor = sColor;
                    break;

                case "atl":
                    symATL.BackgroundColor = sColor;
                    break;

                case "ctl":
                    symCTL.BackgroundColor = sColor;
                    break;

                case "dayliTss":
                    symDailyLoad.BackgroundColor = sColor;
                    break;

                case "dayliIf":
                    symDailyIF.BackgroundColor = sColor;
                    break;
                }

                if (series.lineAlpha.Equals(0))
                {
                    cSeries.ChartType   = ChartType.Scatter;
                    cSeries.SymbolColor = sColor;
                    cSeries.Color       = sColor;
                }
                else
                {
                    cSeries.BorderWidth = 1;
                    cSeries.BorderColor = sColor;
                    cSeries.Color       = sColor;
                    cSeries.Opacity     = ALPHA_FILL;
                }

                mPChart.Series.Add(cSeries);
            }
            mPChart.ItemsSource = pData.GetSalesDataList();
            if (pData.TodayIndex() != -1)
            {
                var start = new XuniPoint(pData.TodayPosition() * mPChart.AxisX.ActualDataMax, mPChart.AxisY.ActualDataMax);
                var end   = new XuniPoint(pData.TodayPosition() * mPChart.AxisX.ActualDataMax, mPChart.AxisY.ActualDataMin);
                XuniChartLineAnnotation today = new XuniChartLineAnnotation(mPChart)
                {
                    IsVisible   = true,
                    Attachment  = XuniChartAnnotationAttachment.DataCoordinate,
                    Start       = start,
                    End         = end,
                    LineWidth   = 3,
                    TooltipText = "Future planned performance",
                    Color       = UIColor.Black,
                };

                mPChart.Annotations.Add(today);
            }

            var annoFocused = new XuniChartRectangleAnnotation(mPChart)
            {
                IsVisible   = false,
                Position    = XuniChartAnnotationPosition.Center,
                Attachment  = XuniChartAnnotationAttachment.DataCoordinate,
                Width       = 2,
                Height      = mPChart.AxisY.ActualDataMax,
                BorderWidth = 0,
                Text        = DateTime.Now.ToString(),
                TextColor   = UIColor.White,
                Color       = UIColor.White,
            };

            mPChart.Annotations.Add(annoFocused);

            #region custom line marker
            MyMarkerView view = new MyMarkerView(mPChart.LineMarker);
            view.MarkerRender                    = new MyMarkerRender(view, txtTSB, txtATL, txtCTL, txtDailyTSS, txtDailyIF);
            mPChart.LineMarker.Content           = view;
            mPChart.LineMarker.IsVisible         = true;
            mPChart.LineMarker.Alignment         = XuniChartMarkerAlignment.BottomRight;
            mPChart.LineMarker.Lines             = XuniChartMarkerLines.Vertical;
            mPChart.LineMarker.Interaction       = XuniChartMarkerInteraction.Move;
            mPChart.LineMarker.DragContent       = false;
            mPChart.LineMarker.SeriesIndex       = -1;
            mPChart.LineMarker.VerticalLineColor = UIColor.White;
            mPChart.LineMarker.VerticalPosition  = 10;
            mPChart.AddSubview(view);
            #endregion

            mPChart.ZoomMode    = ZoomMode.Disabled;
            mPChart.AxisX.Scale = 1;

            zoomSlider.LowerValueChanged += HanelerGraphZoomChanged;
            zoomSlider.UpperValueChanged += HanelerGraphZoomChanged;
            zoomSlider.LowerValue         = 0;
            zoomSlider.UpperValue         = pData.dataProvider.Count;
            zoomSlider.MinimumValue       = 0;
            zoomSlider.MaximumValue       = pData.dataProvider.Count;
            zoomSlider.MinimumRange       = 1;
        }