当前位置: 首页>>代码示例>>C#>>正文


C# Charting.Chart类代码示例

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


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


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