private void OnIntializeDataSetLine(ILineDataSetXF source, LineDataSet original)
        {
            OnSettingsLineRadarDataSet(source, original);

            if (source.IF_GetMode().HasValue)
            {
                original.SetMode(GetDrawLineMode(source.IF_GetMode().Value));
            }

            if (source.IF_GetCircleColors() != null && source.IF_GetCircleColors().Count > 0)
            {
                original.SetCircleColors(source.IF_GetCircleColors().Select(item => item.ToAndroid().ToArgb()).ToArray());
            }

            if (source.IF_GetCircleHoleColor().HasValue)
            {
                original.CircleHoleColor = source.IF_GetCircleHoleColor().Value.ToAndroid();
            }

            if (source.IF_GetCircleRadius().HasValue)
            {
                original.CircleRadius = source.IF_GetCircleRadius().Value;
            }

            if (source.IF_GetCircleHoleRadius().HasValue)
            {
                original.CircleHoleRadius = source.IF_GetCircleHoleRadius().Value;
            }

            if (source.IF_GetCubicIntensity().HasValue)
            {
                original.CubicIntensity = source.IF_GetCubicIntensity().Value;
            }

            if (source.IF_GetDrawCircles().HasValue)
            {
                original.SetDrawCircles(source.IF_GetDrawCircles().Value);
            }

            if (source.IF_GetDrawCircleHole().HasValue)
            {
                original.SetDrawCircleHole(source.IF_GetDrawCircleHole().Value);
            }
        }
Example #2
0
        /// <summary>
        /// Adds the points to entries and to line data set
        /// </summary>
        private void AddPointsToEntries()
        {
            int    count = 0;
            Random rand  = new Random();

            foreach (KeyValuePair <string, List <DataPoint> > dp in mCurVisData.Points)
            {
                this.mEntries = new List <Entry>();
                mColors       = new List <int>();
                Color col = new Color(rand.NextInt(255), rand.NextInt(255), rand.NextInt(255));


                foreach (DataPoint dp2 in dp.Value)
                {
                    mEntries.Add(new Entry(dp2.X, dp2.Y));
                    if (mCurVisData.AltControlTime.Any(x => x == dp2.X))
                    {
                        mColors.Add(Color.Black);
                    }
                    else
                    {
                        mColors.Add(col);
                    }
                }

                LineDataSet lds = new LineDataSet(mEntries, dp.Key);

                lds.SetColor(col, 255);
                // lds.SetColors(mColors.ToArray());
                lds.SetCircleColors(mColors.ToArray());
                // lds.SetCircleColor(mColorList[count]);
                lds.SetDrawCircleHole(true);
                lds.SetCircleColorHole(col);

                mDataSet.SetValue(lds, count);
                count++;
            }
        }
Example #3
0
        private View CreateAiringScoreProgressionView(
            List <MediaTrend> trends)
        {
            var detailView      = LayoutInflater.Inflate(Resource.Layout.View_AniListObjectDetail, null);
            var detailContainer = detailView.FindViewById <LinearLayout>(Resource.Id.AniListObjectDetail_InnerContainer);

            detailView.FindViewById <TextView>(Resource.Id.AniListObjectDetail_Name).Text = "Airing Score Progression";

            var chartHeight  = Resources.GetDimensionPixelSize(Resource.Dimension.Details_ChartHeight);
            var textColor    = GetThemedColor(Resource.Attribute.Background_Text);
            var legendMargin = Resources.GetDimensionPixelSize(Resource.Dimension.Details_MarginSmall);


            detailContainer.SetPadding(legendMargin, 0, legendMargin, 0);

            var typedColorArray = Resources.ObtainTypedArray(Resource.Array.Chart_Colors);
            var colorList       = new List <int>();

            for (var i = 0; i < typedColorArray.Length(); i++)
            {
                colorList.Add(typedColorArray.GetColor(i, 0));
            }

            var scoresChart = new LineChart(this)
            {
                LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, chartHeight),
            };

            var data = new LineData();

            var scorePoints  = trends.Select(x => new Entry(x.Episode.Value, x.AverageScore ?? 0)).ToList();
            var scoreDataSet = new LineDataSet(scorePoints, "Score")
            {
                Color          = colorList[0],
                ValueFormatter = new ChartUtils.IntegerValueFormatter(),
            };

            scoreDataSet.ValueTextSize = 12;
            scoreDataSet.SetDrawCircleHole(false);
            scoreDataSet.SetCircleColor(colorList[0]);
            scoreDataSet.SetMode(LineDataSet.Mode.Linear);
            scoreDataSet.ValueTextColor = textColor;
            scoreDataSet.SetDrawValues(true);

            data.AddDataSet(scoreDataSet);

            scoresChart.Data = data;
            scoresChart.FitScreen();
            scoresChart.SetTouchEnabled(false);
            scoresChart.Description.Enabled  = false;
            scoresChart.XAxis.Position       = XAxis.XAxisPosition.Bottom;
            scoresChart.XAxis.ValueFormatter = new ChartUtils.AxisValueCeilingFormatter(1);
            scoresChart.XAxis.Granularity    = 1;
            scoresChart.XAxis.AxisMaximum    = trends.Max(x => x.Episode.Value);
            scoresChart.XAxis.AxisMinimum    = trends.Min(x => x.Episode.Value);
            scoresChart.XAxis.SetLabelCount(trends.Count, true);

            scoresChart.AxisLeft.AxisMinimum = 0;
            scoresChart.AxisLeft.AxisMaximum = 100;
            scoresChart.Legend.Enabled       = false;
            scoresChart.SetDrawGridBackground(false);
            scoresChart.XAxis.SetDrawGridLines(false);
            scoresChart.AxisLeft.Enabled  = false;
            scoresChart.AxisRight.Enabled = false;

            scoresChart.ExtraLeftOffset = scoresChart.ExtraRightOffset = 15;
            scoresChart.XAxis.TextColor = scoresChart.AxisLeft.TextColor = scoresChart.Legend.TextColor = textColor;

            detailContainer.AddView(scoresChart);

            return(detailView);
        }
Example #4
0
        private View CreateRecentActivityView(
            List <MediaTrend> trends)
        {
            var detailView      = LayoutInflater.Inflate(Resource.Layout.View_AniListObjectDetail, null);
            var detailContainer = detailView.FindViewById <LinearLayout>(Resource.Id.AniListObjectDetail_InnerContainer);

            detailView.FindViewById <TextView>(Resource.Id.AniListObjectDetail_Name).Text =
                "Recent Activity";

            var chartHeight  = Resources.GetDimensionPixelSize(Resource.Dimension.Details_ChartHeight);
            var textColor    = GetThemedColor(Resource.Attribute.Background_Text);
            var legendMargin = Resources.GetDimensionPixelSize(Resource.Dimension.Details_MarginSmall);

            detailContainer.SetPadding(legendMargin, 0, legendMargin, 0);

            var typedColorArray = Resources.ObtainTypedArray(Resource.Array.Chart_Colors);
            var colorList       = new List <int>();

            for (var i = 0; i < typedColorArray.Length(); i++)
            {
                colorList.Add(typedColorArray.GetColor(i, 0));
            }

            var activityChart = new LineChart(this)
            {
                LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, chartHeight),
            };

            var data = new LineData();

            var activityPoints  = trends.Select(x => new Entry(x.Date, x.Trending)).ToList();
            var activityDataSet = new LineDataSet(activityPoints, "Trending")
            {
                Color          = colorList[0],
                ValueFormatter = new ChartUtils.NumberValueFormatter(),
            };

            var activityRange = trends.Max(x => x.Trending) - trends.Min(x => x.Trending);

            activityDataSet.ValueTextSize = 12;
            activityDataSet.SetDrawCircleHole(false);
            activityDataSet.SetCircleColor(colorList[0]);
            activityDataSet.SetMode(LineDataSet.Mode.Linear);
            activityDataSet.ValueTextColor = textColor;
            activityDataSet.SetDrawValues(true);

            data.AddDataSet(activityDataSet);

            activityChart.Data = data;
            activityChart.FitScreen();
            activityChart.SetTouchEnabled(false);
            activityChart.Description.Enabled      = false;
            activityChart.XAxis.Position           = XAxis.XAxisPosition.Bottom;
            activityChart.XAxis.ValueFormatter     = new ChartUtils.DateValueFormatter("MMM d");
            activityChart.XAxis.LabelRotationAngle = 60;
            activityChart.XAxis.Granularity        = 1;
            activityChart.XAxis.AxisMaximum        = trends.Max(x => x.Date);
            activityChart.XAxis.AxisMinimum        = trends.Min(x => x.Date);
            activityChart.XAxis.SetLabelCount(trends.Count, true);

            activityChart.AxisLeft.AxisMinimum = Math.Max(trends.Min(x => x.Trending) - activityRange / 2, 0);
            activityChart.AxisLeft.AxisMaximum = trends.Max(x => x.Trending) + activityRange / 2;
            activityChart.Legend.Enabled       = false;
            activityChart.SetDrawGridBackground(false);
            activityChart.XAxis.SetDrawGridLines(false);
            activityChart.AxisLeft.Enabled  = false;
            activityChart.AxisRight.Enabled = false;

            activityChart.XAxis.TextColor = activityChart.AxisLeft.TextColor = activityChart.Legend.TextColor = textColor;
            activityChart.ExtraLeftOffset = activityChart.ExtraRightOffset = 15;

            detailContainer.AddView(activityChart);

            return(detailView);
        }