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

C# Charting.Chart类代码示例

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

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



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

示例1: PieSeriesWithOneDouble

 public void PieSeriesWithOneDouble()
 {
     KeyValuePair<string, double>[] objects = new KeyValuePair<string, double>[]
         {
             new KeyValuePair<string, double>("A", 90000.0)
         };
     Chart chart = new Chart();
     DataPointSeries pieSeries = DefaultSeriesToTest;
     chart.Series.Add(pieSeries);
     pieSeries.IndependentValueBinding = new Binding("Key");
     pieSeries.DependentValueBinding = new Binding("Value");
     TestAsync(
         chart,
         () => pieSeries.ItemsSource = objects,
         () => Assert.AreEqual(1, chart.LegendItems.Cast<object>().Count()),
         () =>
         {
             IList<PieDataPoint> pieDataPoints = ChartTestUtilities.GetDataPointsForSeries(pieSeries).Cast<PieDataPoint>().ToList();
             Assert.AreEqual(1, pieDataPoints.Count);
             PieDataPoint pieDataPoint = pieDataPoints[0];
             Assert.IsNotNull(pieDataPoint.Geometry);
             Assert.AreSame(typeof(EllipseGeometry), pieDataPoint.Geometry.GetType());
             Assert.IsNotNull(pieDataPoint.GeometryHighlight);
             Assert.AreSame(typeof(EllipseGeometry), pieDataPoint.GeometryHighlight.GetType());
             Assert.IsNotNull(pieDataPoint.GeometrySelection);
             Assert.AreSame(typeof(EllipseGeometry), pieDataPoint.GeometrySelection.GetType());
         });
 }
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:28,代码来源:PieSeriesTest.cs


示例2: CategoryNamesAreNotSorted

 public void CategoryNamesAreNotSorted()
 {
     Chart chart = new Chart();
     ColumnSeries series = new ColumnSeries();
     series.IndependentValueBinding = new Binding("Key");
     series.DependentValueBinding = new Binding("Value");
     series.ItemsSource = new KeyValuePair<string, int>[]
     {
         new KeyValuePair<string, int>("c", 3),
         new KeyValuePair<string, int>("a", 1),
         new KeyValuePair<string, int>("b", 2),
     };
     chart.Series.Add(series);
     CategoryAxis axis = null;
     TestAsync(
         chart,
         () => axis = chart.ActualAxes.OfType<CategoryAxis>().FirstOrDefault(),
         () =>
         {
             object[] labels = ChartTestUtilities.GetAxisLabels(axis).Select(l => l.DataContext).ToArray();
             Assert.AreEqual("c", labels[0]);
             Assert.AreEqual("a", labels[1]);
             Assert.AreEqual("b", labels[2]);
         });
 }
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:25,代码来源:CategoryAxisTest.cs


示例3: x628e6c716ec340be

        private void x628e6c716ec340be(int xf3efd21c486a5cce, object x11d58b056c032b03)
        {
            int num = xf3efd21c486a5cce;
            switch (num)
            {
                case 1:
                    this.chart = (Chart) x11d58b056c032b03;
                    break;

                case 2:
                    this.barSeries = (ColumnSeries) x11d58b056c032b03;
                    break;

                case 3:
                    ((Button) x11d58b056c032b03).Click += new RoutedEventHandler(this.x04abae94658fc85d);
                    break;

                default:
                    this._x7dc3d9d322900926 = true;
                    if ((((uint) xf3efd21c486a5cce) - ((uint) num)) <= uint.MaxValue)
                    {
                    }
                    break;
            }
        }
开发者ID:neismit,项目名称:emds,代码行数:25,代码来源:ChartWindow.cs


示例4: RebuildChartsPanel

        public void RebuildChartsPanel()
        {
            _plantAreaChartsPanel.Children.Clear();
            foreach (MeasurableParameter measurableParameter in _measurableParameters)
            {
                if (measurableParameter != null)
                {
                    Chart chart = new Chart
                    {
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Width = 1100,
                        Height = 225,
                        BorderBrush = Brushes.Black,
                        Background = (LinearGradientBrush) MainWindow.ResourceDictionary["ChartBackground"],
                        Title = measurableParameter.MeasurableType,
                    };

                    AreaSeries areaSeries = new AreaSeries
                    {
                        IndependentValueBinding = new Binding("Key"),
                        DependentValueBinding = new Binding("Value"),
                        Title = measurableParameter.MeasurableType,
                    };
                    chart.Series.Add(areaSeries);
                    _plantAreaChartsPanel.Children.Add(chart);
                }
            }

            DockPanel chartDescriptorPanel = CreateChartDescriptorPanel();

            _plantAreaChartsPanel.Children.Add(chartDescriptorPanel);
        }
开发者ID:LexaGal,项目名称:Plants,代码行数:32,代码来源:PlantAreaChartsPanelBuilder.cs


示例5: WpfConstruct

        public static Chart WpfConstruct(Signal signal)
        {
            Chart chart = new Chart();
            LineSeries series = new LineSeries();
            series.DependentValuePath = "Value";
            series.IndependentValuePath = "Key";
            KeyValuePair<double, double>[] points = new KeyValuePair<double, double>[signal.T.Length];

            for (int i = 0; i < signal.T.Length; ++i)
                points[i] = new KeyValuePair<double, double>(signal.T[i], signal.X[i]);
            series.ItemsSource = points;
            chart.Height = 300;

            //Axis t = new LinearAxis();
            //t.Name = "Time";

            //Axis v = new LinearAxis();
            //v.Name = "Value";
            //chart.Axes.Add(t);
            //chart.Axes.Add(v);

            chart.Series.Add(series);

            return chart;
        }
开发者ID:kverhun,项目名称:SignalProcessor,代码行数:25,代码来源:WpfChartConstructor.cs


示例6: CreatePdfDocument

        public Document CreatePdfDocument(Chart chart, string path)
        {
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap(
                (int) chart.ActualWidth,
                (int) chart.ActualHeight,
                96d,
                96d,
                PixelFormats.Pbgra32);

            renderBitmap.Render(chart);

            MemoryStream stream = new MemoryStream();
            BitmapEncoder encoder = new BmpBitmapEncoder();
            encoder.Frames.Add(BitmapFrame.Create(renderBitmap));
            encoder.Save(stream);

            Bitmap bitmap = new Bitmap(stream);
            System.Drawing.Image image = bitmap;

            System.Drawing.Image resizedImage = ResizeImage(image, image.Width*2, image.Height);

            Document doc = new Document(PageSize.A4);
            PdfWriter.GetInstance(doc, new FileStream(path, FileMode.OpenOrCreate));
            doc.Open();
            Image pdfImage = Image.GetInstance(resizedImage, ImageFormat.Jpeg);
            doc.Add(pdfImage);
            doc.Close();
            
            return doc;
        }
开发者ID:LexaGal,项目名称:Plants,代码行数:30,代码来源:PdfDocumentCreator.cs


示例7: getAxisPoint

        public static AxisPoint getAxisPoint(Chart xChart, RangeAxis xAxis, Point xPoint)
        {
            if (xAxis == null) return null;

            if (xAxis is LinearAxis)
            {
                // some redundant basic checks
                LinearAxis lAxis = xAxis as LinearAxis;
                double? lMin;
                double? lMax;
                lMin = lAxis.ActualMinimum;
                lMax = lAxis.ActualMaximum;

                if ((!lMin.HasValue) || (!lMax.HasValue)) return null;
                if (lMin.Value >= lMax.Value) return null;

                return new AxisPointLinear(xChart, lAxis, xPoint, lMin.Value, lMax.Value);
            }
            if (xAxis is DateTimeAxis)
            {
                // some redundant basic checks
                DateTimeAxis lAxis = xAxis as DateTimeAxis;
                DateTime? lMin;
                DateTime? lMax;
                lMin = lAxis.ActualMinimum;
                lMax = lAxis.ActualMaximum;

                if ((!lMin.HasValue) || (!lMax.HasValue)) return null;
                if (lMin.Value >= lMax.Value) return null;

                return new AxisPointDateTime(xChart, lAxis, xPoint, lMin.Value, lMax.Value);
            }

            throw new Exception("Axis type not supported yet.");
        } //
开发者ID:huoxudong125,项目名称:HQF.Tutorial.WPF,代码行数:35,代码来源:AxisPointLinear.cs


示例8: InitializeComponent

 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/DataVisualizationOnWindowsPhone;component/MainPage1.xaml", System.UriKind.Relative));
     this.myChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("myChart")));
     this.hyperlinkButton1 = ((System.Windows.Controls.HyperlinkButton)(this.FindName("hyperlinkButton1")));
 }
开发者ID:jasdeepg,项目名称:PredictShakti,代码行数:9,代码来源:MainPage1.g.i.cs


示例9: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.scatter = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target));
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:nathad02,项目名称:CITS3200--Group-H,代码行数:9,代码来源:Window2.g.i.cs


示例10: AxisPointDateTime

 public AxisPointDateTime(Chart xChart, DateTimeAxis xAxis, Point xPoint, DateTime xMin, DateTime xMax)
   : base(xChart, xAxis, xPoint)
 {
     Min = xMin;
     Max = xMax;
     Range = xMax - xMin;
     Axis = xAxis;
     MouseAxisValueAbsolute = xMin.AddMinutes(MouseAxisValueRelative * Range.TotalMinutes);
 } // constructor
开发者ID:huoxudong125,项目名称:HQF.Tutorial.WPF,代码行数:9,代码来源:AxisPointLinear.cs


示例11: AxisPointLinear

 public AxisPointLinear(Chart xChart, LinearAxis xAxis, Point xPoint, double xMin, double xMax)
   : base(xChart, xAxis, xPoint)
 {
     Min = xMin;
     Max = xMax;
     Range = xMax - xMin;
     Axis = xAxis;
     MouseAxisValueAbsolute = xMin + (MouseAxisValueRelative * Range);
 } // constructor
开发者ID:huoxudong125,项目名称:HQF.Tutorial.WPF,代码行数:9,代码来源:AxisPointLinear.cs


示例12: ResultView

        public ResultView(Dictionary<string, DataTable> lstAllSymbols, List<int> lstDataIndexes, int nNumOfDays, string[] strClustersData)
        {
            InitializeComponent();
            this.NumOfDays = nNumOfDays;
            this.DataIndexes = lstDataIndexes;
            this.AllSymbols = lstAllSymbols;
            int nClustersCount = 1;
            int nNumOfStocks;
            strClustersData[0] = strClustersData[0].Remove(0, 2);

            tabControl.DataContext = tabItems;

            // Run over all clusters
            foreach (string strCurrCluster in strClustersData)
            {
                TabItem tabItem = AddTabItem(nClustersCount);

                //TabPage tbNewTabCluster = new TabPage("קבוצה " + nClustersCount);
                //tbNewTabCluster.AutoScroll = true;
                //tbNewTabCluster.AccessibleRole = AccessibleRole.ScrollBar;
                //tabContainer.Controls.Add(tbNewTabCluster);
                // tbNewTabCluster.Show();
                nNumOfStocks = 0;

                // Run over each stock
                foreach (string strCurrSymbol in strCurrCluster.Split(','))
                {
                    Chart c = new Chart();
                    c.Width = tabItem.Width;
                    c.Height = 100;
                    c.Name = strCurrSymbol;
                    c.Title = strCurrSymbol;
                    tabItem.Content = c;

                    tabItems.Add(tabItem);

                    // Chart chart = new Chart();
                    // chart.Name = strCurrSymbol;
                    // chart.Titles.Add(strCurrSymbol);
                    //  tbNewTabCluster.Controls.Add(chart);
                    //    chart.Width = this.tabContainer.Width;
                    //   chart.Height = 100;
                    //   chart.Top = 100 * nNumOfStocks; ;

                    // Make Chart for the current stock
                    this.MakeChart(c, AllSymbols[strCurrSymbol]);

                   // chart.Show();
                    nNumOfStocks++;
                }

                nClustersCount++;
            }

            tabControl.SelectedIndex = 0;
        }
开发者ID:MichaelRo,项目名称:StockProject,代码行数:56,代码来源:ResultView.xaml.cs


示例13: SimpleChartTwoIntegers

 public void SimpleChartTwoIntegers()
 {
     DataPointSeries series = DefaultSeriesToTest;
     series.ItemsSource = new List<int>(new int[] { 1, -1 });
     Chart chart = new Chart();
     chart.Series.Add(series);
     TestAsync(
         chart,
         () => Assert.AreEqual(2, ChartTestUtilities.GetDataPointsForSeries(series).Count));
 }
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:10,代码来源:BarColumnSeriesBase.cs


示例14: SimpleChartOneIntegerValueZero

 public void SimpleChartOneIntegerValueZero()
 {
     DataPointSeries series = DefaultSeriesToTest;
     series.ItemsSource = new int[] { 0 };
     Chart chart = new Chart();
     chart.Series.Add(series);
     TestAsync(
         chart,
         () => Assert.AreEqual(1, ChartTestUtilities.GetDataPointsForSeries(series).Count));
 }
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:10,代码来源:BarColumnSeriesBase.cs


示例15: Display

 public Display(MainWindow mainWindow, Grid gvMain, Grid gvCentral, StackPanel titlePanel, TextBox inputGamer, Label response, Chart myChart, MenuItem menuExit, MenuItem menuStart, MenuItem menuMaxTry, MenuItem menuUserSelect, MenuItem menuUserCreate, MenuItem menuStatistic)
     : this(mainWindow, gvMain, gvCentral, titlePanel, inputGamer, response, myChart)
 {
     this.menuExit = menuExit;
     this.menuStart = menuStart;
     this.menuMaxTry = menuMaxTry;
     this.menuUserSelect = menuUserSelect;
     this.menuUserCreate = menuUserCreate;
     this.menuStatistic = menuStatistic;
 }
开发者ID:bahilo,项目名称:HiddenWord,代码行数:10,代码来源:Display.cs


示例16: InitializeComponent

 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/BarrasChart;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.barChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("barChart")));
 }
开发者ID:valtamiranovasquez,项目名称:barraschartwindowsphone,代码行数:11,代码来源:MainPage.g.i.cs


示例17: ViewModel

            } //

            public ViewModel(Chart xChart)
            {
                _Chart = xChart;
                Points = new ObservableCollection<DataPoint>();

                Points.Add(new DataPoint() { Day = 1.0, Price = 55, Tax = 2.0 });
                Points.Add(new DataPoint() { Day = 1.5, Price = 54, Tax = 1.0 });
                Points.Add(new DataPoint() { Day = 2.0, Price = 58, Tax = -1.0 });
                Points.Add(new DataPoint() { Day = 3.0, Price = 55.5, Tax = 0.0 });
                Points.Add(new DataPoint() { Day = 4.0, Price = 53, Tax = -2.0 });
            } // constructor
开发者ID:huoxudong125,项目名称:HQF.Tutorial.WPF,代码行数:13,代码来源:MainWindow.xaml.cs


示例18: InitializeComponent

 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/NIS.Module.Laboratory;component/Views/Info/InfoHistoryVysledkyView.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.HistoryVysledkyView = ((NeuroSpeech.UIAtoms.Controls.AtomForm)(this.FindName("HistoryVysledkyView")));
     this.PacientName = ((NeuroSpeech.UIAtoms.Controls.AtomTextBox)(this.FindName("PacientName")));
     this.chart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("chart")));
 }
开发者ID:aytacozkan,项目名称:nisproject,代码行数:11,代码来源:InfoHistoryVysledkyView.g.i.cs


示例19: AutomaticSeriesTitleNotApplied

 public void AutomaticSeriesTitleNotApplied()
 {
     DataPointSeries series = DefaultSeriesToTest;
     string title = "Custom Series Title";
     series.Title = title;
     Chart chart = new Chart();
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => Assert.AreSame(title, series.Title));
 }
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:11,代码来源:DataPointSingleSeriesWithAxesBase.cs


示例20: LineChartNoValues

 public void LineChartNoValues()
 {
     DataPointSeries series = DefaultSeriesToTest;
     series.ItemsSource = new int[0];
     series.IndependentValueBinding = new Binding();
     Chart chart = new Chart();
     chart.Series.Add(series);
     TestAsync(
         chart,
         () => Assert.AreEqual(0, ChartTestUtilities.GetDataPointsForSeries(series).Count));
 }
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:11,代码来源:LineScatterSeriesBase.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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