private void InitChart()
        {
            var area = new ChartArea();
            area.AxisX.Title = "Time";
            area.AxisX.TitleFont = new Font(area.AxisX.TitleFont, FontStyle.Bold);
            area.AxisX.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle;

            area.AxisY.Title = "Value";
            area.AxisY.TitleFont = new Font(area.AxisY.TitleFont, FontStyle.Bold);
            area.AxisY.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle;

            _chart = new Chart
            {
                ChartAreas = { area },
                Dock = DockStyle.Fill,
            };
        }
        public TcpSyntheticCounters()
        {
            InitializeComponent();

            ChartArea area = new ChartArea();
            area.AxisX.Title = "Minutes since start";
            area.AxisX.TitleFont = new System.Drawing.Font(area.AxisX.TitleFont, FontStyle.Bold);
            area.AxisX.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle;

            area.AxisY.Title = "Bytes per second";
            area.AxisY.TitleFont = new System.Drawing.Font(area.AxisY.TitleFont, FontStyle.Bold);
            area.AxisY.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.Triangle;

            _received = new Column { Points = { }, LegendText = "Received" };
            _send = new Column { Points = { }, LegendText = "Send" };
            _chart = new Chart
            {
                ChartAreas = { area },
                Dock = DockStyle.Fill, 
            };
            this.Controls.Add(_chart);
        }
Exemple #3
0
        public static Chart Bar()
        {
            var column1 = new Column
            {
                Points = { 6, 9, 5, 7.5, 5.6999998092651367, 3.2000000476837158, 8.5, 7.5, 6.5 }
            };

            var column2 = new Column { 6, 9, 2, 7, 3, 5, 8, 2, 6 };
            var column3 = new Column { Points = { 4, 5, 2, 6, 1, 2, 3, 1, 5 } };

            var area = new ChartArea
            { Series = { column1, column2, column3 }
            , AxisX = { IsMarginVisible = true }
            , Area3DStyle = { Enable3D = true, Rotation = 30, Inclination = 10, IsRightAngleAxes = false }
            };
            return new Chart { ChartAreas = { area }, Dock = DockStyle.Fill };
        }
Exemple #4
0
        public static Chart FuelEconomy()
        {
            #region
            Func<Car, double> Displacement = car => car.Displacement;
            Func<Car, int> Highway = car => car.Highway;
            Func<Car, int> Cylinders = car => car.Cylinders;
            #endregion

            var cars = Car.ParseFromFile();

            var data = from car in cars.GroupBy(Displacement).ThenBy(Highway, Cylinders)
                       from hwy in car from cylinder in hwy
                       select new
                       { X = car.Key
                       , Y = new System.Linq.Charting.Point.DataPoint(hwy.Key)
                           { Color = CylindersToColor(cylinder)
                           , MarkerSize = cylinder * 4
                           , ToolTip = string.Format("{0} cyclinders", cylinder)
                           }
                       };

            var series = new System.Linq.Charting.Point
            {
                Points = { data.Select(xy => KeyValuePair.Create(xy.X, xy.Y)) }
            };

            var area = new ChartArea
            { Series = { series }
            , AxisX = { Title = "Displacement" }
            , AxisY = { Title = "Highway mpg" }
            };

            return new Chart { ChartAreas = { area }, Dock = DockStyle.Fill };
        }
Exemple #5
0
        public static Chart Lines3D()
            {
                var series1 = new Spline();
                var series2 = new Spline();
                var series3 = new Spline();

                // imperative
                var random = new Random();
                for (var pointIndex = 0; pointIndex < 10; pointIndex++)
                {
                    series1.Add(random.Next(45, 95));
                    series2.Add(random.Next(5, 75));
                    series3.Add(random.Next(2, 50));
                }

                var area = new System.Linq.Charting.ChartArea
                {
                    Area3DStyle =
                    {
                        Enable3D = true
                    ,
                        Inclination = 38
                    ,
                        Rotation = 9
                    ,
                        Perspective = 10
                    ,
                        PointDepth = 200
                    ,
                        LightStyle = System.Windows.Forms.DataVisualization.Charting.LightStyle.Realistic
                    ,
                        IsRightAngleAxes = false
                    ,
                        WallWidth = 0
                    }
                ,
                    AxisX = { IsMarginVisible = true }
                ,
                    Series = { series1, series2, series3 }
                };

                var chart = new System.Linq.Charting.Chart
                {
                    ChartAreas = { area }
                ,
                    Titles = { new System.Windows.Forms.DataVisualization.Charting.Title{ Text = "Three 3D Lines"
					                          , Font = new Font(FontFamily.GenericSansSerif, 20) 
					                          }
			                        }
                ,
                    Dock = DockStyle.Fill
                };
                return chart;

            }