public CategoryDataRandomSample() { _settings = new CategoryDataSettings(); _settings.DataPoints = InsectData.getDataPoints(); _settings.ValueStart = 0; _settings.ValueChange = 10; _settings.PropertyChanged += OnSettingsPropertyChanged; this.Generate(InsectData.getName()); }
public void Generate(string name) { this.Clear(); CategoryDataPoint dataPoint = new CategoryDataPoint(); //dataPoint.Index = 0; //dataPoint.Value = this.Settings.ValueStart; //dataPoint.High = 0; //dataPoint.Low = 0; //dataPoint.Category = (dataPoint.Index + 2).ToString(); dataPoint.Category = (dataPoint.Index + 2).ToString(); List <double> list = InsectData.getData(name); List <int> dates = InsectData.getDate(); List <double> maxtem = InsectData.getMaxTem(); List <double> mintem = InsectData.getMinTem(); List <double> hum = InsectData.getHum(); for (int i = 0; i < dates.Count; i++) { dataPoint.Value = list[i]; dataPoint.Mintem = mintem[i]; dataPoint.Maxtem = maxtem[i]; dataPoint.Hum = hum[i]; dataPoint.Name = name; dataPoint.Low = list[i]; dataPoint.High = list[i]; dataPoint.Index = dates[i]; dataPoint.Category = "µÚ" + (dates[i]).ToString() + "ÖÜ"; this.Add(dataPoint.Clone()); // if (CategoryDataGenerator.Random.NextDouble() > .5) // { // dataPoint.Value += (CategoryDataGenerator.Random.NextDouble() * this.Settings.ValueChange); // dataPoint.Value += this.Settings.ValueChange; // } // else // { // dataPoint.Value -= (CategoryDataGenerator.Random.NextDouble() * this.Settings.ValueChange); // //dataPoint.Value -= this.Settings.ValueChange; // } // dataPoint.High = dataPoint.Value + this.Settings.ValueChange; // dataPoint.Low = dataPoint.Value - this.Settings.ValueChange; //// dataPoint.Date = dataPoint.Date.Add(this.Settings.DateInterval); // dataPoint.Index += 1; // dataPoint.Category = (dataPoint.Index + 1).ToString(); } }
private void combobox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox combobox = sender as ComboBox; if (combobox.SelectedIndex != -1 && combobox == combobox1) { combobox1isclick = true; Insect insect = (Insect)combobox.SelectedItem; InsectData.setInsect(insect.Name); frame2.Source = new Uri("pack://application:,,,/Editing/ChartScrollIntoView.xaml"); frame2.Refresh(); } if (combobox.SelectedIndex != -1 && combobox == combobox2) { combobox2isclick = true; Insect insect = (Insect)combobox.SelectedItem; InsectData.setInsect(insect.Name); frame3.Source = new Uri("pack://application:,,,/series/ValueOverlays.xaml"); frame3.Refresh(); } }
public Window1() { InitializeComponent(); color = lab1.Background; List <string> list = InsectData.getInsect(); insectname = list[1]; List <Insect> insects = new List <Insect>(); for (int i = 0; i < list.Count; i++) { Insect insect = new Insect(); insect.Id = i.ToString(); insect.Name = list[i]; insects.Add(insect); } combobox1.ItemsSource = insects; combobox1.DisplayMemberPath = "Name"; combobox1.SelectedValuePath = "Id"; combobox1.Visibility = Visibility.Hidden; combobox2.ItemsSource = insects; combobox2.DisplayMemberPath = "Name"; combobox2.SelectedValuePath = "Id"; combobox2.Visibility = Visibility.Hidden; brush = new SolidColorBrush(Color.FromArgb(225, 68, 87, 84)); grid1.Visibility = Visibility.Visible; grid2.Visibility = Visibility.Hidden; grid3.Visibility = Visibility.Hidden; combobox1.Visibility = Visibility.Hidden; combobox2.Visibility = Visibility.Hidden; this.lab1.Background = brush; //label.Foreground = Brushes.Black; frame1.Source = new Uri("pack://application:,,,/MainWindow.xaml"); frame1.Refresh(); }
private void OnSettingsPropertyChanged(object sender, PropertyChangedEventArgs e) { this.Generate(InsectData.getName()); }
private void lab_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Label label = sender as Label; if (name.Length <= 0) { //if (label == lab1) //{ // grid1.Visibility = Visibility.Visible; // grid2.Visibility = Visibility.Hidden; // grid3.Visibility = Visibility.Hidden; // combobox1.Visibility = Visibility.Hidden; // combobox2.Visibility = Visibility.Hidden; // label.Background = brush; // //label.Foreground = Brushes.Black; // frame1.Source= new Uri("pack://application:,,,/MainWindow.xaml"); // frame1.Refresh(); //} if (label == lab2) { grid1.Visibility = Visibility.Hidden; grid2.Visibility = Visibility.Visible; grid3.Visibility = Visibility.Hidden; combobox1.Visibility = Visibility.Visible; combobox2.Visibility = Visibility.Hidden; label.Background = brush; // label.Background = null; label.Foreground = Brushes.Black; this.lab1.Background = color; if (combobox1isclick == false) { this.combobox1.Text = insectname; InsectData.setInsect(insectname); frame2.Source = new Uri("pack://application:,,,/Editing/ChartScrollIntoView.xaml"); frame2.Refresh(); } } if (label == lab3) { grid1.Visibility = Visibility.Hidden; grid2.Visibility = Visibility.Hidden; grid3.Visibility = Visibility.Visible; combobox1.Visibility = Visibility.Hidden; combobox2.Visibility = Visibility.Visible; label.Foreground = Brushes.Black; label.Background = brush; this.lab1.Background = color; if (combobox2isclick == false) { this.combobox2.Text = insectname; InsectData.setInsect(insectname); frame3.Source = new Uri("pack://application:,,,/series/ValueOverlays.xaml"); frame3.Refresh(); } } } else if (label.Name == name) { return; } else { if (lab1.Name == name) { lab1.Background = color; lab1.Foreground = Brushes.White; } if (lab2.Name == name) { lab2.Background = color; lab2.Foreground = Brushes.White; } if (lab3.Name == name) { lab3.Background = color; lab3.Foreground = Brushes.White; } if (label == lab1) { grid1.Visibility = Visibility.Visible; grid2.Visibility = Visibility.Hidden; grid3.Visibility = Visibility.Hidden; combobox1.Visibility = Visibility.Hidden; combobox2.Visibility = Visibility.Hidden; label.Background = brush; label.Foreground = Brushes.Black; frame1.Source = new Uri("pack://application:,,,/MainWindow.xaml"); frame1.Refresh(); } if (label == lab2) { grid1.Visibility = Visibility.Hidden; grid2.Visibility = Visibility.Visible; grid3.Visibility = Visibility.Hidden; combobox1.Visibility = Visibility.Visible; combobox2.Visibility = Visibility.Hidden; label.Background = brush; label.Foreground = Brushes.Black; if (combobox1isclick == false) { this.combobox1.Text = insectname; InsectData.setInsect(insectname); frame2.Source = new Uri("pack://application:,,,/Editing/ChartScrollIntoView.xaml"); frame2.Refresh(); } } if (label == lab3) { grid1.Visibility = Visibility.Hidden; grid2.Visibility = Visibility.Hidden; grid3.Visibility = Visibility.Visible; combobox1.Visibility = Visibility.Hidden; combobox2.Visibility = Visibility.Visible; label.Background = brush; label.Foreground = Brushes.Black; if (combobox2isclick == false) { this.combobox2.Text = insectname; InsectData.setInsect(insectname); frame3.Source = new Uri("pack://application:,,,/series/ValueOverlays.xaml"); frame3.Refresh(); } } } name = label.Name; }