Exemplo n.º 1
0
        private void ReadButton_Click(object sender, RoutedEventArgs e)
        {
            ResponseTotalChart.Clear();
            ChartOne.Title = "День " + inputData.Text;
            int day   = 1;
            int hour  = 0;
            int count = 0;

            day  = Convert.ToInt32(inputData.Text);
            hour = dataList[0].hour;
            foreach (Data outData in dataList)
            {
                if (day == outData.dateDay)
                {
                    if (hour == outData.hour)
                    {
                        count++;
                    }
                    else
                    {
                        ResponseTotalChart.Add(new ResponsePoint
                        {
                            x = hour,
                            y = count,
                        });
                        hour  = outData.hour;
                        count = 0;
                    }
                }
            }
            ChartOne.ItemsSource = ResponseTotalChart;
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            //string path = @"C:\new\mycsv.csv";
            StreamReader csv = new StreamReader(path, Encoding.UTF8);

            //char[] delimiterChars = { ' ', ',', ':' };
            //List<Data> dataList = new List<Data>();
            //bool firstLine = false;
            //int count = 0;
            while (!csv.EndOfStream)
            {
                string str;
                str = csv.ReadLine();
                string[] splitStr = str.Split(delimiterChars);
                if (firstLine)
                {
                    count++;
                    string date1      = splitStr[0];
                    double numberOne1 = Convert.ToDouble(splitStr[4].Replace(".", ","));
                    double numberTwo1 = Convert.ToDouble(splitStr[5].Replace(".", ","));
                    dataList.Add(new Data(count, splitStr[0], splitStr[1], splitStr[2], splitStr[3], numberOne1, numberTwo1));
                }
                firstLine = true;
            }
            #region Sort


            dataList.Sort(delegate(Data temp1, Data temp2)
                          { return(temp1.sortID.CompareTo(temp2.sortID)); });



            #endregion

            ResponseTotalChart.Clear();



            count = 0;
            foreach (Data outData in dataList)
            {
                count++;
                outData.id   = count;
                outData.date = outData.timeFormat.ToString("F");
                //((ArrayList)DataList.Resources["DataListView"]).Add(outData);
            }
            //DataList.Items.Refresh();
        }
Exemplo n.º 3
0
        private void Freq2Button_Click(object sender, RoutedEventArgs e)
        {
            ResponseTotalChart.Clear();
            ChartOne.Title = "Частота2";
            int[] number = new int[1];
            int[] count  = new int[1];
            number[0] = Convert.ToInt32(diskDataList[0].numberTwo);
            count[0]  = 1;
            bool dop = true;

            foreach (Data outData in diskDataList)
            {
                dop = true;
                for (int i = 0; i < number.Length; i++)
                {
                    if (Convert.ToInt32(outData.numberTwo) == number[i])
                    {
                        count[i]++;
                        dop = false;
                    }
                }
                if (dop)
                {
                    int temp;
                    temp = number.Length + 1;
                    Array.Resize(ref number, temp);
                    temp = count.Length + 1;
                    Array.Resize(ref count, temp);
                    number[number.Length - 1] = Convert.ToInt32(outData.numberTwo);
                    count[count.Length - 1]   = 1;
                }
            }

            for (int i = 0; i < number.Length; i++)
            {
                ResponseTotalChart.Add(new ResponsePoint
                {
                    x = number[i],
                    y = count[i],
                });
            }
            ChartOne.ItemsSource = ResponseTotalChart;
        }