示例#1
0
        public UIColor ColorForSliceAtIndex(XYDonutChart pieChart, int index)
        {
            string hex;

            if (DonutProjectList [index].Color == ProjectModel.GroupedProjectColorIndex)
            {
                hex = ProjectModel.GroupedProjectColor;
            }
            else
            {
                hex = ProjectModel.HexColors [DonutProjectList [index].Color % ProjectModel.HexColors.Length];
            }
            return(UIColor.Clear.FromHex(hex));
        }
示例#2
0
        public DonutChartView ()
        {
            TableProjectList = new List<ReportProject> ();
            DonutProjectList = new List<ReportProject> ();

            grayCircle = new UIView ();
            grayCircle.Layer.AddSublayer (new CAShapeLayer () { FillColor = Color.DonutInactiveGray.CGColor});
            Add (grayCircle);

            donutChart = new XYDonutChart () {
                PieRadius = pieRadius,
                DonutLineStroke = lineStroke,
                DataSource = this,
                UserInteractionEnabled = true,
                SelectedSliceStroke = 0,
                ShowPercentage = false,
                StartPieAngle = (nfloat)Math.PI * 3/2,
                ShowLabel = false,
                AnimationSpeed = 1.0f,
                SelectedSliceOffsetRadius = 15f
            };
            Add (donutChart);

            donutChart.DidSelectSliceAtIndex += (sender, e) => {
                NormalSelectionMode = true;
                var selectedProject = DonutProjectList [e.Index];
                var idx = TableProjectList.FindIndex (p => AreEquals ( p, selectedProject));
                projectTableView.SelectRow (NSIndexPath.FromRowSection (idx, 0), true, UITableViewScrollPosition.Top);
                ((ProjectListSource)projectTableView.Source).LastSelectedIndex = idx;
                SetProjectInfo (selectedProject);
            };
            donutChart.DidDeselectSliceAtIndex += (sender, e) => {
                var selectedProject = DonutProjectList [e.Index];
                var idx = TableProjectList.FindIndex (p => AreEquals ( p, selectedProject));
                projectTableView.DeselectRow (NSIndexPath.FromRowSection (idx, 0), true);
            };
            donutChart.DidDeselectAllSlices += (sender, e) => DeselectAllProjects ();

            projectTableView = new UITableView ();
            projectTableView.RegisterClassForCellReuse (typeof (ProjectReportCell), ProjectReportCell.ProjectReportCellId);
            projectTableView.Source = new ProjectListSource (this);
            projectTableView.RowHeight = 40f;
            projectTableView.TableFooterView = new UIView ();
            var insets = projectTableView.ScrollIndicatorInsets;
            insets.Right -= 3.0f;
            projectTableView.ScrollIndicatorInsets = insets;
            Add (projectTableView);

            totalTimeLabel = new UILabel ();
            totalTimeLabel.Apply (Style.ReportsView.DonutTimeLabel);
            Add (totalTimeLabel);

            moneyLabel = new UILabel ();
            moneyLabel.Apply (Style.ReportsView.DonutMoneyLabel);
            Add (moneyLabel);

            noProjectTitleLabel = new UILabel ();
            noProjectTitleLabel.Apply (Style.ReportsView.NoProjectTitle);
            noProjectTitleLabel.Text = "ReportsLoadingTitle".Tr ();
            Add (noProjectTitleLabel);

            noProjectTextLabel = new UILabel ();
            noProjectTextLabel.Apply (Style.ReportsView.DonutMoneyLabel);
            noProjectTextLabel.Lines = 2;
            noProjectTextLabel.Text = "ReportsLoadingText".Tr ();
            Add (noProjectTextLabel);

            topBoder = new UIView ();
            bottomBoder = new UIView ();
            Add (topBoder);
            Add (bottomBoder);

            projectTableView.Alpha = 0;
            moneyLabel.Alpha = 0;
            totalTimeLabel.Alpha = 0;
        }
示例#3
0
 public string TextForSliceAtIndex (XYDonutChart pieChart, nint index)
 {
     return String.Empty;
 }
示例#4
0
 public UIColor ColorForSliceAtIndex (XYDonutChart pieChart, nint index)
 {
     string hex;
     if (DonutProjectList [ (int)index].Color == ProjectModel.GroupedProjectColorIndex) {
         hex = ProjectModel.GroupedProjectColor;
     } else {
         hex = ProjectModel.HexColors [DonutProjectList [ (int)index].Color % ProjectModel.HexColors.Length];
     }
     return UIColor.Clear.FromHex (hex);
 }
示例#5
0
 public nfloat ValueForSliceAtIndex (XYDonutChart pieChart, nint index)
 {
     return DonutProjectList [ (int)index].TotalTime;
 }
示例#6
0
 public nint NumberOfSlicesInPieChart (XYDonutChart pieChart)
 {
     return (nint)DonutProjectList.Count;
 }
示例#7
0
 public string TextForSliceAtIndex(XYDonutChart pieChart, int index)
 {
     return(String.Empty);
 }
示例#8
0
 public float ValueForSliceAtIndex(XYDonutChart pieChart, int index)
 {
     return(DonutProjectList [index].TotalTime);
 }
示例#9
0
 public int NumberOfSlicesInPieChart(XYDonutChart pieChart)
 {
     return(DonutProjectList.Count);
 }
示例#10
0
        public DonutChartView()
        {
            TableProjectList = new List <ReportProject> ();
            DonutProjectList = new List <ReportProject> ();

            grayCircle = new UIView();
            grayCircle.Layer.AddSublayer(new CAShapeLayer()
            {
                FillColor = Color.DonutInactiveGray.CGColor
            });
            Add(grayCircle);

            donutChart = new XYDonutChart()
            {
                PieRadius                 = pieRadius,
                DonutLineStroke           = lineStroke,
                DataSource                = this,
                UserInteractionEnabled    = true,
                SelectedSliceStroke       = 0,
                ShowPercentage            = false,
                StartPieAngle             = Math.PI * 3 / 2,
                ShowLabel                 = false,
                AnimationSpeed            = 1.0f,
                SelectedSliceOffsetRadius = 15f
            };
            Add(donutChart);

            donutChart.DidSelectSliceAtIndex += (sender, e) => {
                NormalSelectionMode = true;
                var selectedProject = DonutProjectList [e.Index];
                var idx             = TableProjectList.FindIndex(p => AreEquals(p, selectedProject));
                projectTableView.SelectRow(NSIndexPath.FromRowSection(idx, 0), true, UITableViewScrollPosition.Top);
                ((ProjectListSource)projectTableView.Source).LastSelectedIndex = idx;
                SetProjectInfo(selectedProject);
            };
            donutChart.DidDeselectSliceAtIndex += (sender, e) => {
                var selectedProject = DonutProjectList [e.Index];
                var idx             = TableProjectList.FindIndex(p => AreEquals(p, selectedProject));
                projectTableView.DeselectRow(NSIndexPath.FromRowSection(idx, 0), true);
            };
            donutChart.DidDeselectAllSlices += (sender, e) => DeselectAllProjects();

            projectTableView = new UITableView();
            projectTableView.RegisterClassForCellReuse(typeof(ProjectReportCell), ProjectReportCell.ProjectReportCellId);
            projectTableView.Source          = new ProjectListSource(this);
            projectTableView.RowHeight       = 40f;
            projectTableView.TableFooterView = new UIView();
            var insets = projectTableView.ScrollIndicatorInsets;

            insets.Right -= 3.0f;
            projectTableView.ScrollIndicatorInsets = insets;
            Add(projectTableView);

            totalTimeLabel = new UILabel();
            totalTimeLabel.Apply(Style.ReportsView.DonutTimeLabel);
            Add(totalTimeLabel);

            moneyLabel = new UILabel();
            moneyLabel.Apply(Style.ReportsView.DonutMoneyLabel);
            Add(moneyLabel);

            noProjectTitleLabel = new UILabel();
            noProjectTitleLabel.Apply(Style.ReportsView.NoProjectTitle);
            noProjectTitleLabel.Text = "ReportsLoadingTitle".Tr();
            Add(noProjectTitleLabel);

            noProjectTextLabel = new UILabel();
            noProjectTextLabel.Apply(Style.ReportsView.DonutMoneyLabel);
            noProjectTextLabel.Lines = 2;
            noProjectTextLabel.Text  = "ReportsLoadingText".Tr();
            Add(noProjectTextLabel);

            topBoder    = new UIView();
            bottomBoder = new UIView();
            Add(topBoder);
            Add(bottomBoder);

            projectTableView.Alpha = 0;
            moneyLabel.Alpha       = 0;
            totalTimeLabel.Alpha   = 0;
        }