private void SetUpGraphs(double SubSLD, double SupSLD) { //Setup the graphs ReflGraphing = new Graphing(string.Empty); ReflGraphing.SetGraphType(Properties.Settings.Default.ForceRQ4, true); ReflGraphing.SubSLD = SubSLD; ReflGraphing.SupSLD = SupSLD; ReflGraphing.CreateGraph(ReflGraph, "Reflectivity", "Q/Qc", "Intensity / Fresnel", AxisType.Log); ReflGraphing.LoadDatawithErrorstoGraph("Reflectivity Data", System.Drawing.Color.Black, SymbolType.Circle, 5, ReflData.Instance.GetQData, ReflData.Instance.GetReflData); RhoGraphing = new Graphing(string.Empty); RhoGraphing.SubSLD = SubSLD; RhoGraphing.SupSLD = SupSLD; RhoGraphing.UseSLD = Properties.Settings.Default.UseSLDSingleSession; RhoGraphing.SetGraphType(false, false); if (!Properties.Settings.Default.UseSLDSingleSession) { RhoGraphing.CreateGraph(RhoGraph, "Electron Density Profile", "Z", "Normalized Electron Density", AxisType.Linear); } else { RhoGraphing.CreateGraph(RhoGraph, "SLD Profile", "Z", "SLD", AxisType.Linear); } }
private void Errors_Checked(object sender, RoutedEventArgs e) { Graphing getBars = new Graphing(); List <double> bars = getBars.getBars(gData); SeriesCollection[1].Values.Add(bars[0]); SeriesCollection[2].Values.Add(bars[1]); SeriesCollection[3].Values.Add(bars[2]); SeriesCollection[4].Values.Add(bars[3]); DataContext = this; }
}//End of InitialiseGraphs private void DataRate_Checked(object sender, RoutedEventArgs e) { Graphing getPlots = new Graphing(); List <double> plots = gData.getDataRates();//getPlots.getPlots(gData); for (int x = 0; x < plots.Count; x++) { SeriesCollection[0].Values.Add(plots[x]); DataContext = this; } }
// make the default constructor private, so that no can directly create it. private GraphCollection() { m_gRhoFit = new Graphing(string.Empty); m_gReflFit = new Graphing(string.Empty); m_gMainReflectivityFit = new Graphing(string.Empty); m_gMainRhoFit = new Graphing(string.Empty); m_gReflEFit = new Graphing(string.Empty); MainReflGraph.CreateGraph(null); MainRhoGraph.CreateGraph(null); RhoGraph.CreateGraph(null); ReflGraph.CreateGraph(null); ReflEGraph.CreateGraph(null); }
private void drawGraphs() { packetRatePoints.Clear(); BackgroundWorker[] workers = { new BackgroundWorker(), new BackgroundWorker(), new BackgroundWorker() }; Packet[] packets = capture.Packets.OrderBy(pkt => pkt.TimeStamp.Ticks).ToArray(); workers[0].DoWork += delegate { packetRatePoints.Clear(); foreach (DataPoint point in Graphing.getGraphPoints(packets, Graphing.GraphType.PacketRate)) { packetRatePoints.Add(point); } Dispatcher.InvokeAsync(() => { packetRateGraph.InvalidatePlot(true); }); }; workers[0].RunWorkerAsync(); workers[1].DoWork += delegate { dataRatePoints.Clear(); foreach (DataPoint point in Graphing.getGraphPoints(packets, Graphing.GraphType.DataRate)) { dataRatePoints.Add(point); } Dispatcher.InvokeAsync(() => { dataRateGraph.InvalidatePlot(true); }); }; workers[1].RunWorkerAsync(); workers[2].DoWork += delegate { errorRatePoints.Clear(); foreach (DataPoint point in Graphing.getGraphPoints(packets, Graphing.GraphType.ErrorRate)) { errorRatePoints.Add(point); } Dispatcher.InvokeAsync(() => { errorRateGraph.InvalidatePlot(true); }); }; workers[2].RunWorkerAsync(); }
private void graphButton_Click(object sender, EventArgs e) { foreach (var building in Model.AllBuildingsLoad.BuildingsData) { if (buildingFilesBox.SelectedItem.ToString() == building.BuildingName) { selectedBuilding = building; } } var buildingVals = Graphing.loads(selectedBuilding, monthsList.SelectedItem.ToString()); graphingWindow newGraph = new graphingWindow(buildingVals, selectedBuilding.BuildingName + " " + monthsList.SelectedItem.ToString() + " Loads", 180d); newGraph.Show(); }
public Output(double velocity, double weight, double diameter, double gravity, double airDensity, double dragCoefficient, double angle) { this.velocity = velocity; this.weight = weight; this.diameter = diameter; this.gravity = gravity; this.airDensity = airDensity; this.dragCoefficient = dragCoefficient; this.angle = angle; InitializeComponent(); calculator = new Calculator(); graphing = new Graphing(); area = calculator.CalculateArea(diameter); terminalVelocity = calculator.CalculateTerminalVelocity(weight, gravity, dragCoefficient, airDensity, area); TerminalVelocity.Text = terminalVelocity.ToString(); range = calculator.CalculateRange(velocity, gravity, angle, terminalVelocity); Range.Text = range.ToString(); flightTime = calculator.CalculateTimeInFlight(velocity, angle, gravity, terminalVelocity); FlightTime.Text = flightTime.ToString(); maxMomentum = calculator.CalculateMomentum(weight, velocity); Recoil.Text = maxMomentum.ToString(); maxKineticEnergy = calculator.CalculateKineticEnergy(weight, velocity); maxPenetration = calculator.CalculatePenetration(maxKineticEnergy, area); //DrawBulletParabolaGraph(); //graphing.DrawKineticEnergyGraph(canvas, maxKineticEnergy, range, flightTime, velocity, weight, angle, gravity, dragCoefficient, terminalVelocity); graphing.DrawPenetrationGraph(canvas, maxPenetration, range, flightTime, velocity, weight, area, angle, gravity, dragCoefficient, terminalVelocity); graphing.DrawMomentumGraph(canvas2, maxMomentum, range, flightTime, velocity, weight, angle, gravity, dragCoefficient, terminalVelocity); }
private void CheckEventFunctions() { bool hasAlreadyUpdatedToday = false; foreach (EventFunctionScript eventFunction in eventFunctions) { bool isAllConditionsSatisfied = true; string eventName = eventFunction.GetEventName(); EventFunctionScript.ConditionScript[] conditions = eventFunction.GetAllConditions(); float compoundedPercent = 1.0f; bool toUseCompoundPercent = false; foreach (EventFunctionScript.ConditionScript condition in conditions) { int conditionType = condition.dropdownValue; if (conditionType == CONDITION_ATTRIBUTE) { int attributeIndex = condition.secondDropdownValue; string attributeName = listAttributes[attributeIndex]; int attributeType = condition.attrType; if (attributeType == AttributeScript.ATTRIBUTE_TYPE_DISCRETE) { string attributeValue = GetCurrentAttributeValue(attributeName); int attributeValueIndex = GetAttributeValueIndex(attributeName, attributeValue); float currentPercent = condition.discretePercents[attributeValueIndex]; if (!WillOccurWithChance(currentPercent)) { isAllConditionsSatisfied = false; break; } } else if (attributeType == AttributeScript.ATTRIBUTE_TYPE_CONTINUOUS) { toUseCompoundPercent = true; float gradient, constant; Graphing.FindLineEquation(condition.x1Val, condition.y1Percent, condition.x2Val, condition.y2Percent, out gradient, out constant); string attributeValue = GetCurrentAttributeValue(attributeName); int attributeValueNumber = Int32.Parse(attributeValue); float mxPlusC = gradient * attributeValueNumber + constant; compoundedPercent *= mxPlusC; } } } if (!WillOccurWithChance(compoundedPercent) && toUseCompoundPercent) { isAllConditionsSatisfied = false; } if (isAllConditionsSatisfied) { // Perform all actions. EventFunctionScript.ActionScript[] actions = eventFunction.GetAllActions(); foreach (EventFunctionScript.ActionScript action in actions) { int actionType = action.dropdownValue; if (actionType == ACTION_ATTRIBUTE) { int attributeIndex = action.secondDropdownValue; string attributeName = listAttributes[attributeIndex]; int attributeType = action.attrType; if (attributeType == AttributeScript.ATTRIBUTE_TYPE_CONTINUOUS) { int amountToChange = action.thirdValue; ChangeValue(attributeName, amountToChange); } else if (attributeType == AttributeScript.ATTRIBUTE_TYPE_DISCRETE) { int changeToThisValueIndex = action.thirdValue; string changeToThisValue = ((AttributeDisplay)attributeTable[attributeName]).choices[changeToThisValueIndex]; ChangeDiscreteValue(attributeName, specifiedAttributeName: changeToThisValue); } } } if (hasAlreadyUpdatedToday) { UpdateEventFunction(eventName + " : " + eventFunction.GetMessageDisplay(), true); } else { hasAlreadyUpdatedToday = true; UpdateEventFunction(eventName + " : " + eventFunction.GetMessageDisplay(), false); } } } }
public ActionResult SchoolView(string selectedDate, string schoolName) { var tday = _ren.TeachableDays.OrderByDescending(x => x.TeachableDays).Take(10); var startDay = tday.First().TeachableDays; if (!string.IsNullOrEmpty(selectedDate)) { var date = Convert.ToDateTime(selectedDate); startDay = tday.FirstOrDefault(x => x.TeachableDays == date).TeachableDays; } var tenEntryDaysBack = _ren.TeachableDays.Where(x => x.TeachableDays <= startDay).OrderByDescending(x => x.TeachableDays).Take(10).ToList().Last().TeachableDays; var principalView = _db.SchoolTeachersWithADLogins.Where(x => x.Organization_Name == schoolName && x.COURSE_TITLE != "Kindergarten" && x.COURSE_TITLE != "PS - 6th SpEd").ToList(); // select all minutes from the school the principal belongs to var pivm = new PrincipalIndexViewModel(); foreach (var item in principalView) { var mr = new MeetingReq(); var name = item.TeacherFirstName + " " + item.TeacherLastName; var sumMinutes = _db.EnteredPeMinutes.Where(x => x.InstructionTime > tenEntryDaysBack && x.InstructionTime <= startDay && x.TeacherName == name).Sum(x => x.Minutes); if (!(sumMinutes >= 200)) { continue; } mr.TeacherName = name; mr.Minutes = sumMinutes; pivm.MeetReq.Add(mr); } foreach (var item in principalView) { var nmr = new NotMeetingReq(); var name = item.TeacherFirstName + " " + item.TeacherLastName; var sumMinutes = _db.EnteredPeMinutes.Where(x => x.InstructionTime > tenEntryDaysBack && x.InstructionTime <= startDay && x.TeacherName == name).Sum(x => x.Minutes); if (!(sumMinutes < 200 || sumMinutes == null)) { continue; } nmr.TeacherName = name; nmr.Minutes = sumMinutes; if (sumMinutes == null) { nmr.Minutes = 0; } pivm.NotReq.Add(nmr); } foreach (var item in principalView) { var g = new Graphing(); var name = item.TeacherFirstName + " " + item.TeacherLastName; var sumMinutes = _db.EnteredPeMinutes.Where(x => x.InstructionTime > tenEntryDaysBack && x.InstructionTime <= startDay && x.TeacherName == name).Sum(x => x.Minutes); g.TeacherName = name; g.Minutes = sumMinutes; pivm.Graph.Add(g); } pivm.School = schoolName; pivm.Date = startDay.ToShortDateString(); pivm.DateStart = tenEntryDaysBack.ToShortDateString(); pivm.DateEnd = startDay.ToShortDateString(); pivm.MeetReq = pivm.MeetReq.ToList(); pivm.NotReq = pivm.NotReq.ToList(); pivm.Graph = pivm.Graph.ToList(); // end of the data for the graph in admin view return(View(pivm)); }
// GET: /Principal/Index public ActionResult Index(string selectedDate) { var enteredBadgeString = User.Identity.Name; var selectedPrincipal = _db.SchoolToPrincipals.FirstOrDefault(i => i.BADGE_NUM == enteredBadgeString); var selectedSchool = selectedPrincipal.ORGANIZATION_NAME; ViewBag.Name = selectedPrincipal.Principal; // Find the first day teachable day by default var startDay = _ren.TeachableDays.OrderByDescending(x => x.TeachableDays).First().TeachableDays; if (!string.IsNullOrEmpty(selectedDate)) { // Use the input variable if selected startDay = Convert.ToDateTime(selectedDate); } var tenEntryDaysBack = _ren.TeachableDays.Where(x => x.TeachableDays <= startDay).OrderByDescending(x => x.TeachableDays).Take(10).ToList().Last().TeachableDays; var principalView = _db.SchoolTeachersWithADLogins.Where(x => x.Organization_Name == selectedSchool && x.COURSE_TITLE != "Kindergarten" && x.COURSE_TITLE != "PS - 6th SpEd").ToList(); // select all minutes from the school the principal belongs to var pivm = new PrincipalIndexViewModel(); foreach (var item in principalView) { var mr = new MeetingReq(); var name = item.TeacherFirstName + " " + item.TeacherLastName; var sumMinutes = _db.EnteredPeMinutes.Where(x => x.InstructionTime > tenEntryDaysBack && x.InstructionTime <= startDay && x.TeacherName == name).Sum(x => x.Minutes); if (!(sumMinutes >= 200)) { continue; } mr.TeacherName = name; mr.Minutes = sumMinutes; pivm.MeetReq.Add(mr); } foreach (var item in principalView) { var nmr = new NotMeetingReq(); var name = item.TeacherFirstName + " " + item.TeacherLastName; var sumMinutes = _db.EnteredPeMinutes.Where(x => x.InstructionTime > tenEntryDaysBack && x.InstructionTime <= startDay && x.TeacherName == name).Sum(x => x.Minutes); if (!(sumMinutes < 200 || sumMinutes == null)) { continue; } nmr.TeacherName = name; nmr.Minutes = sumMinutes; if (sumMinutes == null) { nmr.Minutes = 0; } pivm.NotReq.Add(nmr); } foreach (var item in principalView) { var g = new Graphing(); var name = item.TeacherFirstName + " " + item.TeacherLastName; var sumMinutes = _db.EnteredPeMinutes.Where(x => x.InstructionTime > tenEntryDaysBack && x.InstructionTime <= startDay && x.TeacherName == name).Sum(x => x.Minutes); g.TeacherName = name; g.Minutes = sumMinutes; pivm.Graph.Add(g); } pivm.Date = startDay.ToShortDateString(); pivm.DateStart = tenEntryDaysBack.ToShortDateString(); pivm.DateEnd = startDay.ToShortDateString(); pivm.MeetReq = pivm.MeetReq.ToList(); pivm.NotReq = pivm.NotReq.ToList(); pivm.Graph = pivm.Graph.ToList(); // end of the data for the graph in admin view return(View(pivm)); }