Beispiel #1
0
        private void RefreshTree()
        {
            List <GearStats> rowData = new List <GearStats>();

            if (gearSelection.Count > 0)
            {
                string equipmentId             = Options.Instance.GetGearEquipmentId(activity);
                List <SprocketCombo> sprockets = Options.Instance.GetSprocketCombos(equipmentId);

                foreach (SprocketCombo combo in sprockets)
                {
                    INumericTimeDataSeries guessGears = new NumericTimeDataSeries(GearUtils.GuessGears(gearSelection, sprockets));
                    guessGears = GearUtils.RemovePausedTimesInTrack(guessGears, activity);
                    GearStats item = new GearStats(guessGears, combo.GearRatio, activity);
                    rowData.Add(item);
                }

                // Add 'Total' Line
                rowData.Add(new GearStats(rowData));
            }

            treeListStats.Columns.Clear();
            foreach (TreeList.Column column in GetTreeColumns())
            {
                treeListStats.Columns.Add(column);
            }

            treeListStats.RowDataRenderer = new MyRowDataRenderer(treeListStats);
            treeListStats.RowData         = rowData;
        }
Beispiel #2
0
        public void RefreshPage()
        {
            // Clear Chart
            ChartBase chart = detailPaneChart.Chart;

            detailPaneChart.ChartDataClear();
            gearSelection = new NumericTimeDataSeries();

            if (activity != null)
            {
                // Get Gear Track (raw data)
                gearSelection = GearUtils.GetRawGearTrack(activity);
                if (chartType == ChartBasis.Gear_Time)
                {
                    gearSelection = GearUtils.RemovePausedTimesInTrack(gearSelection, activity);
                }

                if (gearSelection.Count != 0)
                {
                    // Smooth data series
                    float min, max;
                    gearSelection = ZoneFiveSoftware.Common.Data.Algorithm.NumericTimeDataSeries.Smooth(gearSelection, Constants.GearTrackSmoothing, out max, out min);
                    //gearSelection = ZoneFiveSoftware.Common.Data.Algorithm.NumericTimeDataSeries.Smooth(gearSelection, 10, out max, out min);

                    //*********************************************
                    // Initialize variables for activity grade impact, and full category impact
                    ChartDataSeries rawGears = new ChartDataSeries(chart, chart.YAxis);

                    // ChartDataSeries
                    rawGears           = PopulateDataSeries(gearSelection, rawGears, ChartType, activity);
                    rawGears.ChartType = ChartDataSeries.Type.Line;
                    rawGears.LineColor = Color.Red;
                    rawGears.ValueAxis = chart.YAxis;

                    if (Options.Instance.ShowRawGearData)
                    {
                        detailPaneChart.ChartDataAdd(rawGears);
                    }

                    // Guess gears
                    string equipmentId = Options.Instance.GetGearEquipmentId(activity);
                    List <SprocketCombo>   gearRatios  = Options.Instance.GetSprocketCombos(equipmentId);
                    INumericTimeDataSeries gearGuess   = GearUtils.GuessGears(gearSelection, gearRatios);
                    ChartDataSeries        guessSeries = new ChartDataSeries(chart, chart.YAxis);

                    if (Options.Instance.ShowEstGearData)
                    {
                        detailPaneChart.ChartDataAdd(guessSeries);
                    }

                    // ChartDataSeries
                    guessSeries            = PopulateDataSeries(gearGuess, guessSeries, ChartType, activity);
                    guessSeries.ChartType  = ChartDataSeries.Type.Line;
                    guessSeries.LineColor  = Color.Blue;
                    guessSeries.ValueAxis  = chart.YAxis;
                    chart.YAxis.LabelColor = rawGears.LineColor;

                    //ExportDataSeriesToCSV(guessSeries);
                    //ExportDataSeriesToCSV(rawGears);

                    if (Options.Instance.GearChartType == ChartBasis.Gear_Time)
                    {
                        chart.XAxis.Formatter = new Formatter.SecondsToTime();
                        chart.XAxis.Label     = CommonResources.Text.LabelTime;
                    }
                    else
                    {
                        chart.XAxis.Formatter = new Formatter.General();
                        chart.XAxis.Label     = CommonResources.Text.LabelDistance + " (" + activity.Category.DistanceUnits + ")";
                    }

                    Options.Instance.ShowZonesInChart = false;
                    chart.YAxis.Label = "m/Rev (ratio)";  // TODO: Localize this string
                }
            }

            chart.AutozoomToData(true);
            chart.Focus();

            // Update Tree
            RefreshTree();
        }