1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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;
}
}
}