當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。