コード例 #1
0
        private static void AdjustChart(System.Windows.Forms.DataVisualization.Charting.Chart chart, Serie[] data, System.Windows.Forms.DataVisualization.Charting.SeriesChartType chartType)
        {
            chart.SuspendLayout();

            chart.Series.Clear();

            foreach (var item in chart.ChartAreas)
            {
                item.AxisX.IsStartedFromZero = false;
                item.AxisY.IsStartedFromZero = false;
            }

            foreach (var item in data)
            {
                var ns = chart.Series.Add(item.Name.ToString());
                ns.ChartType = chartType;

                foreach (var point in item.Points)
                {
                  if (point.Y is ENG.NR2003.Types.RaceGap)
                    ns.Points.AddXY(point.X, (point.Y as ENG.NR2003.Types.RaceGap).Time.TotalMiliseconds);
                  else
                    ns.Points.AddXY(point.X, point.Y);
                }
            }

            chart.ResumeLayout();
        }