Window_test_graphscan4.xaml.cs 1.77 KB
using FLY.ControlLibrary;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Window_test_graphscan4.xaml 的交互逻辑
    /// </summary>
    public partial class Window_test_graphscan4 : Window
    {
        public Window_test_graphscan4()
        {
            InitializeComponent();
            ObservableCollection<GraphScan4Data> datasource = new ObservableCollection<GraphScan4Data>();

            // Populate series data
            Random random = new Random();

            int cnt = 500;
            int mid = cnt / 2;
            for (int i = 0; i < cnt; i++)
            {
                double avg = Math.Sin(2 * Math.PI * i / (cnt/5)) * 15 + 30 + random.Next(3) - 1.5;
                double sigma = 2 + random.Next(3) - 1.5;

                GraphScan4Data d = new GraphScan4Data() { Avg = (int)(avg * 100), Sigma= (int)(sigma * 100) };
                datasource.Add(d);
            }
            for (int i = 20; i < 80; i++)
            {
                datasource[i] = new GraphScan4Data() { Avg = 99999998, Sigma = 99999998 }; 
            }

            this.graphscan1.DataSource = datasource;

            stackpanel_graph.DataContext = this.graphscan1;

            
            this.graphscan1.FirstBoltNo = -mid;
            this.graphscan1.FirstIndex = -1;
            this.graphscan1.LastIndex = cnt;

            this.graphscan1.DataFirst = 2;
            this.graphscan1.DataLast = cnt-2;


        }
    }
}