Exemple #1
0
        static public void SystemVarsFurtherInfo(ActionLanguage.ActionProgramRun vars, HistoryList hl, ISystem s, string prefix)
        {
            System.Globalization.CultureInfo ct = System.Globalization.CultureInfo.InvariantCulture;

            vars[prefix + "VisitCount"]    = hl.GetVisitsCount(s.Name).ToString(ct);
            vars[prefix + "ScanCount"]     = hl.GetScans(s.Name).Count.ToString(ct);
            vars[prefix + "FSDJumpsTotal"] = hl.GetFSDJumps(new TimeSpan(100000, 0, 0, 0)).ToString(ct);
        }
Exemple #2
0
        static public void HistoryEventFurtherInfo(ActionLanguage.ActionProgramRun vars, HistoryList hl, HistoryEntry he, string prefix)
        {
            if (he != null)
            {
                System.Globalization.CultureInfo ct = System.Globalization.CultureInfo.InvariantCulture;

                int fsd = hl.GetFSDJumps(new DateTime(1980, 1, 1), he.EventTimeUTC); // total before
                if (he.IsFSDJump)                                                    // if on an fsd, count this in
                {
                    fsd++;
                }
                vars[prefix + "FSDJump"] = fsd.ToString(ct);
            }
        }
        void StatsTravel(HistoryEntry he, HistoryList hl)
        {
            int[]    intar     = null;
            string[] strarr    = null;
            int      intervals = 0;

            DateTime[] timearr;
            DateTime   endTime;


            if (userControlStatsTimeTravel.TimeMode == UserControlStatsTimeModeEnum.Summary || userControlStatsTimeTravel.TimeMode == UserControlStatsTimeModeEnum.Custom)
            {
                dataGridViewTravel.Rows.Clear();
                dataGridViewTravel.Columns.Clear();
                dataGridViewTravel.Dock    = DockStyle.Fill;
                dataGridViewTravel.Visible = true;


                if (userControlStatsTimeTravel.TimeMode == UserControlStatsTimeModeEnum.Summary)
                {
                    intervals = 5;
                    var Col1 = new DataGridViewTextBoxColumn();
                    Col1.HeaderText = "Last";

                    var Col2 = new DataGridViewTextBoxColumn();
                    ColumnValueAlignment(Col2);
                    Col2.HeaderText = "24 hours";

                    var Col3 = new DataGridViewTextBoxColumn();
                    ColumnValueAlignment(Col3);
                    Col3.HeaderText = "week";

                    var Col4 = new DataGridViewTextBoxColumn();
                    ColumnValueAlignment(Col4);
                    Col4.HeaderText = "month";

                    var Col5 = new DataGridViewTextBoxColumn();
                    Col5.HeaderText = "Last dock";
                    ColumnValueAlignment(Col5);

                    var Col6 = new DataGridViewTextBoxColumn();
                    Col6.HeaderText = "all";
                    ColumnValueAlignment(Col6);

                    dataGridViewTravel.Columns.AddRange(new DataGridViewColumn[] { Col1, Col2, Col3, Col4, Col5, Col6 });


                    intar  = new int[intervals];
                    strarr = new string[intervals];


                    timearr = new DateTime[intervals];


                    HistoryEntry lastdocked   = hl.GetLastHistoryEntry(x => x.IsDocked);
                    DateTime     lastdockTime = DateTime.Now;

                    if (lastdocked != null)
                    {
                        lastdockTime = lastdocked.EventTimeLocal;
                    }


                    timearr[0] = DateTime.Now.AddDays(-1);
                    timearr[1] = DateTime.Now.AddDays(-7);
                    timearr[2] = DateTime.Now.AddMonths(-1);
                    timearr[3] = lastdockTime;
                    timearr[4] = new DateTime(2012, 1, 1);

                    endTime = DateTime.Now;
                }
                else  // Custom
                {
                    intervals = 1;
                    var Col1 = new DataGridViewTextBoxColumn();
                    Col1.HeaderText = "";

                    var Col2 = new DataGridViewTextBoxColumn();
                    ColumnValueAlignment(Col2);
                    Col2.HeaderText = userControlStatsTimeTravel.CustomDateTimePickerFrom.Value.ToShortDateString() + " - " + userControlStatsTimeTravel.CustomDateTimePickerTo.Value.ToShortDateString();

                    dataGridViewTravel.Columns.AddRange(new DataGridViewColumn[] { Col1, Col2 });


                    intar  = new int[intervals];
                    strarr = new string[intervals];


                    timearr = new DateTime[intervals];


                    timearr[0] = userControlStatsTimeTravel.CustomDateTimePickerFrom.Value;
                    endTime    = userControlStatsTimeTravel.CustomDateTimePickerTo.Value.AddDays(1);
                }



                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFSDJumps(timearr[ii], endTime).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Jumps", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetTraveledLy(timearr[ii], endTime).ToString("N2", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Traveled Ly", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFSDBoostUsed(timearr[ii], endTime).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Boost used", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetJetConeBoost(timearr[ii], endTime).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Jet Cone Boost", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetTouchDown(timearr[ii], endTime).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Landed", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetHeatWarning(timearr[ii], endTime).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Heat Warning", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetHeatDamage(timearr[ii], endTime).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Heat damage", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFuelScooped(timearr[ii], endTime).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Fuel Scooped", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFuelScoopedTons(timearr[ii], endTime).ToString("N2", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Scooped Tons", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetNrScans(timearr[ii], endTime).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Scans", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetScanValue(timearr[ii], endTime).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Scan value", strarr);
            }
            else
            {
                intervals = 10;
                DateTime[] timeintervals = new DateTime[intervals + 1];
                DateTime   currentday    = DateTime.Today;


                if (userControlStatsTimeTravel.TimeMode == UserControlStatsTimeModeEnum.Day)
                {
                    timeintervals[0] = currentday.AddDays(1);
                    for (int ii = 0; ii < intervals; ii++)
                    {
                        timeintervals[ii + 1] = timeintervals[ii].AddDays(-1);
                    }
                }
                else if (userControlStatsTimeTravel.TimeMode == UserControlStatsTimeModeEnum.Week)
                {
                    DateTime startOfWeek = currentday.AddDays(-1 * (int)(DateTime.Today.DayOfWeek - 1));
                    timeintervals[0] = startOfWeek.AddDays(7);
                    for (int ii = 0; ii < intervals; ii++)
                    {
                        timeintervals[ii + 1] = timeintervals[ii].AddDays(-7);
                    }
                }
                else  // month
                {
                    DateTime startOfMonth = new DateTime(currentday.Year, currentday.Month, 1);
                    timeintervals[0] = startOfMonth.AddMonths(1);
                    for (int ii = 0; ii < intervals; ii++)
                    {
                        timeintervals[ii + 1] = timeintervals[ii].AddMonths(-1);
                    }
                }

                strarr = new string[intervals];

                dataGridViewTravel.Rows.Clear();
                dataGridViewTravel.Columns.Clear();
                dataGridViewTravel.Dock    = DockStyle.Fill;
                dataGridViewTravel.Visible = true;


                var Col1 = new DataGridViewTextBoxColumn();
                Col1.HeaderText = "";

                dataGridViewTravel.Columns.Add(Col1);

                for (int ii = 0; ii < intervals; ii++)
                {
                    var Col2 = new DataGridViewTextBoxColumn();
                    Col2.HeaderText = timeintervals[ii + 1].ToShortDateString();
                    ColumnValueAlignment(Col2);
                    dataGridViewTravel.Columns.Add(Col2);
                }


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFSDJumps(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Jumps", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetTraveledLy(timeintervals[ii + 1], timeintervals[ii]).ToString("N2", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Traveled Ly", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFSDBoostUsed(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Boost used", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetJetConeBoost(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Jet Cone Boost", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetDocked(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Docked", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetTouchDown(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Landed", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetHeatWarning(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Heat Warning", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetHeatDamage(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Heat damage", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFuelScooped(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Fuel Scooped", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFuelScoopedTons(timeintervals[ii + 1], timeintervals[ii]).ToString("N2", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Scooped Tons", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetNrScans(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Scans", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetScanValue(timeintervals[ii + 1], timeintervals[ii]).ToString("N0", System.Globalization.CultureInfo.CurrentCulture);
                }
                StatToDGV(dataGridViewTravel, "Scan value", strarr);
            }
        }
        private void StatsGeneral(HistoryEntry he, HistoryList hl)
        {
            dataGridViewStats.Rows.Clear();

            if (he != null)
            {
                StatToDGV("Visits", hl.GetVisitsCount(he.System.name) + " to system " + he.System.name);
                StatToDGV("Jumps Before System", hl.GetFSDJumpsBeforeUTC(he.EventTimeUTC));
            }

            int totaljumps = hl.GetFSDJumps(new TimeSpan(10000, 0, 0, 0));

            StatToDGV("Total No of jumps: ", totaljumps);
            if (totaljumps > 0)
            {
                StatToDGV("Jump History", "24 Hours: " + hl.GetFSDJumps(new TimeSpan(1, 0, 0, 0)) +
                          ", One Week: " + hl.GetFSDJumps(new TimeSpan(7, 0, 0, 0)) +
                          ", 30 Days: " + hl.GetFSDJumps(new TimeSpan(30, 0, 0, 0)) +
                          ", One Year: " + hl.GetFSDJumps(new TimeSpan(365, 0, 0, 0))
                          );

                HistoryEntry north = hl.GetConditionally(Double.MinValue, (HistoryEntry s, ref double l) =>
                                                         { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.z > l; if (v)
                                                           {
                                                               l = s.System.z;
                                                           }
                                                           return(v); });

                HistoryEntry south = hl.GetConditionally(Double.MaxValue, (HistoryEntry s, ref double l) =>
                                                         { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.z < l; if (v)
                                                           {
                                                               l = s.System.z;
                                                           }
                                                           return(v); });

                HistoryEntry east = hl.GetConditionally(Double.MinValue, (HistoryEntry s, ref double l) =>
                                                        { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.x > l; if (v)
                                                          {
                                                              l = s.System.x;
                                                          }
                                                          return(v); });

                HistoryEntry west = hl.GetConditionally(Double.MaxValue, (HistoryEntry s, ref double l) =>
                                                        { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.x < l; if (v)
                                                          {
                                                              l = s.System.x;
                                                          }
                                                          return(v); });

                HistoryEntry up = hl.GetConditionally(Double.MinValue, (HistoryEntry s, ref double l) =>
                                                      { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.y > l; if (v)
                                                        {
                                                            l = s.System.y;
                                                        }
                                                        return(v); });

                HistoryEntry down = hl.GetConditionally(Double.MaxValue, (HistoryEntry s, ref double l) =>
                                                        { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.y < l; if (v)
                                                          {
                                                              l = s.System.y;
                                                          }
                                                          return(v); });

                StatToDGV("Most North", north.System.name + " @ " + north.System.x.ToString("0.0") + "; " + north.System.y.ToString("0.0") + "; " + north.System.z.ToString("0.0"));
                StatToDGV("Most South", south.System.name + " @ " + south.System.x.ToString("0.0") + "; " + south.System.y.ToString("0.0") + "; " + south.System.z.ToString("0.0"));
                StatToDGV("Most East", east.System.name + " @ " + east.System.x.ToString("0.0") + "; " + east.System.y.ToString("0.0") + "; " + east.System.z.ToString("0.0"));
                StatToDGV("Most West", west.System.name + " @ " + west.System.x.ToString("0.0") + "; " + west.System.y.ToString("0.0") + "; " + west.System.z.ToString("0.0"));
                StatToDGV("Most Highest", up.System.name + " @ " + up.System.x.ToString("0.0") + "; " + up.System.y.ToString("0.0") + "; " + up.System.z.ToString("0.0"));
                StatToDGV("Most Lowest", down.System.name + " @ " + down.System.x.ToString("0.0") + "; " + down.System.y.ToString("0.0") + "; " + down.System.z.ToString("0.0"));


                var groupeddata = from data in hl.OrderByDate
                                  where data.IsFSDJump
                                  group data by data.System.name
                                  into grouped
                                  select new
                {
                    Title = grouped.Key,
                    Count = grouped.Count()
                };

                mostVisited.Visible = true;

                Color GridC = discoveryform.theme.GridCellText;
                Color TextC = discoveryform.theme.VisitedSystemColor;
                mostVisited.Titles.Clear();
                mostVisited.Titles.Add(new Title("Most Visited", Docking.Top, discoveryform.theme.GetFont, TextC));
                mostVisited.Series[0].Points.Clear();

                mostVisited.ChartAreas[0].AxisX.LabelStyle.ForeColor = TextC;
                mostVisited.ChartAreas[0].AxisY.LabelStyle.ForeColor = TextC;
                mostVisited.ChartAreas[0].AxisX.MajorGrid.LineColor  = GridC;
                mostVisited.ChartAreas[0].AxisX.MinorGrid.LineColor  = GridC;
                mostVisited.ChartAreas[0].AxisY.MajorGrid.LineColor  = GridC;
                mostVisited.ChartAreas[0].AxisY.MinorGrid.LineColor  = GridC;
                mostVisited.ChartAreas[0].BorderColor     = GridC;
                mostVisited.ChartAreas[0].BorderDashStyle = ChartDashStyle.Solid;
                mostVisited.ChartAreas[0].BorderWidth     = 2;

                mostVisited.ChartAreas[0].BackColor = Color.Transparent;
                mostVisited.Series[0].Color         = GridC;
                mostVisited.BorderlineColor         = Color.Transparent;

                int i = 0;
                foreach (var data in from a in groupeddata orderby a.Count descending select a)
                {
                    if (data.Count <= 1 || i == 10)
                    {
                        break;
                    }

                    mostVisited.Series[0].Points.Add(new DataPoint(i, data.Count));
                    mostVisited.Series[0].Points[i].AxisLabel      = data.Title;
                    mostVisited.Series[0].Points[i].LabelForeColor = TextC;
                    i++;
                }
            }
            else
            {
                mostVisited.Visible = false;
            }

            SizeControls();
        }
Exemple #5
0
        void StatsTravel(HistoryEntry he, HistoryList hl)
        {
            int[]    intar  = null;
            string[] strarr = null;

            if (userControlStatsTimeTravel.TimeMode == UserControlStatsTimeModeEnum.Summary)
            {
                dataGridViewTravel.Rows.Clear();
                dataGridViewTravel.Columns.Clear();
                dataGridViewTravel.Dock    = DockStyle.Fill;
                dataGridViewTravel.Visible = true;


                var Col1 = new DataGridViewTextBoxColumn();
                Col1.HeaderText = "Last";

                var Col2 = new DataGridViewTextBoxColumn();
                ColumnValueAlignment(Col2);
                Col2.HeaderText = "24 hours";

                var Col3 = new DataGridViewTextBoxColumn();
                ColumnValueAlignment(Col3);
                Col3.HeaderText = "week";

                var Col4 = new DataGridViewTextBoxColumn();
                ColumnValueAlignment(Col4);
                Col4.HeaderText = "month";

                var Col5 = new DataGridViewTextBoxColumn();
                ColumnValueAlignment(Col5);
                Col5.HeaderText = "all";

                dataGridViewTravel.Columns.AddRange(new DataGridViewColumn[] { Col1, Col2, Col3, Col4, Col5 });


                intar  = new int[4];
                strarr = new string[4];


                intar[0] = hl.GetFSDJumps(DateTime.Now.AddDays(-1), DateTime.Now);
                intar[1] = hl.GetFSDJumps(DateTime.Now.AddDays(-7), DateTime.Now);
                intar[2] = hl.GetFSDJumps(DateTime.Now.AddMonths(-1), DateTime.Now);
                intar[3] = hl.GetFSDJumps(new DateTime(2012, 1, 1), DateTime.Now);
                StatToDGV(dataGridViewTravel, "Jumps", intar);

                strarr[0] = hl.GetTraveledLy(DateTime.Now.AddDays(-1), DateTime.Now).ToString("0.00");
                strarr[1] = hl.GetTraveledLy(DateTime.Now.AddDays(-7), DateTime.Now).ToString("0.00");
                strarr[2] = hl.GetTraveledLy(DateTime.Now.AddDays(-30), DateTime.Now).ToString("0.00");
                strarr[3] = hl.GetTraveledLy(new DateTime(2012, 1, 1), DateTime.Now).ToString("0.00");
                StatToDGV(dataGridViewTravel, "Traveled Ly", strarr);

                intar[0] = hl.GetFSDBoostUsed(DateTime.Now.AddDays(-1), DateTime.Now);
                intar[1] = hl.GetFSDBoostUsed(DateTime.Now.AddDays(-7), DateTime.Now);
                intar[2] = hl.GetFSDBoostUsed(DateTime.Now.AddDays(-30), DateTime.Now);
                intar[3] = hl.GetFSDBoostUsed(new DateTime(2012, 1, 1), DateTime.Now);
                StatToDGV(dataGridViewTravel, "Boost used", intar);



                intar[0] = hl.GetJetConeBoost(DateTime.Now.AddDays(-1), DateTime.Now);
                intar[1] = hl.GetJetConeBoost(DateTime.Now.AddDays(-7), DateTime.Now);
                intar[2] = hl.GetJetConeBoost(DateTime.Now.AddDays(-30), DateTime.Now);
                intar[3] = hl.GetJetConeBoost(new DateTime(2012, 1, 1), DateTime.Now);
                StatToDGV(dataGridViewTravel, "Jet Cone Boost", intar);

                intar[0] = hl.GetTouchDown(DateTime.Now.AddDays(-1), DateTime.Now);
                intar[1] = hl.GetTouchDown(DateTime.Now.AddDays(-7), DateTime.Now);
                intar[2] = hl.GetTouchDown(DateTime.Now.AddDays(-30), DateTime.Now);
                intar[3] = hl.GetTouchDown(new DateTime(2012, 1, 1), DateTime.Now);
                StatToDGV(dataGridViewTravel, "Landed", intar);


                intar[0] = hl.GetHeatWarning(DateTime.Now.AddDays(-1), DateTime.Now);
                intar[1] = hl.GetHeatWarning(DateTime.Now.AddDays(-7), DateTime.Now);
                intar[2] = hl.GetHeatWarning(DateTime.Now.AddDays(-30), DateTime.Now);
                intar[3] = hl.GetHeatWarning(new DateTime(2012, 1, 1), DateTime.Now);
                StatToDGV(dataGridViewTravel, "Heat Warning", intar);

                intar[0] = hl.GetHeatDamage(DateTime.Now.AddDays(-1), DateTime.Now);
                intar[1] = hl.GetHeatDamage(DateTime.Now.AddDays(-7), DateTime.Now);
                intar[2] = hl.GetHeatDamage(DateTime.Now.AddDays(-30), DateTime.Now);
                intar[3] = hl.GetHeatDamage(new DateTime(2012, 1, 1), DateTime.Now);
                StatToDGV(dataGridViewTravel, "Heat damage", intar);

                intar[0] = hl.GetFuelScooped(DateTime.Now.AddDays(-1), DateTime.Now);
                intar[1] = hl.GetFuelScooped(DateTime.Now.AddDays(-7), DateTime.Now);
                intar[2] = hl.GetFuelScooped(DateTime.Now.AddDays(-30), DateTime.Now);
                intar[3] = hl.GetFuelScooped(new DateTime(2012, 1, 1), DateTime.Now);
                StatToDGV(dataGridViewTravel, "Fuel Scooped", intar);

                strarr[0] = hl.GetFuelScoopedTons(DateTime.Now.AddDays(-1), DateTime.Now).ToString("0.00");
                strarr[1] = hl.GetFuelScoopedTons(DateTime.Now.AddDays(-7), DateTime.Now).ToString("0.00");
                strarr[2] = hl.GetFuelScoopedTons(DateTime.Now.AddDays(-30), DateTime.Now).ToString("0.00");
                strarr[3] = hl.GetFuelScoopedTons(new DateTime(2012, 1, 1), DateTime.Now).ToString("0.00");
                StatToDGV(dataGridViewTravel, "Scooped Tons", strarr);

                strarr[0] = hl.GetNrScans(DateTime.Now.AddDays(-1), DateTime.Now).ToString("0");
                strarr[1] = hl.GetNrScans(DateTime.Now.AddDays(-7), DateTime.Now).ToString("0");
                strarr[2] = hl.GetNrScans(DateTime.Now.AddDays(-30), DateTime.Now).ToString("0");
                strarr[3] = hl.GetNrScans(new DateTime(2012, 1, 1), DateTime.Now).ToString("0");
                StatToDGV(dataGridViewTravel, "Scans", strarr);

                strarr[0] = hl.GetScanValue(DateTime.Now.AddDays(-1), DateTime.Now).ToString("0");
                strarr[1] = hl.GetScanValue(DateTime.Now.AddDays(-7), DateTime.Now).ToString("0");
                strarr[2] = hl.GetScanValue(DateTime.Now.AddDays(-30), DateTime.Now).ToString("0");
                strarr[3] = hl.GetScanValue(new DateTime(2012, 1, 1), DateTime.Now).ToString("0");
                StatToDGV(dataGridViewTravel, "Scan value", strarr);
            }
            else
            {
                int        intervals     = 10;
                DateTime[] timeintervals = new DateTime[intervals + 1];
                DateTime   currentday    = DateTime.Today;


                if (userControlStatsTimeTravel.TimeMode == UserControlStatsTimeModeEnum.Day)
                {
                    timeintervals[0] = currentday.AddDays(1);
                    for (int ii = 0; ii < intervals; ii++)
                    {
                        timeintervals[ii + 1] = timeintervals[ii].AddDays(-1);
                    }
                }
                else if (userControlStatsTimeTravel.TimeMode == UserControlStatsTimeModeEnum.Week)
                {
                    DateTime startOfWeek = currentday.AddDays(-1 * (int)(DateTime.Today.DayOfWeek - 1));
                    timeintervals[0] = startOfWeek.AddDays(7);
                    for (int ii = 0; ii < intervals; ii++)
                    {
                        timeintervals[ii + 1] = timeintervals[ii].AddDays(-7);
                    }
                }
                else  // month
                {
                    DateTime startOfMonth = new DateTime(currentday.Year, currentday.Month, 1);
                    timeintervals[0] = startOfMonth.AddMonths(1);
                    for (int ii = 0; ii < intervals; ii++)
                    {
                        timeintervals[ii + 1] = timeintervals[ii].AddMonths(-1);
                    }
                }

                strarr = new string[intervals];

                dataGridViewTravel.Rows.Clear();
                dataGridViewTravel.Columns.Clear();
                dataGridViewTravel.Dock    = DockStyle.Fill;
                dataGridViewTravel.Visible = true;


                var Col1 = new DataGridViewTextBoxColumn();
                Col1.HeaderText = "";

                dataGridViewTravel.Columns.Add(Col1);

                for (int ii = 0; ii < intervals; ii++)
                {
                    var Col2 = new DataGridViewTextBoxColumn();
                    Col2.HeaderText = timeintervals[ii + 1].ToShortDateString();
                    ColumnValueAlignment(Col2);
                    dataGridViewTravel.Columns.Add(Col2);
                }


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFSDJumps(timeintervals[ii + 1], timeintervals[ii]).ToString();
                }
                StatToDGV(dataGridViewTravel, "Jumps", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetTraveledLy(timeintervals[ii + 1], timeintervals[ii]).ToString("0.00");
                }
                StatToDGV(dataGridViewTravel, "Traveled Ly", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFSDBoostUsed(timeintervals[ii + 1], timeintervals[ii]).ToString();
                }
                StatToDGV(dataGridViewTravel, "Boost used", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetJetConeBoost(timeintervals[ii + 1], timeintervals[ii]).ToString();
                }
                StatToDGV(dataGridViewTravel, "Jet Cone Boost", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetDocked(timeintervals[ii + 1], timeintervals[ii]).ToString();
                }
                StatToDGV(dataGridViewTravel, "Docked", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetTouchDown(timeintervals[ii + 1], timeintervals[ii]).ToString();
                }
                StatToDGV(dataGridViewTravel, "Landed", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetHeatWarning(timeintervals[ii + 1], timeintervals[ii]).ToString();
                }
                StatToDGV(dataGridViewTravel, "Heat Warning", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetHeatDamage(timeintervals[ii + 1], timeintervals[ii]).ToString();
                }
                StatToDGV(dataGridViewTravel, "Heat damage", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFuelScooped(timeintervals[ii + 1], timeintervals[ii]).ToString();
                }
                StatToDGV(dataGridViewTravel, "Fuel Scooped", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetFuelScoopedTons(timeintervals[ii + 1], timeintervals[ii]).ToString("0.00");
                }
                StatToDGV(dataGridViewTravel, "Scooped Tons", strarr);

                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetNrScans(timeintervals[ii + 1], timeintervals[ii]).ToString("0");
                }
                StatToDGV(dataGridViewTravel, "Scans", strarr);


                for (int ii = 0; ii < intervals; ii++)
                {
                    strarr[ii] = hl.GetScanValue(timeintervals[ii + 1], timeintervals[ii]).ToString("0");
                }
                StatToDGV(dataGridViewTravel, "Scan value", strarr);
            }
        }
        private void Stats(HistoryEntry he, HistoryList hl)
        {
            dataGridViewStats.Rows.Clear();

            if (he != null)
            {
                StatToDGV("Visits", hl.GetVisitsCount(he.System.name, he.System.id_edsm) + " to system " + he.System.name);
                StatToDGV("Jumps Before System", hl.GetFSDJumpsBeforeUTC(he.EventTimeUTC));
            }

            int totaljumps = hl.GetFSDJumps(new TimeSpan(10000, 0, 0, 0));
            StatToDGV("Total No of jumps: ", totaljumps);
            if (totaljumps > 0)
            {
                StatToDGV("Jump History", "24 Hours: " + hl.GetFSDJumps(new TimeSpan(1, 0, 0, 0)) +
                                      ", One Week: " + hl.GetFSDJumps(new TimeSpan(7, 0, 0, 0)) +
                                      ", 30 Days: " + hl.GetFSDJumps(new TimeSpan(30, 0, 0, 0)) +
                                      ", One Year: " + hl.GetFSDJumps(new TimeSpan(365, 0, 0, 0))
                                      );

                HistoryEntry north = hl.GetConditionally(Double.MinValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.z > l; if (v) l = s.System.z; return v; });

                HistoryEntry south = hl.GetConditionally(Double.MaxValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.z < l; if (v) l = s.System.z; return v; });

                HistoryEntry east = hl.GetConditionally(Double.MinValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.x > l; if (v) l = s.System.x; return v; });

                HistoryEntry west = hl.GetConditionally(Double.MaxValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.x < l; if (v) l = s.System.x; return v; });

                HistoryEntry up = hl.GetConditionally(Double.MinValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.y > l; if (v) l = s.System.y; return v; });

                HistoryEntry down = hl.GetConditionally(Double.MaxValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.y < l; if (v) l = s.System.y; return v; });

                StatToDGV("Most North", north.System.name + " @ " + north.System.x.ToString("0.0") + "," + north.System.y.ToString("0.0") + "," + north.System.z.ToString("0.0"));
                StatToDGV("Most South", south.System.name + " @ " + south.System.x.ToString("0.0") + "," + south.System.y.ToString("0.0") + "," + south.System.z.ToString("0.0"));
                StatToDGV("Most East", east.System.name + " @ " + east.System.x.ToString("0.0") + "," + east.System.y.ToString("0.0") + "," + east.System.z.ToString("0.0"));
                StatToDGV("Most West", west.System.name + " @ " + west.System.x.ToString("0.0") + "," + west.System.y.ToString("0.0") + "," + west.System.z.ToString("0.0"));
                StatToDGV("Most Highest", up.System.name + " @ " + up.System.x.ToString("0.0") + "," + up.System.y.ToString("0.0") + "," + up.System.z.ToString("0.0"));
                StatToDGV("Most Lowest", down.System.name + " @ " + down.System.x.ToString("0.0") + "," + down.System.y.ToString("0.0") + "," + down.System.z.ToString("0.0"));

                var groupeddata = from data in hl.OrderByDate
                                  where data.IsFSDJump
                                  group data by data.System.name
                                      into grouped
                                  select new
                                  {
                                      Title = grouped.Key,
                                      Count = grouped.Count()
                                  };

                mostVisited.Visible = true;

                Color GridC = discoveryform.theme.GridCellText;
                Color TextC = discoveryform.theme.VisitedSystemColor;
                mostVisited.Titles.Clear();
                mostVisited.Titles.Add(new Title("Most Visited", Docking.Top, discoveryform.theme.GetFont, TextC));
                mostVisited.Series[0].Points.Clear();

                mostVisited.ChartAreas[0].AxisX.LabelStyle.ForeColor = TextC;
                mostVisited.ChartAreas[0].AxisY.LabelStyle.ForeColor = TextC;
                mostVisited.ChartAreas[0].AxisX.MajorGrid.LineColor = GridC;
                mostVisited.ChartAreas[0].AxisX.MinorGrid.LineColor = GridC;
                mostVisited.ChartAreas[0].AxisY.MajorGrid.LineColor = GridC;
                mostVisited.ChartAreas[0].AxisY.MinorGrid.LineColor = GridC;
                mostVisited.ChartAreas[0].BorderColor = GridC;
                mostVisited.ChartAreas[0].BorderDashStyle = ChartDashStyle.Solid;
                mostVisited.ChartAreas[0].BorderWidth = 2;

                mostVisited.ChartAreas[0].BackColor = Color.Transparent;
                mostVisited.Series[0].Color = GridC;
                mostVisited.BorderlineColor = Color.Transparent;

                int i = 0;
                foreach (var data in from a in groupeddata orderby a.Count descending select a)
                {
                    if (data.Count <= 1 || i == 10)
                        break;

                    mostVisited.Series[0].Points.Add(new DataPoint(i, data.Count));
                    mostVisited.Series[0].Points[i].AxisLabel = data.Title;
                    mostVisited.Series[0].Points[i].LabelForeColor = TextC;
                    i++;
                }
            }
            else
                mostVisited.Visible = false;

            SizeControls();
        }