Beispiel #1
0
        private void ChartLoaded(object sender, RoutedEventArgs e)
        {
            if (chart.Series.Count > 0)
            {
                return;
            }

            chart.BeginUpdate();
            chart.AxisY.MajorGrid = false;

            var scale = new GradientColorScale()
            {
                Min = -30, Max = 30
            };

            scale.Colors = new List <Color> {
                Colors.Blue, Colors.White, Colors.Red
            };

            var hmap = new Heatmap();

            hmap.ItemsSource = new double[, ] {
                { 3.0, 3.1, 5.7, 8.2, 12.5, 15.0, 17.1, 17.1, 14.3, 10.6, 6.6, 4.3 },
                { -9.3, -7.7, -2.2, 5.8, 13.1, 16.6, 18.2, 16.4, 11.0, 5.1, -1.2, -6.1 },
                { -15.1, -12.5, -5.2, 3.1, 10.1, 15.5, 18.3, 15.0, 9.4, 1.4, -5.6, -11.4 },
            };
            hmap.ColorScale = scale;
            chart.Series.Add(hmap);

            chart.AxisX.ItemsSource = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
            chart.AxisY.ItemsSource = new string[] { "Amsterdam", "Moscow", "Perm" };

            chart.EndUpdate();
        }
        protected override void SetupChart()
        {
            this.flexChart1.Header.Content    = "2D Deformation Distribution";
            this.flexChart1.Header.Style.Font = StyleInfo.ChartHeaderFont;
            var data = DataService.Get2DDeformationData();

            var gradientScale = new GradientColorScale
            {
                Min    = 0,
                Max    = 4,
                Colors = new List <Color> {
                    Color.Red, Color.Yellow
                },
                Axis = new C1.Win.Chart.Extended.ColorAxis {
                    Position = Position.Right
                }
            };
            var heatmap = new Heatmap
            {
                ColorScale = gradientScale,
                DataSource = data.Values,
            };

            this.flexChart1.Series.Add(heatmap);
            this.flexChart1.Legend.Position = Position.None;

            this.flexChart1.AxisX.Min       = heatmap.StartX;
            this.flexChart1.AxisX.Max       = data.Values.GetLength(0) + heatmap.StartX;
            this.flexChart1.AxisY.MajorGrid = false;
            this.flexChart1.ToolTip.Content = "{item:0.0}";
        }
Beispiel #3
0
        private void ColorAxis_Load(object sender, EventArgs e)
        {
            var chart = new FlexChart();

            chart.Legend.Position      = Position.None;
            chart.Dock                 = DockStyle.Fill;
            chart.AxisY.Title          = "y";
            chart.AxisY.MajorGrid      = false;
            chart.AxisY.AxisLine       = true;
            chart.AxisY.MajorTickMarks = TickMark.Outside;
            chart.AxisX.Title          = "x";
            chart.ToolTip.Content      = "{item:0.00}";
            chart.Header.Content       = "2D deformation distribution";
            chart.Header.Style.Font    = new Font("Seqoe UI", 16);

            var scale = new GradientColorScale()
            {
                Min  = 0,
                Max  = 4,
                Axis = new C1.Win.Chart.Extended.ColorAxis()
                {
                    Position = Position.Right, Title = "deformation, mm"
                },
                Colors = new List <Color> {
                    Color.Yellow, Color.Red
                }
            };

            var data = new double[150, 150];

            for (var i = 0; i < 150; i++)
            {
                for (var j = 0; j < 150; j++)
                {
                    data[i, j] = 2 + (Math.Sin(0.01 * i) + Math.Cos(0.1 * j));
                }
            }

            var hmap = new Heatmap();

            hmap.DataSource = data;
            hmap.ColorScale = scale;
            hmap.StartX     = 0;
            hmap.StartY     = 0;
            chart.Series.Add(hmap);

            Controls.Add(chart);
        }
        private void ChartLoaded(object sender, RoutedEventArgs e)
        {
            if (chart.Series.Count > 0)
            {
                return;
            }

            chart.BeginUpdate();

            var scale = new GradientColorScale()
            {
                Min  = 0,
                Max  = 4,
                Axis = new C1.WPF.Chart.Extended.ColorAxis()
                {
                    Position = Position.Right,
                    Title    = "deformation, mm"
                },
                Colors = new List <Color> {
                    Colors.Yellow, Colors.Red
                }
            };

            var data = new double[50, 50];

            for (var i = 0; i < 50; i++)
            {
                for (var j = 0; j < 50; j++)
                {
                    data[i, j] = 2 + (Math.Sin(0.1 * i) + Math.Cos(0.1 * j));
                }
            }

            var hmap = new Heatmap();

            hmap.ItemsSource = data;
            hmap.ColorScale  = scale;
            hmap.StartX      = 0;
            hmap.StartY      = 0;
            chart.Series.Add(hmap);

            chart.EndUpdate();
        }
        private void Temperature_Load(object sender, EventArgs e)
        {
            var chart = new FlexChart();

            chart.Dock                 = DockStyle.Fill;
            chart.AxisY.MajorGrid      = false;
            chart.AxisX.AxisLine       = false;
            chart.AxisX.MajorTickMarks = C1.Chart.TickMark.None;
            chart.Header.Content       = "Average temperature by month";
            chart.Header.Style.Font    = new Font("Seqoe UI", 16);
            chart.Rotated              = true;

            chart.PlotStyle.StrokeColor = Color.LightGray;
            chart.PlotStyle.StrokeWidth = 1;

            var scale = new GradientColorScale();

            scale.Colors = new List <Color> {
                Color.Blue, Color.White, Color.Red
            };
            scale.Min = -30;
            scale.Max = 30;

            var hmap = new Heatmap();

            hmap.DataSource = new double[, ] {
                { 3.0, 3.1, 5.7, 8.2, 12.5, 15.0, 17.1, 17.1, 14.3, 10.6, 6.6, 4.3 },
                { -9.3, -7.7, -2.2, 5.8, 13.1, 16.6, 18.2, 16.4, 11.0, 5.1, -1.2, -6.1 },
                { -15.1, -12.5, -5.2, 3.1, 10.1, 15.5, 18.3, 15.0, 9.4, 1.4, -5.6, -11.4 },
            };
            hmap.ColorScale         = scale;
            hmap.DataLabel          = new DataLabel();
            hmap.DataLabel.Position = C1.Chart.LabelPosition.Center;
            hmap.DataLabel.Content  = "{item}";
            chart.Series.Add(hmap);

            chart.AxisX.DataSource = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
            chart.AxisY.DataSource = new string[] { "Amsterdam", "Moscow", "Perm" };

            this.Controls.Add(chart);
        }
        protected override void SetupChart()
        {
            this.flexChart1.Header.Content    = "Average Temperature By Month";
            this.flexChart1.Header.Style.Font = StyleInfo.ChartHeaderFont;
            var data = DataService.Get2DTempData();

            var gradientScale = new GradientColorScale
            {
                Min    = -30,
                Max    = 30,
                Colors = new List <Color>
                {
                    Color.Blue,
                    Color.NavajoWhite,
                    Color.Red,
                }
            };
            var heatmap = new Heatmap()
            {
                ColorScale = gradientScale,
                DataSource = data.Values,
            };

            this.flexChart1.Series.Add(heatmap);

            this.flexChart1.DataLabel.Content  = "{item:0.0}";
            this.flexChart1.DataLabel.Position = LabelPosition.Center;
            this.flexChart1.ToolTip.Active     = false;

            this.flexChart1.AxisX.Position  = Position.Top;
            this.flexChart1.AxisY.Min       = heatmap.StartX;
            this.flexChart1.AxisY.Max       = data.Values.GetLength(0) + heatmap.StartX;
            this.flexChart1.AxisY.MajorGrid = false;
            this.flexChart1.AxisY.AxisLine  = true;

            this.flexChart1.AxisX.DataSource = data.CatXData;
            this.flexChart1.AxisY.DataSource = data.CatYData;
            this.flexChart1.Rotated          = true;
        }