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

C# Charting.Chart类代码示例

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

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



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

示例1: InitializeComponent

        protected void InitializeComponent()
        {
            
            this.graph = new Chart();
            ((System.ComponentModel.ISupportInitialize)(this.graph)).BeginInit();
            this.SuspendLayout();
            Controls.Add(graph);
            // graph
            graph.Location = new Point(0,70);
            graph.Size = new Size(graph.Parent.Size.Width, graph.Parent.Size.Height-70);
            graph.Anchor = AnchorStyles.Top|AnchorStyles.Bottom|AnchorStyles.Left|AnchorStyles.Right;

            ((System.ComponentModel.ISupportInitialize)(this.graph)).EndInit();
            this.ResumeLayout(false);


            //dateCombo
            dateCombo = new ComboBox();
            dateCombo.Location = new Point(300,30);
            dateCombo.Items.Add("未選択");
            Controls.Add(dateCombo);


            //compCheck
            compCheck = new CheckBox();
            compCheck.Text = "比較する";
            compCheck.Location = new Point(dateCombo.Right+10,30);
            Controls.Add(compCheck);
            compCheck.CheckedChanged += CompCheck_CheckedChanged;
            compCheck.Checked = true;

            
        }
开发者ID:wasuken,项目名称:HABook_winforms,代码行数:33,代码来源:GraphPage.cs


示例2: AddDataPointsToChart

        private void AddDataPointsToChart(IEnumerable<ExerciseInstance> exerciseInstances, Chart chart)
        {
            string exrxName = string.Empty;
            double axisYMaximum = 0.0f;
            double axisYMinimum = float.MaxValue;

            foreach (ExerciseInstance exerciseInstance in exerciseInstances)
            {
                chart.Series["Weights"].Points.AddXY(exerciseInstance.Date, exerciseInstance.OneRepMax);
                chart.Series["Reps"].Points.AddXY(exerciseInstance.Date, exerciseInstance.Reps);

                if (exerciseInstance.OneRepMax < axisYMinimum)
                {
                    axisYMinimum = exerciseInstance.OneRepMax - (exerciseInstance.OneRepMax * 0.1f);
                }

                if (exerciseInstance.OneRepMax > axisYMaximum)
                {
                    axisYMaximum = exerciseInstance.OneRepMax * 1.1f;
                }
                exrxName = exerciseInstance.Exercise.ExRxName;
            }

            chart.Titles[0].Text = exrxName;
            chart.ChartAreas[0].AxisY.Minimum = axisYMinimum;
            chart.ChartAreas[0].AxisY.Maximum = axisYMaximum;
        }
开发者ID:gmoller,项目名称:GymWorkoutTracker,代码行数:27,代码来源:ChartControl.cs


示例3: SetTitle

 private void SetTitle(Chart chart)
 {
     var title = chart.Titles.Add("default");
     title.Text = _report.Query.ToString();
     title.Alignment = ContentAlignment.TopLeft;
     title.Font = GetFont(12);
 }
开发者ID:sheryever,项目名称:elmah-log-analyzer-with-custom-data,代码行数:7,代码来源:ReportChartView.cs


示例4: DisplayChart

        public void DisplayChart(Chart dchart)
        {
            if (dchart.Series.Count == 0)
            {
                var series = new Series("Chart")
                                 {
                                     ChartType = SeriesChartType.Line,
                                     Color = System.Drawing.Color.MediumPurple,
                                     BorderWidth = 2
                                 };
                MethodInvoker action = delegate { dchart.Series.Add(series); };
                dchart.Invoke(action);

            }
            else
            {

                MethodInvoker action = delegate
                                           {
                                               dchart.Series[0].Points.AddXY(MaxDt.ToShortDateString(), Strategyperformance.EntireTradesSum);
                                               dchart.Legends[0].Enabled = false;
                                           };
                dchart.Invoke(action);
            }
        }
开发者ID:rlyalko,项目名称:REVERSALS_v14,代码行数:25,代码来源:SummaryDisplayer.cs


示例5: ImageExportDialog

    /// <summary>
    /// Initializes a new ImageExportDialog.
    /// </summary>
    /// <remarks>
    /// Throws an ArgumentNullException if <paramref name="chart"/> is null.
    /// </remarks>
    /// <param name="chart">The chart for which the export should be generated.</param>
    public ImageExportDialog(Chart chart) {
      if (chart == null) throw new ArgumentNullException("chart");
      this.originalChart = chart;
      InitializeComponent();
      #region Custom Initialization
      SuppressEvents = true;
      try {
        resolutionUnitComboBox.Items.Add(DPI);
        resolutionUnitComboBox.Items.Add(DPCM);
        lengthUnitComboBox.Items.Add(INCH);
        lengthUnitComboBox.Items.Add(CM);
        resolutionUnitComboBox.SelectedIndex = 0;
        if (System.Globalization.RegionInfo.CurrentRegion.IsMetric)
          lengthUnitComboBox.SelectedIndex = 1;
        else lengthUnitComboBox.SelectedIndex = 0;

        titleFontSizeComboBox.Text = "10";
        axisFontSizeComboBox.Text = "8";
        scalesFontSizeComboBox.Text = "6";
        legendFontSizeComboBox.Text = "6";
        resolutionComboBox.Text = "150";
        SuppressEvents = false;
        splitContainer.Panel2Collapsed = true;
        Width = 305;
        Height = 625;
      }
      finally { SuppressEvents = false; }
      #endregion
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:36,代码来源:ImageExportDialog.cs


示例6: InternalSetBindingSourcePositionAlpha

        public static void InternalSetBindingSourcePositionAlpha(object context, Chart c, double value)
        {
            __Chart cc = c;

            cc.BindingSourcePositionAlpha = Math.Max(0.0, Math.Min(1.0, value));
            cc.DataBind();
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:7,代码来源:Chart.cs


示例7: 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


示例8: GetBindingSourcePositionAlpha

        public double GetBindingSourcePositionAlpha(Chart control)
        {
            if (!InternalBindingSourcePositionAlpha.ContainsKey(control))
                return default(double);

            return InternalBindingSourcePositionAlpha[control];
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:7,代码来源:ApplicationControlExtender.cs


示例9: SetBindingSourcePositionAlpha

        public void SetBindingSourcePositionAlpha(Chart control, double value)
        {
            InternalBindingSourcePositionAlpha[control] = value;

            if (InternalSetBindingSourcePositionAlpha != null)
                InternalSetBindingSourcePositionAlpha(this, control, value);
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:7,代码来源:ApplicationControlExtender.cs


示例10: MadeChart

        public void MadeChart(Chart chart, int band, int[] chartData)
        {
            Series series = new Series {ChartType = SeriesChartType.SplineArea};
            Title title;
            switch (_type)
            {
                case 2:
                    title = new Title
                    {
                        Text = "遥感图像累计直方图 · 波段:" + band,
                        TextStyle = TextStyle.Shadow,
                        Font = new Font(new FontFamily("微软雅黑"), 10)
                    };
                    break;

                case 1:
                default:
                    title = new Title
                    {
                        Text = "遥感图像直方图 · 波段:" + band,
                        TextStyle = TextStyle.Shadow,
                        Font = new Font(new FontFamily("微软雅黑"), 10)
                    };
                    break;
            }

            for (int i = 1; i < chartData.Length; i++)
            {
                series.Points.AddXY(i, chartData[i]);
            }

            chart.Series.Add(series);
            chart.Titles.Add(title);
            chart.Refresh();
        }
开发者ID:XXZZQQ,项目名称:XZQ,代码行数:35,代码来源:Histogram.cs


示例11: 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


示例12: FillChartRanges

        public static void FillChartRanges(List<DataRange> ranges, Chart chart1)
        {
            foreach (DataRange range in ranges)
            {
                Series series = new Series(range.Id + " " + range.Description);
                series.ChartType = SeriesChartType.Line;
                series.MarkerStyle = MarkerStyle.Circle;

                series.EmptyPointStyle.BorderWidth = 0;
                series.EmptyPointStyle.MarkerStyle = MarkerStyle.None;

                chart1.Series.Add(series);
                foreach (ContinuousClientIntegration.Business.Statistics.DataPoint point in range.DataPoints)
                {
                    series.Points.AddXY(point.TimeStamp, point.Value);
                }
                if (range.Description.Equals("Coverage"))
                {
                    series.ChartArea = "Coverage";
                    series.Legend = "Coverage";
                }
                if (range.Description.Equals("Codesize"))
                {
                    series.ChartArea = "Codesize";
                    series.Legend = "Codesize";
                }
            }
            if (ranges.Count > 0 && ranges[0].DataPoints.Count > 0)
            {
                chart1.Titles.Add("Coverage and codesize on " + ranges[0].DataPoints[0].TimeStamp.ToShortDateString());
            }
        }
开发者ID:StefanN,项目名称:DojoTimer-for-.Net,代码行数:32,代码来源:ChartBuilder.cs


示例13: TimeDurationView

        public TimeDurationView()
        {
            InitializeComponent();
            DataContext = new TimeDurationViewModel();
            _resultRuntimes = new List<double>();
            _cumulativeRuntimeChart = new Chart();
            _cumulativeRuntimeChart.ChartAreas.Add("chtArea");
            CumulativeGraphControlHost.Child = _cumulativeRuntimeChart;
            _cumulativeRuntimeChart.ChartAreas[0].AxisX.Title = "Runs";
            _cumulativeRuntimeChart.ChartAreas[0].AxisX.TitleFont = new Font(
                System.Drawing.FontFamily.GenericSansSerif, 12);
            _cumulativeRuntimeChart.ChartAreas[0].AxisY.Title = "Runtime (Milliseconds)";
            _cumulativeRuntimeChart.ChartAreas[0].AxisY.TitleFont = new Font(
                System.Drawing.FontFamily.GenericSansSerif, 12);
            _cumulativeRuntimeChart.BackColor = Color.White;
            _cumulativeRuntimeChart.BorderSkin.SkinStyle = BorderSkinStyle.None;

            _individualRuntimeChart = new Chart();
            _individualRuntimeChart.ChartAreas.Add("chtArea");
            IndividualGraphControlHost.Child = _individualRuntimeChart;
            _individualRuntimeChart.ChartAreas[0].AxisX.Title = "Runs";
            _individualRuntimeChart.ChartAreas[0].AxisX.TitleFont = new Font(
                System.Drawing.FontFamily.GenericSansSerif, 12);
            _individualRuntimeChart.ChartAreas[0].AxisY.Title = "Runtime (Milliseconds)";
            _individualRuntimeChart.ChartAreas[0].AxisY.TitleFont = new Font(
                System.Drawing.FontFamily.GenericSansSerif, 12);
            _individualRuntimeChart.BackColor = Color.White;
            _individualRuntimeChart.BorderSkin.SkinStyle = BorderSkinStyle.None;
        }
开发者ID:CaffeineMachine,项目名称:QueryPerformanceComparer,代码行数:29,代码来源:TimeDurationView.xaml.cs


示例14: 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


示例15: ChangeChartColor

 public void ChangeChartColor(Chart chart, string color)
 {
     if (chart.Series.Count > 0)
     {
         chart.Series["Series"].Color = Color.FromName(color);
     }
 }
开发者ID:TruYuri,项目名称:SAPS,代码行数:7,代码来源:StatisticsSystem.cs


示例16: SetupChart

 public void SetupChart(Chart c)
 {
     chart = c;
     chart.Series.Add("value");
     chart.Series["value"].Color = Color.Green;
     chart.Series["value"].ChartType = SeriesChartType.Line;
 }
开发者ID:skopy123,项目名称:ArduinoGraph,代码行数:7,代码来源:AnalogReadExamples.cs


示例17: Form1

        public Form1()
        {
            InitializeComponent();
            int x = 0;
            selCards = new PictureBox[6];
            cardPics = new PictureBox[54];
            for (int i = 0; i < 54; i++)
            {
                cardPics[i] = new PictureBox();
                cardPics[i].Name = "c"+i;
                cardPics[i].Size = new Size(75, 108);
                cardPics[i].Image = (Bitmap)Resource1.ResourceManager.GetObject("c"+i.ToString());
                cardPics[i].SizeMode = PictureBoxSizeMode.Zoom;
                cardPics[i].Location = new Point(x, 15);
                cardPics[i].BorderStyle = BorderStyle.FixedSingle;
                cardPics[i].Click += new EventHandler(Card_Click);
                cardPics[i].Tag = new card(i);
                cardTableau.Controls.Add(cardPics[i]);
                cardPics[i].BringToFront();
                x += 15;
            }
            cardPics[52].Visible = false;
            cardPics[53].Visible = false;

            charts = new Charting.Chart[15];
            for (int i = 0; i < 15; i++)
            {
                charts[i] = new Charting.Chart();
                charts[i].Dock = DockStyle.Fill;
                charts[i].ChartAreas.Add("main");
                charts[i].ChartAreas[0].AxisX.LabelAutoFitStyle = System.Windows.Forms.DataVisualization.Charting.LabelAutoFitStyles.DecreaseFont;
                tableLayoutPanel1.Controls.Add(charts[i], i/4, i%4);
            }
        }
开发者ID:btrimble,项目名称:cribEXP,代码行数:34,代码来源:Form1.cs


示例18: 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


示例19: DrawGraph

 private void DrawGraph(double[] arr, Chart chart)
 {
     for (int i = 0; i < N; i++)
     {
         chart.Series[0].Points.AddXY(i, arr[i]);
     }
 }
开发者ID:J-Roux,项目名称:FourierTransform,代码行数:7,代码来源:Form1.cs


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Charting.ChartArea类代码示例发布时间:2022-05-26
下一篇:
C# Forms.XSizeHints类代码示例发布时间: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