Example #1
0
        private void SetupYAxisFromType(IAxis yAxis, LineChartTypes chartType)
        {
            IAxisFormatter yAxisFormatter = new Formatter.General();

            yAxis.Label = GetYAxisLabel(chartType, Activity);
            switch (chartType)
            {
            case LineChartTypes.Cadence:
            {
                break;
            }

            case LineChartTypes.Elevation:
            {
                if (PluginMain.GetApplication() != null)
                {
                    Length.Units elevationUnit = PluginMain.GetApplication().SystemPreferences.ElevationUnits;

                    if (Activity != null)
                    {
                        elevationUnit = Activity.Category.ElevationUnits;
                    }
                }
                break;
            }

            case LineChartTypes.Grade:
            {
                ((Formatter.General)yAxisFormatter).MinPrecision = 1;
                break;
            }

            case LineChartTypes.HeartRateBPM:
            {
                break;
            }

            case LineChartTypes.HeartRatePercentMax:
            {
                yAxisFormatter = new Formatter.Percent();
                break;
            }

            case LineChartTypes.Power:
            {
                break;
            }

            case LineChartTypes.Speed:
            {
                if (Activity != null && Activity.Category.SpeedUnits == Speed.Units.Pace)
                {
                    yAxisFormatter = new Formatter.SecondsToTime();
                }
                else
                {
                    ((Formatter.General)yAxisFormatter).MinPrecision = 2;
                }

                break;
            }

            default:
            {
                Debug.Assert(false);
                break;
            }
            }
            yAxis.Formatter = yAxisFormatter;
        }
Example #2
0
 public PaceFormatter() : base()
 {
     m_pace = new Formatter.SecondsToTime();
 }