public void getData(string[] allData) { this.Text = "Patient ID: " + allData[0] + " (" + allData[1] + ")"; DbConnector dbConn = new DbConnector(); dbConn.connect(); //Graph Section if (allData[4] != "Blood Pressure") { int xBlockSize = 10; int yBlockSize = 20; chart1.Visible = true; chart2.Visible = false; PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); string what = ""; int minReading = 0; int maxReading = 0; float minReadingT = 0; float maxReadingT = 0; int counter = 0; var chart = chart1.ChartAreas[0]; int timeInterval = 1; int readingsInterval = 1; int startOffset = -2; int endOffset = 2; if (allData[4] == "Pulse Rate") { what = "pulseRate"; minReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", allData[0].ToString())); maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", allData[0].ToString())); } else if (allData[4] == "Breathing Rate") { what = "breathingRate"; minReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMin", allData[0].ToString())); maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMax", allData[0].ToString())); } else if (allData[4] == "Temperature") { what = "temperature"; minReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMin", allData[0].ToString())); maxReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMax", allData[0].ToString())); } foreach (var Txt in pReadingsHnd.getReadings(dbConn.getConn(), Int32.Parse(allData[0]), what)) { CustomLabel dateTimeLabel = new CustomLabel(startOffset, endOffset, (Txt.DateTime).ToString(), 0, LabelMarkStyle.None); if (what == "temperature") { chart1.Series["Module Readings"].Points.AddXY(counter, float.Parse((Txt.FloatRate).ToString())); } else { chart1.Series["Module Readings"].Points.AddXY(counter, Int32.Parse((Txt.IntRate).ToString())); } chart.AxisX.CustomLabels.Add(dateTimeLabel); startOffset = startOffset + 1; endOffset = endOffset + 1; counter++; } chart1.Series["Module Readings"].IsValueShownAsLabel = true; chart.AxisX.LabelStyle.Angle = -45; chart.AxisY.Title = allData[4]; chart.AxisX.Title = "Date and Time"; if (allData[4] == "Temperature") { //Minimum Value chart1.Series["Minimum"].Points.AddXY(0, minReadingT); chart1.Series["Minimum"].Points.AddXY(counter, minReadingT); //Maximum Value chart1.Series["Maximum"].Points.AddXY(0, maxReadingT); chart1.Series["Maximum"].Points.AddXY(counter, maxReadingT); } else { //Minimum Value chart1.Series["Minimum"].Points.AddXY(0, minReading); chart1.Series["Minimum"].Points.AddXY(counter, minReading); //Maximum Value chart1.Series["Maximum"].Points.AddXY(0, maxReading); chart1.Series["Maximum"].Points.AddXY(counter, maxReading); } //Set view range chart.AxisX.Minimum = 0; //chart.AxisX.Maximum = double.NaN; chart.AxisY.Minimum = 0; //chart.AxisY.Maximum = double.NaN; chart.AxisX.Interval = timeInterval; chart.AxisY.Interval = readingsInterval; //Enable autoscroll chart.CursorX.AutoScroll = true; chart.CursorY.AutoScroll = true; //Zoom to [0, xBlockSize] chart.AxisX.ScaleView.Zoomable = true; chart.AxisX.ScaleView.SizeType = DateTimeIntervalType.Number; chart.AxisY.ScaleView.Zoomable = true; chart.AxisY.ScaleView.SizeType = DateTimeIntervalType.Number; int position = 1; int size = xBlockSize; int ysize = yBlockSize; chart.AxisX.ScaleView.Zoom(position, size); chart.AxisY.ScaleView.Zoom(0, ysize); //Disable zoom-reset button (only scrollbar's arrows are available) chart.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; chart.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; // set scrollbar small change to blockSize (e.g. 100) chart.AxisX.ScaleView.SmallScrollSize = xBlockSize; chart.AxisY.ScaleView.SmallScrollSize = yBlockSize; } else { chart1.Visible = false; chart2.Visible = true; int xBlockSize = 10; int yBlockSize = 20; string what = "bloodPressure"; PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); int counter = 0; int startOffset = -2; int endOffset = 2; var chart = chart2.ChartAreas[0]; int timeInterval = 1; int readingsInterval = 1; int minReadingS = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMin", allData[0].ToString())); int maxReadingS = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMax", allData[0].ToString())); int minReadingD = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", allData[0].ToString())); int maxReadingD = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", allData[0].ToString())); foreach (var Txt in pReadingsHnd.getReadings(dbConn.getConn(), Int32.Parse(allData[0]), what)) { CustomLabel dateTimeLabel = new CustomLabel(startOffset, endOffset, (Txt.DateTime).ToString(), 0, LabelMarkStyle.None); chart2.Series["Systolic"].Points.AddXY(counter, Int32.Parse((Txt.IntRate).ToString())); chart2.Series["Diastolic"].Points.AddXY(counter, Int32.Parse((Txt.IntRate2).ToString())); chart.AxisX.CustomLabels.Add(dateTimeLabel); startOffset = startOffset + 1; endOffset = endOffset + 1; counter++; } chart2.Series["Systolic"].IsValueShownAsLabel = true; chart2.Series["Diastolic"].IsValueShownAsLabel = true; chart.AxisX.LabelStyle.Angle = -45; chart.AxisY.Title = "Blood Pressure Readings"; chart.AxisX.Title = "Date and Time"; //Minimum Value chart2.Series["Minimum (Systolic)"].Points.AddXY(0, minReadingS); chart2.Series["Minimum (Systolic)"].Points.AddXY(counter, minReadingS); chart2.Series["Minimum (Diastolic)"].Points.AddXY(0, minReadingD); chart2.Series["Minimum (Diastolic)"].Points.AddXY(counter, minReadingD); //Maximum Value chart2.Series["Maximum (Systolic)"].Points.AddXY(0, maxReadingS); chart2.Series["Maximum (Systolic)"].Points.AddXY(counter, maxReadingS); chart2.Series["Maximum (Diastolic)"].Points.AddXY(0, maxReadingD); chart2.Series["Maximum (Diastolic)"].Points.AddXY(counter, maxReadingD); //Set view range chart.AxisX.Minimum = 0; //chart.AxisX.Maximum = double.NaN; chart.AxisY.Minimum = 0; //chart.AxisY.Maximum = double.NaN; chart.AxisX.Interval = timeInterval; chart.AxisY.Interval = readingsInterval; //Enable autoscroll chart.CursorX.AutoScroll = true; chart.CursorY.AutoScroll = true; //Zoom to [0, xBlockSize] chart.AxisX.ScaleView.Zoomable = true; chart.AxisX.ScaleView.SizeType = DateTimeIntervalType.Number; chart.AxisY.ScaleView.Zoomable = true; chart.AxisY.ScaleView.SizeType = DateTimeIntervalType.Number; int position = 1; int size = xBlockSize; int ysize = yBlockSize; chart.AxisX.ScaleView.Zoom(position, size); chart.AxisY.ScaleView.Zoom(0, ysize); //Disable zoom-reset button (only scrollbar's arrows are available) chart.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; chart.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; // set scrollbar small change to blockSize (e.g. 100) chart.AxisX.ScaleView.SmallScrollSize = xBlockSize; chart.AxisY.ScaleView.SmallScrollSize = yBlockSize; } }
private void button1_Click(object sender, EventArgs e) { DbConnector dbConn = new DbConnector(); dbConn.connect(); string checkId = label11.Text; ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); if (textBox3.Text == mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", checkId) && textBox4.Text == mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", checkId) && textBox23.Text == mRHand.getModuleReading(dbConn.getConn(), "pulseRIntTime", checkId) && textBox6.Text == mRHand.getModuleReading(dbConn.getConn(), "breathRMin", checkId) && textBox5.Text == mRHand.getModuleReading(dbConn.getConn(), "breathRMax", checkId) && textBox24.Text == mRHand.getModuleReading(dbConn.getConn(), "breathRIntTime", checkId) && textBox8.Text == mRHand.getModuleReading(dbConn.getConn(), "systolicMin", checkId) && textBox7.Text == mRHand.getModuleReading(dbConn.getConn(), "systolicMax", checkId) && textBox9.Text == mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", checkId) && textBox10.Text == mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", checkId) && textBox25.Text == mRHand.getModuleReading(dbConn.getConn(), "bloodPIntTime", checkId) && textBox11.Text == mRHand.getModuleReading(dbConn.getConn(), "tempMin", checkId) && textBox12.Text == mRHand.getModuleReading(dbConn.getConn(), "tempMax", checkId) && textBox26.Text == mRHand.getModuleReading(dbConn.getConn(), "tempIntTime", checkId)) { MessageBox.Show("No changes detected"); } else { ModuleReadings mConfig = new ModuleReadings(); string thePatientId = checkId; mConfig.MinPulse = Int32.Parse(textBox3.Text); mConfig.MaxPulse = Int32.Parse(textBox4.Text); mConfig.MinBreath = Int32.Parse(textBox6.Text); mConfig.MaxBreath = Int32.Parse(textBox5.Text); mConfig.MinSystolic = Int32.Parse(textBox8.Text); mConfig.MaxSystolic = Int32.Parse(textBox7.Text); mConfig.MinDiastolic = Int32.Parse(textBox9.Text); mConfig.MaxDiastolic = Int32.Parse(textBox10.Text); mConfig.MinTemp = float.Parse(textBox11.Text); mConfig.MaxTemp = float.Parse(textBox12.Text); mConfig.PulseIntTime = Int32.Parse(textBox23.Text); mConfig.BreathIntTime = Int32.Parse(textBox24.Text); mConfig.PressureIntTime = Int32.Parse(textBox25.Text); mConfig.TempIntTime = Int32.Parse(textBox26.Text); mConfig.PRModifiedTime = DateTime.Now.ToString(); mConfig.BRModifiedTime = DateTime.Now.ToString(); mConfig.BPModifiedTime = DateTime.Now.ToString(); mConfig.TempModifiedTime = DateTime.Now.ToString(); mRHand.updatePatientBedsideId(dbConn.getConn(), mConfig, Int32.Parse(thePatientId), "New"); MessageBox.Show("Module Reading Changed Successfully !"); } }
public void latestValues() { DbConnector dbConn = new DbConnector(); dbConn.connect(); string checkId = label11.Text; ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); //Pulse Rate textBox3.Text = mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", checkId); textBox4.Text = mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", checkId); textBox23.Text = mRHand.getModuleReading(dbConn.getConn(), "pulseRIntTime", checkId); //Breathing Rate textBox6.Text = mRHand.getModuleReading(dbConn.getConn(), "breathRMin", checkId); textBox5.Text = mRHand.getModuleReading(dbConn.getConn(), "breathRMax", checkId); textBox24.Text = mRHand.getModuleReading(dbConn.getConn(), "breathRIntTime", checkId); //Blood Pressure textBox8.Text = mRHand.getModuleReading(dbConn.getConn(), "systolicMin", checkId); textBox7.Text = mRHand.getModuleReading(dbConn.getConn(), "systolicMax", checkId); textBox9.Text = mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", checkId); textBox10.Text = mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", checkId); textBox25.Text = mRHand.getModuleReading(dbConn.getConn(), "bloodPIntTime", checkId); //Temperature textBox11.Text = mRHand.getModuleReading(dbConn.getConn(), "tempMin", checkId); textBox12.Text = mRHand.getModuleReading(dbConn.getConn(), "tempMax", checkId); textBox26.Text = mRHand.getModuleReading(dbConn.getConn(), "tempIntTime", checkId); }
public void runMonitor(object sender, EventArgs e) { var pulseRate = checkBox1.Checked; var breathingRate = checkBox2.Checked; var bloodPressure = checkBox3.Checked; var temperature = checkBox4.Checked; var criticalColor = Color.FromArgb(255, 8, 8); var inRiskColor = Color.FromArgb(255, 214, 8); var normalColor = Color.FromArgb(8, 255, 86); line = sr.ReadLine(); if (line == null) { sr = new StreamReader("CSV/ModuleReadingsA.csv"); line = sr.ReadLine(); } DbConnector dbConn = new DbConnector(); dbConn.connect(); Patient ptient = new Patient(); PatientHandler patHnd = new PatientHandler(); ptient.Wing = (comboBox1.SelectedItem).ToString(); ptient.Floor = (comboBox2.SelectedItem).ToString(); ptient.Bay = (comboBox3.SelectedItem).ToString(); ptient.Bed = (comboBox4.SelectedItem).ToString(); string getPatientId = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientId"); int minPulse = 60; int maxPulse = 100; int minBreath = 12; int maxBreath = 20; int minSystolic = 80; int maxSystolic = 120; int minDiastolic = 60; int maxDiastolic = 80; float minTemp = 35.2F; float maxTemp = 36.1F; int pulseIntervalTime = 1; int breathIntervalTime = 1; int bloodPressureIntervalTime = 1; int temperatureIntervalTime = 1; if (getPatientId != "No record found") { ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); minPulse = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", getPatientId)); maxPulse = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", getPatientId)); pulseIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRIntTime", getPatientId)); minBreath = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMin", getPatientId)); maxBreath = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMax", getPatientId)); breathIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRIntTime", getPatientId)); minSystolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMin", getPatientId)); maxSystolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMax", getPatientId)); minDiastolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", getPatientId)); maxDiastolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", getPatientId)); bloodPressureIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "bloodPIntTime", getPatientId)); minTemp = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMin", getPatientId)); maxTemp = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMax", getPatientId)); temperatureIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempIntTime", getPatientId)); } PatientReadings pRead = new PatientReadings(); PatientReadingsHandler pReadHnd = new PatientReadingsHandler(); try { string[] data = line.Split(','); readingsList.Add(Int32.Parse(data[0])); //Pulse Rate Readings if (counter == pulseRateCounter && pulseRate != false) { label10.Text = data[0]; label14.Text = (maxPulse).ToString(); label15.Text = (minPulse).ToString(); if (Int32.Parse(data[0]) == 0) { labelBorder(10, "Critical"); label14.ForeColor = criticalColor; label15.ForeColor = criticalColor; } else if (Int32.Parse(data[0]) > maxPulse || Int32.Parse(data[0]) < minPulse) { labelBorder(10, "Risky"); if (Int32.Parse(data[0]) > maxPulse) { label14.ForeColor = inRiskColor; label15.ForeColor = normalColor; } else { label14.ForeColor = normalColor; label15.ForeColor = inRiskColor; } } else if (Int32.Parse(data[0]) >= minPulse && Int32.Parse(data[0]) <= maxPulse) { labelBorder(10, "Normal"); label14.ForeColor = normalColor; label15.ForeColor = normalColor; } pulseRateCounter = pulseRateCounter + pulseIntervalTime; } //Breathing Rate Readings if (counter == breathingRateCounter && breathingRate != false) { label11.Text = data[1]; label16.Text = (maxBreath).ToString(); label17.Text = (minBreath).ToString(); if (Int32.Parse(data[1]) == 0) { labelBorder(11, "Critical"); label16.ForeColor = criticalColor; label17.ForeColor = criticalColor; } else if ((Int32.Parse(data[1]) > maxBreath || Int32.Parse(data[1]) < minBreath)) { labelBorder(11, "Risky"); if (Int32.Parse(data[1]) > maxBreath) { label16.ForeColor = inRiskColor; label17.ForeColor = normalColor; } else { label16.ForeColor = normalColor; label17.ForeColor = inRiskColor; } } else if (Int32.Parse(data[1]) >= minBreath && Int32.Parse(data[1]) <= maxBreath) { labelBorder(11, "Normal"); label16.ForeColor = normalColor; label17.ForeColor = normalColor; } breathingRateCounter = breathingRateCounter + breathIntervalTime; } //Blood Pressure Readings if (counter == bloodPressureCounter && bloodPressure != false) { label12.Text = data[2] + "/" + data[3]; label18.Text = (maxSystolic).ToString(); label19.Text = (minSystolic).ToString(); label20.Text = (maxDiastolic).ToString(); label21.Text = (minDiastolic).ToString(); if (Int32.Parse(data[2]) == 0 || (Int32.Parse(data[3]) == 0)) { labelBorder(12, "Critical"); label18.ForeColor = criticalColor; label19.ForeColor = criticalColor; label20.ForeColor = criticalColor; label21.ForeColor = criticalColor; } else if ((Int32.Parse(data[2]) > maxSystolic || Int32.Parse(data[2]) < minSystolic) || (Int32.Parse(data[3]) > maxDiastolic || Int32.Parse(data[3]) < minDiastolic)) { labelBorder(12, "Risky"); if (Int32.Parse(data[2]) > maxSystolic) { label18.ForeColor = inRiskColor; label19.ForeColor = normalColor; } else if (Int32.Parse(data[2]) < minSystolic) { label18.ForeColor = normalColor; label19.ForeColor = inRiskColor; } if (Int32.Parse(data[3]) > maxDiastolic) { label20.ForeColor = inRiskColor; label21.ForeColor = normalColor; } else if (Int32.Parse(data[3]) < minDiastolic) { label20.ForeColor = normalColor; label21.ForeColor = inRiskColor; } } else if (Int32.Parse(data[2]) >= minSystolic && Int32.Parse(data[2]) <= maxSystolic && Int32.Parse(data[3]) >= minSystolic && Int32.Parse(data[3]) <= maxSystolic) { labelBorder(12, "Normal"); label18.ForeColor = normalColor; label19.ForeColor = normalColor; label20.ForeColor = normalColor; label21.ForeColor = normalColor; } bloodPressureCounter = bloodPressureCounter + bloodPressureIntervalTime; } //Temperature Readings if (counter == temperatureCounter && temperature != false) { label13.Text = data[4] + "°C"; label22.Text = (maxTemp).ToString(); label23.Text = (minTemp).ToString(); if (float.Parse(data[4]) == 0) { labelBorder(13, "Critical"); label22.ForeColor = criticalColor; label23.ForeColor = criticalColor; } else if (float.Parse(data[4]) > maxTemp || float.Parse(data[4]) < minTemp) { labelBorder(13, "Risky"); if (float.Parse(data[4]) > maxTemp) { label22.ForeColor = inRiskColor; label23.ForeColor = normalColor; } else { label22.ForeColor = normalColor; label23.ForeColor = inRiskColor; } } else if (float.Parse(data[4]) >= minTemp && float.Parse(data[4]) <= maxTemp) { labelBorder(13, "Normal"); label22.ForeColor = normalColor; label23.ForeColor = normalColor; } temperatureCounter = temperatureCounter + temperatureIntervalTime; } if (getPatientId != "No record found") { pRead.PatientId = Int32.Parse(getPatientId); pRead.PulseRate = Int32.Parse(data[0]); pRead.BreathingRate = Int32.Parse(data[1]); pRead.Systolic = Int32.Parse(data[2]); pRead.Diastolic = Int32.Parse(data[3]); pRead.Temperature = float.Parse(data[4]); pRead.DateTime = DateTime.Now.ToString(); pReadHnd.addPatientReading(dbConn.getConn(), pRead); } } catch (Exception ex) { Console.WriteLine("DID NOT RECEIVE ANY DETECTION OF THE READING : " + ex); run_Monitor.Stop(); } if (counter == 5) { counter = 0; pulseRateCounter = 0; bloodPressureCounter = 0; breathingRateCounter = 0; temperatureCounter = 0; } else { counter++; } realCounter++; }
//Display realtime data of different modules in line graph format public void displayGraph(string module, bool reset, string condition) { DbConnector dbConn = new DbConnector(); dbConn.connect(); PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); int maxReading = 0; float maxReadingT = 0; int counter = 0; //Set default value to variables var chart = chart1.ChartAreas[0]; var chartChosen = chart1; var chartColor = Color.Silver; double xMin = 0.0; double xMax = 10.0; double yMin = 0.0; double yMax = 20.0; double xInt = 5; double yInt = 5; switch (module) { case "Pulse Rate": chart = chart1.ChartAreas[0]; chartChosen = chart1; if ((label1.Text).ToString() != "No record found") { maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", (label1.Text).ToString())); } break; case "Breathing Rate": chart = chart2.ChartAreas[0]; chartChosen = chart2; if ((label1.Text).ToString() != "No record found") { maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMax", (label1.Text).ToString())); } break; case "Blood Pressure": chart = chart3.ChartAreas[0]; chartChosen = chart3; if ((label1.Text).ToString() != "No record found") { maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMax", (label1.Text).ToString())); } break; case "Temperature": chart = chart4.ChartAreas[0]; chartChosen = chart4; if ((label1.Text).ToString() != "No record found") { maxReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMax", (label1.Text).ToString())); } break; } if (condition == "Init") { chartColor = Color.Silver; } else if (condition == "Normal") { chartColor = Color.FromArgb(8, 255, 86); } else if (condition == "Risky") { chartColor = Color.FromArgb(255, 214, 8); } else if (condition == "Critical") { chartColor = Color.FromArgb(255, 8, 8); } if (reset == false) { chart.AxisX.IntervalType = DateTimeIntervalType.Number; chart.AxisX.LabelStyle.Format = ""; chart.AxisY.LabelStyle.Format = ""; chart.AxisY.LabelStyle.IsEndLabelVisible = true; chart.AxisX.Minimum = xMin; chart.AxisX.Maximum = xMax; chart.AxisY.Minimum = yMin; chart.AxisY.Maximum = yMax; chart.AxisX.Interval = xInt; chart.AxisY.Interval = yInt; chartChosen.Series.Add(module); chartChosen.Series[module].ChartType = SeriesChartType.Line; chartChosen.Series[module].BorderWidth = 3; chartChosen.Series[module].Color = chartColor; chartChosen.Series[module].Points.AddXY(1, 10); chartChosen.Series[module].Points.AddXY(10, 10); } else if (reset == true && condition == "Init") { while (chartChosen.Series.Count > 0) { chartChosen.Series.RemoveAt(0); } } else if (reset == true && condition != "Init") { while (chartChosen.Series.Count > 0) { chartChosen.Series.RemoveAt(0); } chart.AxisX.IntervalType = DateTimeIntervalType.Number; chart.AxisX.LabelStyle.Format = ""; chart.AxisY.LabelStyle.Format = ""; chart.AxisY.LabelStyle.IsEndLabelVisible = true; if (module == "Temperature") { //Minimum Value chart.AxisX.Minimum = 0; chart.AxisY.Minimum = 0; //Maximum Value chart.AxisX.Maximum = double.NaN; chart.AxisY.Maximum = maxReadingT + 20; } else { //Minimum Value chart.AxisX.Minimum = 0; chart.AxisY.Minimum = 0; //Maximum Value chart.AxisX.Maximum = double.NaN; chart.AxisY.Maximum = maxReading + 20; } chart.AxisX.Interval = 1; chart.AxisY.Interval = 1; chart.AxisX.IsMarginVisible = false; chartChosen.Series.Add(module); chartChosen.Series[module].ChartType = SeriesChartType.Line; chartChosen.Series[module].BorderWidth = 3; chartChosen.Series[module].Color = chartColor; for (int x = 0; x < realCounter; x++) { chartChosen.Series[module].Points.AddXY(x, readingsList[x]); chartChosen.Series[module].Points.AddXY(x + 0.5, 0); if (x > 10) { zoomPosition = realCounter - 10; chart.AxisX.ScaleView.Zoom(zoomPosition, realCounter); } else { chart.AxisX.ScaleView.Zoom(1, 11); } } } }
public void getData(string[] allData) { passData = allData; label5.Text = allData[0]; label6.Text = allData[1]; label7.Text = allData[2]; label8.Text = allData[3]; label9.Text = allData[4]; DbConnector dbConn = new DbConnector(); dbConn.connect(); ModuleReadingsHandler mReadingsHnd = new ModuleReadingsHandler(); //Table Section if(allData[4] == "Pulse Rate" || allData[4] == "Breathing Rate") { dataGridView1.DataSource = mReadingsHnd.listModules(dbConn.getConn(), Int32.Parse(allData[0]), allData[4]); dataGridView1.Columns[0].HeaderText = "NO."; dataGridView1.Columns[17].HeaderText = "MINIMUM READING"; dataGridView1.Columns[18].HeaderText = "MAXIMUM READING"; dataGridView1.Columns[19].HeaderText = "TIME INTERVAL (SECOND(S))"; dataGridView1.Columns[20].HeaderText = "LAST MODIFIED"; dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[17].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[18].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[19].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[20].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns.Remove("PatientId"); dataGridView1.Columns.Remove("MinPulse"); dataGridView1.Columns.Remove("MaxPulse"); dataGridView1.Columns.Remove("PulseIntTime"); dataGridView1.Columns.Remove("MinBreath"); dataGridView1.Columns.Remove("MaxBreath"); dataGridView1.Columns.Remove("BreathIntTime"); dataGridView1.Columns.Remove("MinSystolic"); dataGridView1.Columns.Remove("MaxSystolic"); dataGridView1.Columns.Remove("MinDiastolic"); dataGridView1.Columns.Remove("MaxDiastolic"); dataGridView1.Columns.Remove("PressureIntTime"); dataGridView1.Columns.Remove("MinTemp"); dataGridView1.Columns.Remove("MaxTemp"); dataGridView1.Columns.Remove("TempIntTime"); dataGridView1.Columns.Remove("Selected"); dataGridView1.Columns.Remove("BRModifiedTime"); dataGridView1.Columns.Remove("BPModifiedTime"); dataGridView1.Columns.Remove("TempModifiedTime"); } if (allData[4] == "Blood Pressure") { dataGridView1.DataSource = mReadingsHnd.listModules(dbConn.getConn(), Int32.Parse(allData[0]), allData[4]); dataGridView1.Columns[0].HeaderText = "NO."; dataGridView1.Columns[8].HeaderText = "MINIMUM READING (SYSTOLIC)"; dataGridView1.Columns[9].HeaderText = "MAXIMUM READING (SYSTOLIC)"; dataGridView1.Columns[10].HeaderText = "MINIMUM READING (DIASTOLIC)"; dataGridView1.Columns[11].HeaderText = "MAXIMUM READING (DIASTOLIC)"; dataGridView1.Columns[12].HeaderText = "TIME INTERVAL (SECOND(S))"; dataGridView1.Columns[22].HeaderText = "LAST MODIFIED"; dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[8].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[9].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[10].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[11].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[12].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[22].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns.Remove("PatientId"); dataGridView1.Columns.Remove("MinPulse"); dataGridView1.Columns.Remove("MaxPulse"); dataGridView1.Columns.Remove("PulseIntTime"); dataGridView1.Columns.Remove("MinBreath"); dataGridView1.Columns.Remove("MaxBreath"); dataGridView1.Columns.Remove("BreathIntTime"); dataGridView1.Columns.Remove("MinTemp"); dataGridView1.Columns.Remove("MaxTemp"); dataGridView1.Columns.Remove("TempIntTime"); dataGridView1.Columns.Remove("Selected"); dataGridView1.Columns.Remove("BothMin"); dataGridView1.Columns.Remove("BothMax"); dataGridView1.Columns.Remove("SelectedNum"); dataGridView1.Columns.Remove("BRModifiedTime"); dataGridView1.Columns.Remove("PRModifiedTime"); dataGridView1.Columns.Remove("TempModifiedTime"); } if (allData[4] == "Temperature") { dataGridView1.DataSource = mReadingsHnd.listModules(dbConn.getConn(), Int32.Parse(allData[0]), allData[4]); dataGridView1.Columns[0].HeaderText = "NO."; dataGridView1.Columns[13].HeaderText = "MINIMUM READING"; dataGridView1.Columns[14].HeaderText = "MAXIMUM READING"; dataGridView1.Columns[15].HeaderText = "TIME INTERVAL (SECOND(S))"; dataGridView1.Columns[23].HeaderText = "LAST MODIFIED"; dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[13].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[14].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[15].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[23].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns.Remove("PatientId"); dataGridView1.Columns.Remove("MinPulse"); dataGridView1.Columns.Remove("MaxPulse"); dataGridView1.Columns.Remove("PulseIntTime"); dataGridView1.Columns.Remove("MinBreath"); dataGridView1.Columns.Remove("MaxBreath"); dataGridView1.Columns.Remove("BreathIntTime"); dataGridView1.Columns.Remove("MinSystolic"); dataGridView1.Columns.Remove("MaxSystolic"); dataGridView1.Columns.Remove("MinDiastolic"); dataGridView1.Columns.Remove("MaxDiastolic"); dataGridView1.Columns.Remove("PressureIntTime"); dataGridView1.Columns.Remove("BothMin"); dataGridView1.Columns.Remove("BothMax"); dataGridView1.Columns.Remove("SelectedNum"); dataGridView1.Columns.Remove("Selected"); dataGridView1.Columns.Remove("BRModifiedTime"); dataGridView1.Columns.Remove("BPModifiedTime"); dataGridView1.Columns.Remove("PRModifiedTime"); } //Graph Section if (allData[4] != "Blood Pressure") { int xBlockSize = 8; int yBlockSize = 10; chart1.Visible = true; chart2.Visible = false; PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); string what = ""; int minReading = 0; int maxReading = 0; float minReadingT = 0; float maxReadingT = 0; int counter = 0; var chart = chart1.ChartAreas[0]; int timeInterval = 1; int readingsInterval = 1; int startOffset = -2; int endOffset = 2; if (allData[4] == "Pulse Rate") { what = "pulseRate"; minReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", allData[0].ToString())); maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", allData[0].ToString())); } else if(allData[4] == "Breathing Rate") { what = "breathingRate"; minReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMin", allData[0].ToString())); maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMax", allData[0].ToString())); } else if(allData[4] == "Temperature") { what = "temperature"; minReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMin", allData[0].ToString())); maxReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMax", allData[0].ToString())); } foreach (var Txt in pReadingsHnd.getReadings(dbConn.getConn(), Int32.Parse(allData[0]), what)) { CustomLabel dateTimeLabel = new CustomLabel(startOffset, endOffset, (Txt.DateTime).ToString(), 0, LabelMarkStyle.None); if(what == "temperature") { chart1.Series["Module Readings"].Points.AddXY(counter, float.Parse((Txt.FloatRate).ToString())); } else { chart1.Series["Module Readings"].Points.AddXY(counter, Int32.Parse((Txt.IntRate).ToString())); } chart.AxisX.CustomLabels.Add(dateTimeLabel); startOffset = startOffset + 1; endOffset = endOffset + 1; counter++; } chart1.Series["Module Readings"].IsValueShownAsLabel = true; chart.AxisX.LabelStyle.Angle = -45; chart.AxisY.Title = label9.Text; chart.AxisX.Title = "Date and Time"; if (allData[4] == "Temperature") { //Minimum Value chart1.Series["Minimum"].Points.AddXY(0, minReadingT); chart1.Series["Minimum"].Points.AddXY(counter, minReadingT); //Maximum Value chart1.Series["Maximum"].Points.AddXY(0, maxReadingT); chart1.Series["Maximum"].Points.AddXY(counter, maxReadingT); } else { //Minimum Value chart1.Series["Minimum"].Points.AddXY(0, minReading); chart1.Series["Minimum"].Points.AddXY(counter, minReading); //Maximum Value chart1.Series["Maximum"].Points.AddXY(0, maxReading); chart1.Series["Maximum"].Points.AddXY(counter, maxReading); } //Set view range chart.AxisX.Minimum = 0; //chart.AxisX.Maximum = double.NaN; chart.AxisY.Minimum = 0; //chart.AxisY.Maximum = double.NaN; chart.AxisX.Interval = timeInterval; chart.AxisY.Interval = readingsInterval; //Enable autoscroll chart.CursorX.AutoScroll = true; chart.CursorY.AutoScroll = true; //Zoom to [0, xBlockSize] chart.AxisX.ScaleView.Zoomable = true; chart.AxisX.ScaleView.SizeType = DateTimeIntervalType.Number; chart.AxisY.ScaleView.Zoomable = true; chart.AxisY.ScaleView.SizeType = DateTimeIntervalType.Number; int position = 1; int size = xBlockSize; int ysize = yBlockSize; chart.AxisX.ScaleView.Zoom(position, size); chart.AxisY.ScaleView.Zoom(0, ysize); //Disable zoom-reset button (only scrollbar's arrows are available) chart.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; chart.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; // set scrollbar small change to blockSize (e.g. 100) chart.AxisX.ScaleView.SmallScrollSize = xBlockSize; chart.AxisY.ScaleView.SmallScrollSize = yBlockSize; } else { chart1.Visible = false; chart2.Visible = true; int xBlockSize = 8; int yBlockSize = 10; string what = "bloodPressure"; PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); int counter = 0; int startOffset = -2; int endOffset = 2; var chart = chart2.ChartAreas[0]; int timeInterval = 1; int readingsInterval = 1; int minReadingS = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMin", allData[0].ToString())); int maxReadingS = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMax", allData[0].ToString())); int minReadingD = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", allData[0].ToString())); int maxReadingD = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", allData[0].ToString())); foreach (var Txt in pReadingsHnd.getReadings(dbConn.getConn(), Int32.Parse(allData[0]), what)) { CustomLabel dateTimeLabel = new CustomLabel(startOffset, endOffset, (Txt.DateTime).ToString(), 0, LabelMarkStyle.None); chart2.Series["Systolic"].Points.AddXY(counter, Int32.Parse((Txt.IntRate).ToString())); chart2.Series["Diastolic"].Points.AddXY(counter, Int32.Parse((Txt.IntRate2).ToString())); chart.AxisX.CustomLabels.Add(dateTimeLabel); startOffset = startOffset + 1; endOffset = endOffset + 1; counter++; } chart2.Series["Systolic"].IsValueShownAsLabel = true; chart2.Series["Diastolic"].IsValueShownAsLabel = true; chart.AxisX.LabelStyle.Angle = -45; chart.AxisY.Title = "Blood Pressure Readings"; chart.AxisX.Title = "Date and Time"; //Minimum Value chart2.Series["Minimum (Systolic)"].Points.AddXY(0, minReadingS); chart2.Series["Minimum (Systolic)"].Points.AddXY(counter, minReadingS); chart2.Series["Minimum (Diastolic)"].Points.AddXY(0, minReadingD); chart2.Series["Minimum (Diastolic)"].Points.AddXY(counter, minReadingD); //Maximum Value chart2.Series["Maximum (Systolic)"].Points.AddXY(0, maxReadingS); chart2.Series["Maximum (Systolic)"].Points.AddXY(counter, maxReadingS); chart2.Series["Maximum (Diastolic)"].Points.AddXY(0, maxReadingD); chart2.Series["Maximum (Diastolic)"].Points.AddXY(counter, maxReadingD); //Set view range chart.AxisX.Minimum = 0; //chart.AxisX.Maximum = double.NaN; chart.AxisY.Minimum = 0; //chart.AxisY.Maximum = double.NaN; chart.AxisX.Interval = timeInterval; chart.AxisY.Interval = readingsInterval; //Enable autoscroll chart.CursorX.AutoScroll = true; chart.CursorY.AutoScroll = true; //Zoom to [0, xBlockSize] chart.AxisX.ScaleView.Zoomable = true; chart.AxisX.ScaleView.SizeType = DateTimeIntervalType.Number; chart.AxisY.ScaleView.Zoomable = true; chart.AxisY.ScaleView.SizeType = DateTimeIntervalType.Number; int position = 1; int size = xBlockSize; int ysize = yBlockSize; chart.AxisX.ScaleView.Zoom(position, size); chart.AxisY.ScaleView.Zoom(0, ysize); //Disable zoom-reset button (only scrollbar's arrows are available) chart.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; chart.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; // set scrollbar small change to blockSize (e.g. 100) chart.AxisX.ScaleView.SmallScrollSize = xBlockSize; chart.AxisY.ScaleView.SmallScrollSize = yBlockSize; } }