/// <summary> /// function to obtain the number of hands joined, and the duration /// </summary> /// <returns>the graph</returns> /// <author>Alban Descottes 2018</author> public static List <IGraph> getHandStatistics() { List <IGraph> list = new List <IGraph>(); var chart1 = new CartesianGraph(); chart1.title = "Hands joined counter"; chart1.subTitle = Tools.ChooseTheCorrectUnitTime(); // if there is no hands joined during all the record, it creates just a empty chart if (!Tools.addSeriesToCharts(chart1, new ColumnSeries(), "Hand joined", handsjoinedCounter, "Total hands joined: ", false)) { list.Add(Tools.createEmptyGraph("Hands were not joined")); } // else it adds the hands joined counter first and this about the duration after else { list.Add(chart1); var chart2 = new CartesianGraph(); chart2.title = "Hands joined duration"; chart2.subTitle = Tools.ChooseTheCorrectUnitTime(); if (Tools.addSeriesToCharts(chart2, new ColumnSeries(), "Hand joined", handsjoined, "Total time hands joined: ", false)) { list.Add(chart2); } } return(list); }
/// <summary> /// Method for obtaining charts of the body agitation /// </summary> /// <returns>a list of IGraph of agitation charts</returns> /// <remarks>Add by Florian BECHU: Summer 2016</remarks> public static List <IGraph> getAgitationStats() { List <IGraph> list = new List <IGraph>(); bool hleft = false, hright = false, sleft = false, sright = false, kleft = false, kright = false; /***** HIPS *****/ if (agitNotAgit.ContainsKey(JointType.HipCenter)) { var chart = new CartesianGraph(); chart.title = "Hips agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Hips", agitNotAgit[JointType.HipCenter], "Total Hips agitation: ", false)) { list.Add(Tools.createEmptyGraph("Hips were not agitated")); } else { list.Add(chart); } } else { list.Add(Tools.createEmptyGraph("Hips were not caught")); } /***** HANDS *****/ if (!agitNotAgit.ContainsKey(JointType.HandLeft)) // if the left hand wasn't catched { list.Add(Tools.createEmptyGraph("Left hand wasn't caught")); } else { hleft = true; } if (!agitNotAgit.ContainsKey(JointType.HandRight)) // if the right hand wasn't catched { list.Add(Tools.createEmptyGraph("Right hand wasn't caught")); } else { hright = true; } if (hleft && hright) { CartesianGraph cl = new CartesianGraph(); cl.title = "Hands agitation"; cl.subTitle = "Time unit: " + Tools.ChooseTheCorrectUnitTime(); cl.XTitle = "Time"; cl.YTitle = "Value"; bool leftChart = Tools.addSeriesToCharts(cl, new ColumnSeries(), "Left Hand", agitNotAgit[JointType.HandLeft], "Total Left Hand Agitation: ", true); bool rightChart = Tools.addSeriesToCharts(cl, new ColumnSeries(), "Right Hand", agitNotAgit[JointType.HandRight], "Total Right Hand Agitation: ", true); if (!leftChart && !rightChart) { list.Add(Tools.createEmptyGraph("Hands were not agitated")); } else { list.Add(cl); } if (!leftChart) { list.Add(Tools.createEmptyGraph("Left hand wasn't agitated")); } else { var chart = new CartesianGraph(); chart.title = "Left Hand agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Left hand", agitNotAgit[JointType.HandLeft], "Total Left Hand Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Left hand wasn't agitated")); } else { list.Add(chart); } } if (!rightChart) { list.Add(Tools.createEmptyGraph("Right hand wasn't agitated")); } else { var chart = new CartesianGraph(); chart.title = "Right Hand agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Right hand", agitNotAgit[JointType.HandRight], "Total Right Hand Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Right hand wasn't agitated")); } else { list.Add(chart); } } } else if (hleft) { var chart = new CartesianGraph(); chart.title = "Left Hand agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Left hand", agitNotAgit[JointType.HandLeft], "Total Left Hand Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Left hand wasn't agitated")); } else { list.Add(chart); } } else if (hright) { var chart = new CartesianGraph(); chart.title = "Right Hand agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Right hand", agitNotAgit[JointType.HandRight], "Total Right Hand Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Right hand wasn't agitated")); } else { list.Add(chart); } } /***** SHOULDERS *****/ if (!agitNotAgit.ContainsKey(JointType.ShoulderLeft)) // if the left shoulder wasn't catched { list.Add(Tools.createEmptyGraph("Left shoulder wasn't caught")); } else { sleft = true; } if (!agitNotAgit.ContainsKey(JointType.ShoulderRight)) // if the right shoulder wasn't catched { list.Add(Tools.createEmptyGraph("Right shoulder wasn't caught")); } else { sright = true; } if (sleft && sright) { CartesianGraph cl = new CartesianGraph(); cl.title = "Shoulders agitation"; cl.subTitle = "Time unit: " + Tools.ChooseTheCorrectUnitTime(); bool leftChart = Tools.addSeriesToCharts(cl, new ColumnSeries(), "Left Shoulder", agitNotAgit[JointType.ShoulderLeft], "Total Left Shoulder Agitation: ", true); bool rightChart = Tools.addSeriesToCharts(cl, new ColumnSeries(), "Right Shoulder", agitNotAgit[JointType.ShoulderRight], "Total Right Shoulder Agitation: ", true); if (!leftChart && !rightChart) { list.Add(Tools.createEmptyGraph("Shoulders were not agitated")); } else { list.Add(cl); } if (!leftChart) { list.Add(Tools.createEmptyGraph("Left shoulder wasn't agitated")); } else { var chart = new CartesianGraph(); chart.title = "Left Shoulder agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Left shoulder", agitNotAgit[JointType.ShoulderLeft], "Total Left Shoulder Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Left shoulder wasn't agitated")); } else { list.Add(chart); } } if (!rightChart) { list.Add(Tools.createEmptyGraph("Right shoulder wasn't agitated")); } else { var chart = new CartesianGraph(); chart.title = "Right Shoulder agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Right Shoulder", agitNotAgit[JointType.ShoulderRight], "Total Right Shoulder Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Right shoulder wasn't agitated")); } else { list.Add(chart); } } } else if (sleft) { var chart = new CartesianGraph(); chart.title = "Left Shoulder agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Left shoulder", agitNotAgit[JointType.ShoulderLeft], "Total Left Shoulder Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Left shoulder wasn't agitated")); } else { list.Add(chart); } } else if (sright) { var chart = new CartesianGraph(); chart.title = "Right Shoulder agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Right Shoulder", agitNotAgit[JointType.ShoulderRight], "Total Right Shoulder Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Right shoulder wasn't agitated")); } else { list.Add(chart); } } /***** KNEES *****/ if (!agitNotAgit.ContainsKey(JointType.KneeLeft)) // if the left knee wasn't catched { list.Add(Tools.createEmptyGraph("Left knee wasn't caught")); } else { kleft = true; } if (!agitNotAgit.ContainsKey(JointType.KneeRight)) // if the right knee wasn't catched { list.Add(Tools.createEmptyGraph("Right knee wasn't caught")); } else { kright = true; } if (kleft && kright) { CartesianGraph cl = new CartesianGraph(); cl.title = "Knees agitation"; cl.subTitle = "Time unit: " + Tools.ChooseTheCorrectUnitTime(); bool leftChart = Tools.addSeriesToCharts(cl, new ColumnSeries(), "Left Knee", agitNotAgit[JointType.KneeLeft], "Total Left Knee Agitation: ", true); bool rightChart = Tools.addSeriesToCharts(cl, new ColumnSeries(), "Right Knee", agitNotAgit[JointType.KneeRight], "Total Right Knee Agitation: ", true); if (!leftChart && !rightChart) { list.Add(Tools.createEmptyGraph("Knees were not agitated")); } else { list.Add(cl); } if (!leftChart) { list.Add(Tools.createEmptyGraph("Left knee wasn't agitated")); } else { var chart = new CartesianGraph(); chart.title = "Left Knee agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Left Knee", agitNotAgit[JointType.KneeLeft], "Total Left Knee Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Left knee wasn't agitated")); } else { list.Add(chart); } } if (!rightChart) { list.Add(Tools.createEmptyGraph("Right knee wasn't agitated")); } else { var chart = new CartesianGraph(); chart.title = "Right Knee agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Right Knee", agitNotAgit[JointType.KneeRight], "Total Right Knee Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Right knee wasn't agitated")); } else { list.Add(chart); } } } else if (kleft) { var chart = new CartesianGraph(); chart.title = "Left Knee agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Left Knee", agitNotAgit[JointType.KneeLeft], "Total Left Knee Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Left knee wasn't agitated")); } else { list.Add(chart); } } else if (kright) { var chart = new CartesianGraph(); chart.title = "Right Knee agitation"; chart.subTitle = Tools.ChooseTheCorrectUnitTime(); if (!Tools.addSeriesToCharts(chart, new ColumnSeries(), "Right Knee", agitNotAgit[JointType.KneeRight], "Total Right Knee Agitation: ", false)) { list.Add(Tools.createEmptyGraph("Right knee wasn't agitated")); } else { list.Add(chart); } } return(list); }