Example #1
0
        /*
         * EXPORT SETTINGS
         */
        public void OnSettingsBaseDataSet <TEntry>(IBaseDataSetXF <TEntry> baseDataSetXF, ChartBaseDataSet originalBaseDataSet) where TEntry : BaseEntry
        {
            /*
             * Properties could not set
             * IF_GetGradientColor
             */
            if (baseDataSetXF.IF_GetColors() != null && baseDataSetXF.IF_GetColors().Count > 0)
            {
                originalBaseDataSet.SetColors(baseDataSetXF.IF_GetColors().Select(obj => obj.ToUIColor()).ToArray(), 1f);
            }
            if (baseDataSetXF.IF_GetValueColors() != null && baseDataSetXF.IF_GetValueColors().Count > 0)
            {
                originalBaseDataSet.ValueColors = (baseDataSetXF.IF_GetValueColors().Select(obj => obj.ToUIColor()).ToArray());
            }
            if (baseDataSetXF.IF_GetHighlightEnabled().HasValue)
            {
                originalBaseDataSet.HighlightEnabled = baseDataSetXF.IF_GetHighlightEnabled().Value;
            }
            if (baseDataSetXF.IF_GetVisible().HasValue)
            {
                originalBaseDataSet.Visible = baseDataSetXF.IF_GetVisible().Value;
            }
            if (baseDataSetXF.IF_GetDrawIcons().HasValue)
            {
                originalBaseDataSet.DrawIconsEnabled = baseDataSetXF.IF_GetDrawIcons().Value ? 1 : 0;
            }
            if (baseDataSetXF.IF_GetDrawValues().HasValue)
            {
                originalBaseDataSet.DrawValuesEnabled = baseDataSetXF.IF_GetDrawValues().Value;
            }
            if (baseDataSetXF.IF_GetValueFormatter() != null)
            {
                originalBaseDataSet.ValueFormatter = new DataSetValueFormatterExport(baseDataSetXF.IF_GetValueFormatter());
            }

            try
            {
                if (string.IsNullOrEmpty(baseDataSetXF.IF_GetValueFontFamily()))
                {
                    if (baseDataSetXF.IF_GetValueTextSize().HasValue)
                    {
                        originalBaseDataSet.ValueFont = UIFont.SystemFontOfSize(baseDataSetXF.IF_GetValueTextSize().Value);
                    }
                }
                else
                {
                    if (baseDataSetXF.IF_GetValueTextSize().HasValue)
                    {
                        originalBaseDataSet.ValueFont = UIFont.FromName(baseDataSetXF.IF_GetValueFontFamily(), baseDataSetXF.IF_GetValueTextSize().Value);
                    }
                    else
                    {
                        originalBaseDataSet.ValueFont = UIFont.FromName(baseDataSetXF.IF_GetValueFontFamily(), originalBaseDataSet.ValueFont.PointSize);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        /*
         * EXPORT SETTINGS
         */
        public void OnSettingsBaseDataSet <TEntry>(IBaseDataSetXF <TEntry> baseDataSetXF, MikePhil.Charting.Data.BaseDataSet originalBaseDataSet) where TEntry : Widget.Charts.Models.BaseEntry
        {
            /*
             * Properties could not set
             * IF_GetGradientColor
             */


            if (baseDataSetXF.IF_GetColors() != null && baseDataSetXF.IF_GetColors().Count > 0)
            {
                originalBaseDataSet.SetColors(baseDataSetXF.IF_GetColors().Select(obj => obj.ToAndroid().ToArgb()).ToArray());
            }
            if (baseDataSetXF.IF_GetValueColors() != null && baseDataSetXF.IF_GetValueColors().Count > 0)
            {
                originalBaseDataSet.SetValueTextColors(baseDataSetXF.IF_GetValueColors().Select(obj => new Java.Lang.Integer(obj.ToAndroid().ToArgb())).ToList());
            }
            if (baseDataSetXF.IF_GetHighlightEnabled().HasValue)
            {
                originalBaseDataSet.HighlightEnabled = baseDataSetXF.IF_GetHighlightEnabled().Value;
            }
            if (baseDataSetXF.IF_GetVisible().HasValue)
            {
                originalBaseDataSet.Visible = baseDataSetXF.IF_GetVisible().Value;
            }
            if (baseDataSetXF.IF_GetDrawIcons().HasValue)
            {
                originalBaseDataSet.SetDrawIcons(baseDataSetXF.IF_GetDrawIcons().Value);
            }
            if (baseDataSetXF.IF_GetDrawValues().HasValue)
            {
                originalBaseDataSet.SetDrawValues(baseDataSetXF.IF_GetDrawValues().Value);
            }
            if (baseDataSetXF.IF_GetValueFormatter() != null)
            {
                originalBaseDataSet.ValueFormatter = new DataSetValueFormatterExport(baseDataSetXF.IF_GetValueFormatter());
            }
            if (baseDataSetXF.IF_GetValueTextSize().HasValue)
            {
                originalBaseDataSet.ValueTextSize = (baseDataSetXF.IF_GetValueTextSize().Value);
            }
            try
            {
                if (!string.IsNullOrEmpty(baseDataSetXF.IF_GetValueFontFamily()))
                {
                    originalBaseDataSet.ValueTypeface = SpecAndroid.CreateTypeface(UltimateXFSettup.Context, baseDataSetXF.IF_GetValueFontFamily());
                }
            }
            catch (Exception ex)
            {
            }
        }