當前位置:編程學習大全網 - 行動軟體 - 怎麽修改wpfvisifire.charts的功能

怎麽修改wpfvisifire.charts的功能

1. 下載Visifire for WPF並安裝,安裝好以後該產品會出現在您的工具箱裏 2. 創建壹個WPF程序,並且引用WPFVisifire.Charts.dll,並且在您的代碼裏引用 using Visifire.Charts; using Visifire.Commons; 3. 添加代碼並且創建和顯示圖表,在該事例中圖表顯示在LayoutRoot裏,是壹個Grid容器,默認情況下Grid是空白的,必須為該Grid指定壹個x:Name="LayoutRoot" 4.同樣地,可以通過修改Height和Width來改變圖表的顯示大小 5.在Window1.xaml.cs裏我們可以開始創建圖表了,在 Window1()事件裏添加壹個CreateChart()函數,在CreateChart()裏創建圖表,具體代碼如下: public Window1() { InitializeComponent(); // Call function to create chart CreateChart(); } private void CreateChart() { // Create a Chart element Chart chart = new Chart(); // Set chart width and height chart.Width = 400; chart.Height = 300; // Create new DataSeries DataSeries dataSeries = new DataSeries(); // Number of DataPoints to be generated int numberOfDataPoints = 10; // To set the YValues of DataPoint Random random = new Random(); // Loop and add a few DataPoints for (int loopIndex = 0; loopIndex < numberOfDataPoints; loopIndex++) { // Create a DataPoint DataPoint dataPoint = new DataPoint(); // Set the YValue using random number dataPoint.YValue = random.Next(1, 100); // Add DataPoint to DataSeries dataSeries.DataPoints.Add(dataPoint); } // Add DataSeries to Chart chart.Series.Add(dataSeries); // Add chart to the LayoutRoot for display LayoutRoot.Children.Add(chart); }

  • 上一篇:韓劇有什麽好看的,新上榜的
  • 下一篇:什麽是“人機對話” ?
  • copyright 2024編程學習大全網