• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Charting.ChartArea类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.DataVisualization.Charting.ChartArea的典型用法代码示例。如果您正苦于以下问题:C# ChartArea类的具体用法?C# ChartArea怎么用?C# ChartArea使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChartArea类属于System.Windows.Forms.DataVisualization.Charting命名空间,在下文中一共展示了ChartArea类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddPlot

 public void AddPlot(List<double> values, string title = "")
 {
     Chart chart = new Chart();
     Series series = new Series();
     ChartArea chartArea1 = new ChartArea();
     chartArea1.Name = "ChartArea1";
     chart.ChartAreas.Add(chartArea1);
     series.BorderWidth = 2;
     series.BorderDashStyle = ChartDashStyle.Solid;
     series.ChartType = SeriesChartType.Line;
     series.Color = Color.Green;
     for (int i = 0; i < values.Count; i++)
     {
         series.Points.AddXY(i, values[i]);
     }
     chart.BorderlineColor = Color.Red;
     chart.BorderlineWidth = 1;
     chart.Series.Add(series);
     chart.Titles.Add(title);
     chart.Invalidate();
     chart.Palette = ChartColorPalette.Fire;
     chartArea1.AxisY.Minimum = values.Min();
     chartArea1.AxisY.Maximum = values.Max();
     AddChartInRuntime(chart);
 }
开发者ID:Spawek,项目名称:trendpredictortester,代码行数:25,代码来源:Plotter.cs


示例2: Init

        private void Init()
        {
            ChartArea chartArea = new ChartArea();
            Legend legend = new Legend();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();

            chartArea.Name = "ChartArea1";
            this.ChartAreas.Add(chartArea);
            legend.Name = "Legend1";
            this.Legends.Add(legend);

            Series.Clear();
            m_series = new Series
            {
                Name = "Series1",
                Color = System.Drawing.Color.Green,
                IsVisibleInLegend = false,
                IsXValueIndexed = true,
                ChartType = SeriesChartType.Line
            };
            Series.Add(m_series);

            for (int i = 10; i < 23; i++)
            {
                m_series.Points.AddXY(i, f(i));
            }
        }
开发者ID:AndrianDTR,项目名称:Atlantic,代码行数:27,代码来源:Chart.cs


示例3: AddChartToForm

        private Chart AddChartToForm(ChartData chartData)
        {
            var chart = new Chart { Dock = DockStyle.Fill, BackColor = Color.White };
            var title = new Title(chartData.ToString()) { Font = new Font("Verdana", 14.0f) };
            chart.Titles.Add(title);
            chart.Legends.Add(new Legend("Legend"));

            var area = new ChartArea("Main")
            {
                BackColor = Color.White,
                BackSecondaryColor = Color.LightSteelBlue,
                BackGradientStyle = GradientStyle.DiagonalRight,
                AxisY = { Maximum = 100 },
                AxisY2 = { Maximum = 20 }
            };

            area.AxisX.MajorGrid.LineColor = Color.LightSlateGray;
            area.AxisX.TitleFont = new Font("Verdana", 10.0f, FontStyle.Bold);
            area.AxisX.Title = "Date";
            area.AxisY.MajorGrid.LineColor = Color.LightSlateGray;
            area.AxisY.TitleFont = new Font("Verdana", 10.0f, FontStyle.Bold);
            area.AxisY.Title = "Weight";
            area.AxisY2.Title = "Reps";

            chart.ChartAreas.Add(area);

            var seriesColumns1 = new Series("Weights") { ChartType = SeriesChartType.Line, IsValueShownAsLabel = true };
            chart.Series.Add(seriesColumns1);
            var seriesColumns2 = new Series("Reps") { ChartType = SeriesChartType.Line };
            chart.Series.Add(seriesColumns2);

            Controls.Add(chart);

            return chart;
        }
开发者ID:gmoller,项目名称:GymWorkoutTracker,代码行数:35,代码来源:ChartControl.cs


示例4: CenterGravity

        public CenterGravity()
        {
            InitializeComponent();

            Chart chart = new Chart();
            ChartArea area = new ChartArea();
            area.AxisX.Title = "t";
            area.AxisX.Minimum = 0;
            area.AxisX.MajorGrid.LineColor = Color.LightGray;
            area.AxisY.Title = "Movement";
            area.AxisY.MajorGrid.LineColor = Color.LightGray;
            chart.ChartAreas.Add(area);
            _serie = new Series();
            _serie.ChartType = SeriesChartType.Line;
            _serie.MarkerStyle = MarkerStyle.Diamond;
            _serie.MarkerSize = 9;
            _serie.Color = Color.LimeGreen;
            chart.Series.Add(_serie);

            WindowsFormsHost host = new WindowsFormsHost();
            host.Child = chart;
            movlive.Children.Add(host);

            _cog = new cog(400, 400);
            coglive.Children.Add(_cog);

            _first = true;

            MainController.GetInstance.DataController.AddSensorDataListener(this);
        }
开发者ID:simonmoosbrugger,项目名称:SmartChair,代码行数:30,代码来源:CenterGravity.xaml.cs


示例5: ChartPanel

        public ChartPanel(MetingType type, SeriesChartType charttype)
            : base()
        {
            this.type = type;
            this.ChartType = charttype;

            this.chart = new Chart();
            this.chartArea = new ChartArea();
            this.chart.Titles.Add(new Title(type.ToString()));

            this.Location = new System.Drawing.Point(0, 0);

            this.Size = new System.Drawing.Size(400, 250);
            this.Controls.Add(chart);

            this.series = createSerie();
            this.chartArea.Name = "chartArea";

            this.chart.Size = new System.Drawing.Size(400, 250);

            this.chart.Dock = DockStyle.Fill;
            this.chart.Series.Add(series);
            this.chart.Text = "chart";

            this.chart.ChartAreas.Add(chartArea);
        }
开发者ID:aareschluchtje,项目名称:Ergometer-Application-Remco-Kees,代码行数:26,代码来源:ChartPanel.cs


示例6: MyChartControl

        /// <summary>
        /// Initialises a new instance of the class
        /// </summary>
        public MyChartControl()
        {
            InitializeComponent();
            _candles = new List<OHLC>();
            _mainChartArea = chartCtrl.ChartAreas[Constants.CandleAreaName];

            chartCtrl.MouseWheel += chartCtrl_MouseWheel;

            chartCtrl.MouseEnter += (s, e) =>
            {
                if (!chartCtrl.Focused)
                    chartCtrl.Focus();
            };
            chartCtrl.MouseLeave += (s, e) =>
            {
                if (chartCtrl.Focused)
                {
                    chartCtrl.Parent.Focus();
                }
                _mainChartArea.CursorX.Position = _mainChartArea.CursorY.Position = -10;
                _priceAnnotation.X = _priceAnnotation.Y = -10;
                lblInfo.Text = string.Empty;
            };
            chartCtrl.MouseMove += chartCtrl_MouseMove;

            InitChart();
        }
开发者ID:CryptoRepairCrew,项目名称:CoinTNet,代码行数:30,代码来源:MyChartControl.cs


示例7: CreateChart

        private void CreateChart()
        {
            // Создаём новую область для построения графика
            ChartArea area = new ChartArea
            {
                // Даём ей имя (чтобы потом добавлять графики)
                Name = "myGraph",
                AxisX =
                {
                    // Задаём левую и правую границы оси X
                    Minimum = 0,
                    Maximum = 10,
                    // Определяем шаг сетки
                    MajorGrid = {Interval = 1}
                }
            };

            // Добавляем область в диаграмму
            chart1.ChartAreas.Add(area);
            // Создаём объект для первого графика
            Series series1 = new Series
            {
                ChartArea = "myGraph",
                ChartType = SeriesChartType.Column,
                BorderWidth = 3,
                LegendText = "гистограмма"
            };
            chart1.Series.Add(series1);
        }
开发者ID:Deadpoolweid,项目名称:Programming_technologies,代码行数:29,代码来源:Form1.cs


示例8: ChartExtents

 internal ChartExtents(ChartArea ptrChartArea, bool justVisible)
 {
     var primary = GetBoundariesOfDataCore(ptrChartArea.AxisX, ptrChartArea.AxisY, justVisible);
     var secondary = GetBoundariesOfDataCore(ptrChartArea.AxisX2, ptrChartArea.AxisY2, justVisible);
     PrimaryExtents = primary;
     SecondaryExtents = secondary;
 }
开发者ID:iorihu2001,项目名称:MSChartExtension,代码行数:7,代码来源:ChartExtents.cs


示例9: MultipleGraphics

        public MultipleGraphics(ResultResearch r)
        {
            InitializeComponent();

            this.research = r;

            SortedDictionary<double, SortedDictionary<double, SubGraphsInfo>>.KeyCollection keys =
                this.research.Result.Keys;
            foreach (double k in keys)
            {
                Chart graphic = new Chart();
                graphic.Titles.Add("Network Size = " + this.research.Size.ToString());

                ChartArea chArea = new ChartArea("Current Level = " + k.ToString());
                chArea.AxisX.Title = "Mu";
                chArea.AxisY.Title = "Order";
                graphic.ChartAreas.Add(chArea);

                Series s = new Series("Current Level = " + k.ToString());
                s.ChartType = SeriesChartType.Line;
                s.Color = Color.Red;
                foreach (KeyValuePair<double, SubGraphsInfo> v in this.research.Result[k])
                {
                    s.Points.Add(new DataPoint(v.Key, v.Value.avgOrder));
                }
                graphic.Series.Add(s);

                graphic.Dock = DockStyle.Fill;
                TabPage page = new TabPage("Current Level = " + k.ToString());
                page.Controls.Add(graphic);
                this.graphicsTab.TabPages.Add(page);

                this.graphics.Add(graphic);
            }
        }
开发者ID:kocharyan-ani,项目名称:random_networks_explorer,代码行数:35,代码来源:MultipleGraphics.cs


示例10: GenerateChart

        private void GenerateChart(SeriesCreator creator, string filePath)
        {
            IEnumerable<Series> serieses = creator.ToSerieses();

            using (var ch = new Chart())
            {
                ch.Size = new Size(1300, 800);
                ch.AntiAliasing = AntiAliasingStyles.All;
                ch.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
                ch.Palette = ChartColorPalette.BrightPastel;

                ChartArea area = new ChartArea();
                area.AxisX.MajorGrid.Enabled = false;
                area.AxisY.MajorGrid.Enabled = false;
                area.AxisY.Minimum = creator.GetMinimumY();
                ch.ChartAreas.Add(area);

                Legend legend = new Legend();
                legend.Font = new Font("Microsoft Sans Serif", 12, FontStyle.Regular);
                ch.Legends.Add(legend);

                foreach (var s in serieses)
                {
                    ch.Series.Add(s);
                }

                string savePath = filePath + ".png";
                ch.SaveImage(savePath, ChartImageFormat.Png);
            }
        }
开发者ID:riyadparvez,项目名称:csv-to-chart,代码行数:30,代码来源:ChartCreator.cs


示例11: MSChartExtensionZoomDialog

 public MSChartExtensionZoomDialog(ChartArea sender)
 {
     InitializeComponent();
     ptrChartArea = sender;
     cbAxisType.SelectedIndex = 0;
     cbAxisType_SelectedIndexChanged(this, null);
 }
开发者ID:Code-Artist,项目名称:MSChartExtension,代码行数:7,代码来源:MSChartExtensionZoomDialog.cs


示例12: PrettyChart

        public PrettyChart()
        {
            var title1 = new Title {Name = "Title1", Text = "<TITLE>"};
            Titles.Add(title1);

            var area = new ChartArea();
            area.AxisY.LabelStyle.Enabled = true;
            area.AxisY.Interval = 1.0;
            area.AxisX.LabelStyle.Enabled = true;
            area.Name = "ChartArea2";

            var legend1 = new Legend {Alignment = StringAlignment.Center, Docking = Docking.Top, Name = "Legend1"};
            Legends.Add(legend1);

            var series2 = new Series
                              {
                                  ChartArea = "ChartArea2",
                                  Color = Color.Blue,
                                  Legend = "Legend1",
                                  Name = "Series2",
                                  XValueType = ChartValueType.Int32
                              };

            ChartAreas.Add(area);
            Series.Add(series2);
            Dock = DockStyle.Fill;
            Location = new Point(0, 0);

            Titles[0].Text = "Age Distribution";
            Series[0].Name = "Number of People";
        }
开发者ID:marksl,项目名称:dependency-injection-reportgenerator,代码行数:31,代码来源:PrettyChart.cs


示例13: AddChartsToProgressControl

        /* Adds one tab containing a chart to this.progressTabControl for each member in chartName.
         * Returns a list of the added charts.
         */
        private List<Chart> AddChartsToProgressControl(List<string> chartNames)
        {
            int i = 0;
            List<Chart> charts = new List<Chart>();

            foreach (string chartName in chartNames)
            {
                Legend legend = new Legend();
                legend.Name = "legend";
                legend.Docking = Docking.Right;

                ChartArea ca = new ChartArea();
                ca.Name = "chartArea";

                Chart chart = new Chart();
                chart.Legends.Add(legend);
                chart.ChartAreas.Add(ca);
                chart.Name = chartName;
                chart.Dock = DockStyle.Fill;
                chart.Text = chartName;

                TabPage tPage = new TabPage();
                tPage.Name = chartName;
                tPage.Text = chartName;
                tPage.Controls.Add(chart);

                this.progressTabControl.Controls.Add(tPage);

                charts.Add(chart);

                i++;
            }
            return charts;
        }
开发者ID:danilind,项目名称:workoutlogger,代码行数:37,代码来源:ProgressChartsControl.cs


示例14: CreatePieChart

        private Chart CreatePieChart(Legend legend, Title title, Dictionary<string, int> dpc)
        {
            var chart = new Chart();
            chart.Size = new Size(600, 450);
            chart.Titles.Add(title);
            var chartArea = new ChartArea();

            chart.ChartAreas.Add(chartArea);

            var series = new Series();
            series.Name = "series";
            series.ChartType = SeriesChartType.Pie;

            //chart.Legends.Add(legend);
            chart.Series.Add(series);

            foreach (var entry in dpc)
            {
                if(entry.Value > 0)
                    chart.Series["series"].Points.AddXY(entry.Key, entry.Value);
            }

            chart.Dock = DockStyle.Fill;
            return chart;
        }
开发者ID:cs1msa,项目名称:logs-analyzer,代码行数:25,代码来源:Report.cs


示例15: InitializeChart

        public void InitializeChart()
        {
            this.components = new System.ComponentModel.Container();
            ChartArea chartArea1 = new ChartArea();
            Legend legend1 = new Legend() { BackColor = Color.Green, ForeColor = Color.Black, Title = "Salary" };
            Legend legend2 = new Legend() { BackColor = Color.Green, ForeColor = Color.Black, Title = "Salary" };
            barChart = new Chart();

            ((ISupportInitialize)(barChart)).BeginInit();

            SuspendLayout();
            //====Bar Chart
            chartArea1 = new ChartArea();
            chartArea1.Name = "BarChartArea";
            barChart.ChartAreas.Add(chartArea1);
            barChart.Dock = System.Windows.Forms.DockStyle.Fill;
            legend2.Name = "Legend3";
            barChart.Legends.Add(legend2);

            AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            //this.ClientSize = new System.Drawing.Size(284, 262);
            this.Load += new EventHandler(Form3_Load);
            ((ISupportInitialize)(this.barChart)).EndInit();
            this.ResumeLayout(false);
        }
开发者ID:statavarthy,项目名称:Project-Life-Expectancy-Based-on-SocioEconomic-Indicators,代码行数:26,代码来源:Form3.cs


示例16: LineChartForm

 public LineChartForm()
 {
     this.chart = new Chart(){Dock = DockStyle.Fill};
     this.area = new ChartArea() {Name = "Area1"};
     this.series = new Series();
     series.ChartType = SeriesChartType.Line;
     series.ChartArea = "Area1";
 }
开发者ID:darkin100,项目名称:F--Hacking,代码行数:8,代码来源:Load_And_Iterate.cs


示例17: initialize

 private void initialize()
 {
     chart = (Chart)Host.Child;
     var chartArea = new ChartArea();
     chart.ChartAreas.Add(chartArea);
     chart.Series.Add(new Series() { Color = System.Drawing.Color.Red, ChartType = SeriesChartType.Line });
     chart.Series.Add(new Series() { Color = System.Drawing.Color.Blue, ChartType = SeriesChartType.Line });
     chart.Series.Add(new Series() { Color = System.Drawing.Color.Green, ChartType = SeriesChartType.Line });
 }
开发者ID:MikhailKhaliavsky,项目名称:University,代码行数:9,代码来源:MainWindow.xaml.cs


示例18: AddChart

 public void AddChart(string name, double[] val, Color color, ChartArea area)
 {
     var ser = new Series(name) {ChartArea  = area.Name, ChartType = SeriesChartType.Line, Color = color };
     for (int i = 0; i < val.Length; i++)
     {
         ser.Points.AddXY(i, val[i]);
     }
     chart1.Series.Add(ser);
 }
开发者ID:Ryoko,项目名称:KalmanFilter,代码行数:9,代码来源:Form1.cs


示例19: graphView

        public override void graphView()
        {
            //MessageBox.Show("ypDayo");

            base.chartClear();
            base.graphView();

            

            ChartArea area = new ChartArea("area1");
            
            area.AxisX.Title = "月";
            area.AxisX.TitleFont = new Font("@MS ゴシック", 10, FontStyle.Bold);

            area.AxisY.Title = "金額";
            area.AxisY.TitleFont = new Font("@MS ゴシック", 10, FontStyle.Bold);
            area.AxisY.TitleAlignment = StringAlignment.Far;
            area.AxisY.TextOrientation = TextOrientation.Stacked;

            graph.Titles.Add(date.Year + "年");

            area.AxisX.MajorGrid.Enabled = false;
            area.AxisY.MajorGrid.Enabled = false;
            graph.ChartAreas.Add(area);

            Legend leg = new Legend(date.Year.ToString());
            leg.Alignment = StringAlignment.Near;
            leg.DockedToChartArea = "area1";
            
            //一つ目
            setSeries(date.Year);
            //比較用
            dateCombo.Text = string.IsNullOrWhiteSpace(dateCombo.Text) ? "未選択" : dateCombo.Text;
            if (dateCombo.Text != "未選択")
            {
                
                
                string select = dateCombo.SelectedItem.ToString();

                setSeries(int.Parse(select));
                dateCombo.SelectedIndexChanged -= DateCombo_SelectedIndexChanged;
                dateCombo.Text = select;
                
            }
            


            area.AxisY.Maximum = double.NaN;

            area.AxisX.Maximum = 12;
            area.AxisX.Minimum = 0;
            area.AxisX.Interval = 1;

            double max = area.AxisY.Maximum;

            area.AxisY.Interval = max / 10;
        }
开发者ID:wasuken,项目名称:HABook_winforms,代码行数:57,代码来源:YearGraphPage.cs


示例20: CreatePlotAndSave

        private static void CreatePlotAndSave(TestItem testItem)
        {
            // Create a Chart
            var chart = new Chart();

            // Chart title
            var chartTitle = new Title(testItem.Label);
            chart.Titles.Add(chartTitle);

            // Create Chart Area
            ChartArea chartArea = new ChartArea();
            chartArea.AxisX.Title = "Milestone title";
            chartArea.AxisY.Title = "ms";
            chartArea.AxisX.IsMarginVisible = false;

            for (int i = 0; i < testItem.MilestoneLabels.Length;i++)
            {
                chartArea.AxisX.CustomLabels.Add(i + 0.5, i + 1.5, testItem.MilestoneLabels[i]);
            }

            // Legend
            Legend legend = new Legend("default");
            legend.Docking = Docking.Bottom;
            chart.Legends.Add(legend);

            // Add Chart Area to the Chart
            chart.ChartAreas.Add(chartArea);

            foreach (var line in testItem.Lines)
            {
                Series series = new Series();
                series.Legend = "default";
                series.LegendText = line.Label;
                series.ChartType = SeriesChartType.Line;
                series.MarkerStyle = MarkerStyle.Circle;
                series.BorderWidth = 2;
                series.MarkerSize = 5;
                for (int i = 0; i < line.Points.Length; i++)
                {
                    series.Points.Add(line.Points[i].GetMinTime());
                }
                chart.Series.Add(series);
            }

            // Set chart control location
            chart.Location = new System.Drawing.Point(16, 48);

            // Set Chart control size
            chart.Size = new System.Drawing.Size(400, 300);
            var fileName = GenerateFileName(testItem);
            var file = new FileStream(fileName, FileMode.Create);
            chart.SaveImage(file, ChartImageFormat.Png);
            file.Close();

            Console.WriteLine(String.Format("Report: \"{0}\" created.", fileName));
        }
开发者ID:Coderik,项目名称:NGauge,代码行数:56,代码来源:Program.cs



注:本文中的System.Windows.Forms.DataVisualization.Charting.ChartArea类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Charting.DataPoint类代码示例发布时间:2022-05-26
下一篇:
C# Charting.Chart类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap