/// <summary> /// Methode gibt eine Liste von PlotDaten zurück welche aus der Liste aller Protokolle erstellt wurde. /// </summary> public List <PlotData> getPlotDataList() { List <PlotData> plotDataList = new List <PlotData>(); foreach (DataVisProtocol protocol in dataVisProtocolList) { PlotData plotData = new PlotData(); plotData.Name = protocol.name; plotData._id = protocol._id; TextAsset csvAsset = new TextAsset(protocol.dataset.ToString()); Debug.LogError(csvAsset); plotData.CsvAsset = csvAsset; if (!(protocol.colors is null)) { plotData.CategorieColors = protocol.colors.colorList; plotData.CategorieColumn = protocol.colors.column; } if (!(protocol.selection is null)) { plotData.Selection = protocol.selection; } if (!(protocol.classification)) { plotData.Classification = protocol.classification; } plotDataList.Add(plotData); } return(plotDataList); }
private void UpdateProcess() { if (this.process != null) { CurveFamilyF curves = this.psychrometricChartModel.GetProcessStates(); if (curves != null) { // display the process curve(s) on the plot this.plotCtrl.Graph.ShowOtherData = true; PlotData otherData = this.ConvertToPlotData(curves); this.plotCtrl.Graph.OtherData = otherData; } PointF siPoint = this.psychrometricChartModel.GetProcessInputState(); PointF currentInPoint = this.ConvertFromSI(siPoint); this.process.Input.Variables = currentInPoint; siPoint = this.psychrometricChartModel.GetProcessOutputState(); PointF currentOutPoint = this.ConvertFromSI(siPoint); this.process.Output.Variables = currentOutPoint; this.plotCtrl.Graph.ShowCurrentCoordinate(this.process.ToString()); // PointF pageCurrentInPoint = this.plotCtrl.Graph.ConvertFromDomainToPage(currentInPoint); this.inStateCtrl.Location = new Point((int)(pageCurrentInPoint.X - StateControl.RADIUS + 1), (int)(pageCurrentInPoint.Y - StateControl.RADIUS)); PointF pageCurrentOutPoint = this.plotCtrl.Graph.ConvertFromDomainToPage(currentOutPoint); this.outStateCtrl.Location = new Point((int)(pageCurrentOutPoint.X - StateControl.RADIUS + 1), (int)(pageCurrentOutPoint.Y - StateControl.RADIUS)); PointF[] points = new PointF[] { currentInPoint, currentOutPoint }; this.plotCtrl.Graph.Points = points; this.plotCtrl.Graph.ShowPoints = true; this.plotCtrl.RefreshPlot(); } }
public string Plot(IPlotParameters plotParameters) { var parameters = (SpectralPlotParameters)plotParameters; var xyPoints = new List <Point>(); foreach (var wv in parameters.Wavelengths) { switch (parameters.SpectralPlotType) { case SpectralPlotType.Mua: xyPoints.Add(new Point(wv, parameters.Tissue.GetMua(wv))); break; case SpectralPlotType.Musp: xyPoints.Add(new Point(wv, parameters.Tissue.GetMusp(wv))); break; } } var plotData = new PlotData { Data = xyPoints, Label = parameters.TissueType }; var plot = new Plots { Id = "Spectral" + parameters.SpectralPlotType, PlotList = new List <PlotDataJson>() }; plot.PlotList.Add(new PlotDataJson { Data = plotData.Data.Select(item => new List <double> { item.X, item.Y }).ToList(), Label = parameters.TissueType + " " + parameters.PlotName }); return(JsonConvert.SerializeObject(plot)); }
protected void OnPlotChanged(AxisVariable ox, AxisVariable oy, PlotData data) { if (PlotChanged != null) { PlotChanged(ox, oy, data); } }
public void Exporter_ShouldMatchFileLengthSize_WhenZingChartIsExportedToAFile() { string expected = @"{""graphset"":[{""type"":""pie"",""plot"":{""tooltip"":{""text"":""%t""},""value-box"":{""font-size"":0,""placement"":""in"",""text"":""%t"",""offsetR"":""30%"",""rules"":[{""rule"":""%v === 0"",""text"":""""}]}},""title"":{""text"":""HELLO.CLA"",""font-size"":10},""series"":[{""values"":[100],""text"":""Developer 1""}]}]}"; int expectedLength = expected.Length; var javaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); Exporter exporter = new Exporter(); List <PlotData> plots = new List <PlotData>(); PlotData.Plot plot = new PlotData.Plot(100, "Developer 1"); PlotData plotData = new PlotData(); plotData.title = "HELLO.CLA"; plotData.plots.Add(plot); plots.Add(plotData); string path = ConfigurationManager.AppSettings["unitTest_outputFolder"].ToString() + "export.json"; exporter.asZingChart(path, plots); FileInfo f = new FileInfo(path); long actualLength = f.Length - 2; Assert.AreEqual(expectedLength, actualLength); }
static void CycloidTiral() { var brach = new Cycloid(4); PlotData p = new PlotData(brach, 0, 4 * Math.PI, .1); p.AddParametricTrial("x", "y", "phi"); p.Graph(); }
public static void ClassInitialize(TestContext context) { data = new PlotData() { Name = "equal", XParameter = "x", YParameter = "y", XAxisTitle = "x", YAxisTitle = "y" }; dataEqual = new PlotData() { Name = "equal", XParameter = "x", YParameter = "y", XAxisTitle = "x", YAxisTitle = "y" }; dataEqual2 = new PlotData() { Name = "equal", XParameter = "x", YParameter = "y", XAxisTitle = "x", YAxisTitle = "y" }; dataNotEqual = new PlotData() { Name = "equal", XParameter = "x", YParameter = "y", XAxisTitle = "x", YAxisTitle = "y" }; List <double> dataPoints = new List <double>(); for (int i = 0; i < 10; i++) { dataPoints.Add(i); } data.DataPoints.Add("x", dataPoints.ToList()); data.DataPoints.Add("y", dataPoints.ToList()); dataEqual.DataPoints.Add("x", dataPoints.ToList()); dataEqual.DataPoints.Add("y", dataPoints.ToList()); dataEqual2.DataPoints.Add("x", dataPoints.ToList()); dataEqual2.DataPoints.Add("y", dataPoints.ToList()); dataPoints.Add(1); // this is the difference dataNotEqual.DataPoints.Add("x", dataPoints.ToList()); dataNotEqual.DataPoints.Add("y", dataPoints.ToList()); }
private void UserControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) { if (args.NewValue != null && args.NewValue is PlotData data && data != this.plotData) { this.plotData = args.NewValue as PlotData; UpdateChart(); } }
private void psychrometricChartModel_HumidityChartChanged(PlotVariable ox, PlotVariable oy, HumidityChartData data) { this.xPlotVariable = ox; this.yPlotVariable = oy; AxisVariable x = UI.ConvertToAxisVariable(ox); AxisVariable y = UI.ConvertToAxisVariable(oy); PlotData pd = this.ConvertToPlotData(data); this.OnPlotChanged(x, y, pd); }
public void SowingSeed(Vector3Int pos, int cropID) { string tileName = PlotData.GetCropTileName(cropID, 0); GameObject cropObject = creatCropObject(); changeCropObjectSprite(cropObject, tileName); changeCropObjectPosTo(cropObject, pos); setCropObjectCollider(cropObject, cropID); FarmDataManager._Instance.AddSowingPlotData(pos, cropID, cropObject.GetInstanceID());//加数据 return; }
private void OnValuesChanged(object sender, AddingNewItemEventArgs addingNewItemEventArgs) { if (_data.Points.Count > ((Cache)sender).MaxCount) { _data.Points.RemoveAt(0); } var newPoint = addingNewItemEventArgs.NewItem as CacheItem; _data.Points.Add(new DataPoint(DateTimeAxis.ToDouble(newPoint.Stamp), newPoint.Value)); PlotData.InvalidatePlot(true); }
public void verify_constructor_sets_complex_properties_correctly() { IDataPoint[] dataPoints = new ComplexDataPoint[2] { new ComplexDataPoint(0.1, new Complex(0.2, 0.3)), new ComplexDataPoint(0.4, new Complex(0.5, 0.6)) }; var plotData = new PlotData(dataPoints, "title"); Assert.AreEqual(plotData.Points[0], dataPoints[0]); Assert.AreEqual(plotData.Points[1], dataPoints[1]); Assert.AreEqual(plotData.Title, "title"); }
private PlotData ConvertToPlotData(HumidityChartData hcData) { PlotData plotData = new PlotData(); plotData.Name = hcData.Name; CurveFamilyF[] oldFamilies = hcData.CurveFamilies; CurveFamily[] newFamilies = UI.ConvertCurveFamilies(oldFamilies, this.xPlotVariable.Variable.Type, this.yPlotVariable.Variable.Type); // add the new falilies to the PlotData plotData.CurveFamilies = newFamilies; return(plotData); }
//Handles harvesting plots and adding ingredients to inventory void Harvest(GardenPlot plot) { PlotData data = plots[plot.gameObject.name]; Inventory.Add(rl.ingredients[data.type], 1, true); SpriteRenderer[] sr = plot.gameObject.GetComponentsInChildren <SpriteRenderer>(); for (int i = 1; i < 4; i++) { sr[i].sprite = null; } plots.Remove(plot.gameObject.name); }
public void verify_constructor_sets_real_properties_correctly() { IDataPoint[] dataPoints = new DoubleDataPoint[2] { new DoubleDataPoint(0.1, 0.2), new DoubleDataPoint(0.3, 0.4) }; var plotData = new PlotData(dataPoints, "title"); Assert.AreEqual(plotData.Points[0], dataPoints[0]); Assert.AreEqual(plotData.Points[1], dataPoints[1]); Assert.AreEqual(plotData.Title, "title"); }
/// <summary> /// Methode zeigt den ersten Plot des im Clipboard selektierten Protokolls an. Anschließend werden alle Anzeigen befüllt. /// Wird im ScatterplotDropDown UnityEvent aufgerufen. /// </summary> public void loadSelectedScatterPlot() { int value = plotClipBoardController.getScatterPlotValue(); PlotData data = plotClipBoardController.getPlotDataByDropwDownValue(value); string url = "localhost:4242/DataVis/protocols/" + data._id + "/commentsDownload"; fileLoader.getFileFromUrl(url); whiteboardValueLoader.setClassification(data.Classification); whiteboardValueLoader.printValues(); visualizer.createInitialScatterPlot(data); plotClipBoardController.fillScatterplotAxisDropwdown(visualizer.GetPossibleScattersplots()); }
//---------------------------------------------------------------------------------------------------// // // Bivariate Analysis Button Click // private void onBivariateAnalysisButtonClick(object sender, EventArgs e) { Console.WriteLine("Bivariate Analysis"); Confirm(); if (myds == null) { return; } PlotData PD = new PlotData(myds); PD.Show(); }
/// <summary> /// Create a dialog for plot data /// </summary> /// <param name="plotData">data point keys must not be empty</param> public PlotEditingDialog(PlotData plotData) { if (plotData.DataPoints.Keys.Count == 0) { throw new ArgumentException("This constructor excepts only non-empty plot data with data points."); } this.plotData = plotData; this.InitializeComponent(); ChosePreSettings(); }
/// <summary> /// Draws a plot and saves it to a bitmap file. /// </summary> /// <param name="plotName">Name of the whole plot which will be written on top of the image as well</param> /// <param name="plotData">The <see cref="PlotData"/> which will be used to draw the plot</param> /// <param name="xAxisLabel">Name of the label for x axis</param> /// <param name="yAxisLabel">Name of the label for y axis</param> /// <param name="savePath">The path that the bitmap file will be saved in it</param> /// <param name="backColor">BackGround color of the whole image behind the plot rectangle</param> /// <param name="plotBackColor">Background color of the plot behind plot lines inside the plot rectangle</param> /// <param name="legendBackColor">Background color of the plot's legend</param> public static void DrawPlot(string plotName, PlotData plotData, string xAxisLabel, string yAxisLabel, string savePath, Color backColor, Color plotBackColor, Color legendBackColor) { NPlot.Bitmap.PlotSurface2D surface = CreateSurface(width, height, plotName, xAxisLabel, yAxisLabel, backColor, plotBackColor, legendBackColor); var linePlot = CreateLinePlot(plotData.xAxisData, plotData.yAxisData, new System.Drawing.Pen(ConvertToSystemColor(plotData.lineColor)), plotData.name); surface.Add(linePlot); surface.Refresh(); SaveSurface(surface, savePath, plotName); }
private void setCropObjectCollider(GameObject cropObject, int cropID) { int hasCollider = PlotData.GetCropHasCollider(cropID); if (hasCollider == 0) { cropObject.GetComponent <BoxCollider2D>().enabled = false; } else { cropObject.GetComponent <BoxCollider2D>().enabled = true; } }
public PlotData fromBacklogReport(FinalResult FINAL, int stepBacklogTime, DateTime startDate) { var backlogTimePlot = new PlotData(); backlogTimePlot.DataName = "Перцентиль по backlogTime"; backlogTimePlot.Periods = new List <Period>(); for (DateTime date = startDate; date < DateTime.Today; date = date.AddMonths(1)) { if (date.AddMonths(stepBacklogTime) > DateTime.Today) { break; } else { var period = new Period(); period.items = new List <ResultItem>(); period.startDate = date; period.endDate = date.AddMonths(stepBacklogTime); List <ResultItem> backlogTimeList = new List <ResultItem>(); foreach (ResultItem i in FINAL.resultItems) { if (i.value[0].fields.ActivatedDate != null && DateTime.Parse(i.value[0].fields.ActivatedDate) < date.AddMonths(stepBacklogTime) && DateTime.Parse(i.value[0].fields.ActivatedDate) >= date) { //if (i.value[0].backlogTime != 0) //{ period.items.Add(i); // backlogTimeList.Add(i.value[0].backlogTime); //} } } period.items = period.items.OrderBy(o => o.value[0].backlogTime).ToList(); var percentil = Math.Round(period.items.Count * 0.8, 1); if (percentil != 0 && percentil > 1) { var date1 = date; var date2 = date.AddMonths(3); var percentilFraction = Math.Round(percentil - (int)percentil, 1); var TaskDeltaForPercentil = period.items[(int)percentil].value[0].backlogTime - period.items[(int)percentil - 1].value[0].backlogTime; var percentilResult = period.items[(int)percentil - 1].value[0].backlogTime + (TaskDeltaForPercentil * percentilFraction); //значение по перцентилю, которое, помимо целой части, учитывает дробную часть перцентиля period.percentilBacklogTime = (int)Math.Round(percentilResult); } backlogTimePlot.Periods.Add(period); } } return(backlogTimePlot); }
private PlotData ConvertToPlotData(CurveFamilyF curves) { PlotData plotData = new PlotData(); plotData.Name = "Process"; CurveFamilyF[] oldFamilies = new CurveFamilyF[1]; oldFamilies[0] = curves; CurveFamily[] newFamilies = UI.ConvertCurveFamilies(oldFamilies, this.xPlotVariable.Variable.Type, this.yPlotVariable.Variable.Type); // add the new families to the PlotData plotData.CurveFamilies = newFamilies; return(plotData); }
//Grows plants in code; only updates visuals if you're in the garden IEnumerator Grow() { if (plots.Count == 0) { yield return(new WaitForSeconds(mc.CLOCK_SPEED)); StartCoroutine(Grow()); } else { List <string> keys = plots.Keys.ToList(); foreach (string s in keys) { if (plots[s].stage == Status.harvestable) { continue; } Seed seed = rl.seeds[plots[s].type]; PlotData temp = plots[s]; temp.currentTime += 10; if (temp.currentTime >= (temp.growthTime / seed.GrowthStages)) { temp.currentTime = 0; temp.index++; //Mark as harvestable if fully grown if (temp.index == (seed.GrowthStages - 1)) { temp.stage = Status.harvestable; } //If you're in the garden update the sprites if (SceneManager.GetActiveScene().name.Equals(plots[s].plotScene)) { SpriteRenderer[] renderers = GameObject.Find(s).GetComponentsInChildren <SpriteRenderer>(); for (int i = 1; i < 4; i++) { renderers[i].sprite = Resources.LoadAll <Sprite>("Plants/" + temp.type)[temp.index]; } } } //Update stored data plots[s] = temp; } yield return(new WaitForSeconds(mc.CLOCK_SPEED)); StartCoroutine(Grow()); } }
public void RenderPlotData(PlotData data, PlotData prevData) { graphics.DrawLine(Pens.Red, data.frame, 0f, data.frame, data.TAS * 0.4f * scale); graphics.DrawLine(Pens.DarkRed, data.frame, 0f, data.frame, data.IAS * 0.4f * scale); graphics.DrawLine(Pens.Lime, data.frame, target.Height * 0.667f, data.frame, target.Height * 0.667f + data.acc * 2f * scale); graphics.DrawLine(Pens.BlueViolet, data.frame, target.Height * 0.667f, data.frame, target.Height * 0.667f + data.liftG * 20f * scale); graphics.DrawLine(Pens.White, data.frame - 1, target.Height * 0.667f, data.frame, target.Height * 0.667f); if (prevData != null) { graphics.DrawLine(Pens.White, data.frame - 1, prevData.alt * 0.01f * scale, data.frame, data.alt * 0.01f * scale); graphics.DrawLine(Pens.Orange, data.frame - 1, prevData.mach * 100 * scale, data.frame, data.mach * 100 * scale); graphics.DrawLine(Pens.Cyan, data.frame - 1, prevData.tgtDistance1 * 0.005f * scale, data.frame, data.tgtDistance1 * 0.005f * scale); graphics.DrawLine(Pens.Cyan, data.frame - 1, prevData.tgtDistance2 * 0.005f * scale, data.frame, data.tgtDistance2 * 0.005f * scale); graphics.DrawLine(Pens.Yellow, data.frame - 1, prevData.tgtDistance39 * 0.005f * scale, data.frame, data.tgtDistance39 * 0.005f * scale); graphics.DrawLine(Pens.Blue, data.frame - 1, prevData.horDistance * 0.005f * scale, data.frame, data.horDistance * 0.005f * scale); graphics.DrawLine(Pens.Yellow, data.frame - 1, prevData.horDistance39 * 0.005f * scale, data.frame, data.horDistance39 * 0.005f * scale); graphics.DrawLine(Pens.Magenta, data.frame - 1, target.Height * 0.667f + prevData.angle * 1f, data.frame, target.Height * 0.667f + data.angle * 1f); graphics.DrawLine(Pens.White, data.frame - 1, target.Height * 0.667f, data.frame, target.Height * 0.667f); } if (prevData == null || prevData.time % 10.0 > data.time % 10.0) { graphics.DrawLine(Pens.Black, data.frame, 0, data.frame, 10); } else if (prevData == null || prevData.time % 5.0 > data.time % 5.0) { graphics.DrawLine(Pens.Black, data.frame, 0, data.frame, 5); } else { graphics.DrawLine(Pens.Black, data.frame, 0, data.frame, 1); } if (prevData != null) { float prevSonicSpeed = Simulator.GetSonicSpeed(prevData.alt); float sonicSpeed = Simulator.GetSonicSpeed(data.alt); for (int i = 1; i < 6; ++i) { graphics.DrawLine(i == 1 ? Pens.DarkGray : Pens.DimGray, data.frame - 1, prevSonicSpeed * i * 0.4f * scale, data.frame, sonicSpeed * i * 0.4f * scale); } } graphics.DrawLine(Pens.Black, data.frame - 1, cutoffSpeed * 0.4f * scale, data.frame, cutoffSpeed * 0.4f * scale); }
/// <summary> /// 添加地块的锄地信息 /// </summary> /// <param name="pos"></param> public void AddPlowPlotData(Vector3Int pos) { PlotData plotDataTemp; if (TryGetNowPlotDataDic().TryGetValue(pos, out plotDataTemp))//如果字典有该坐标的信息,就直接改了。没的话把之前新建的那个复个值,然后加进去 { plotDataTemp.IsPlowed = true; } else { plotDataTemp = new PlotData(); plotDataTemp.IsPlowed = true; TryGetNowPlotDataDic().Add(pos, plotDataTemp); } }
/// <summary> /// Erstellt einen Scatterplot mit Daten der Schnittstelle und lässt ihn auf dem Tisch anzeigen. /// </summary> public void createInitialScatterPlot(PlotData plotData) { selectedScatterplot = 0; LoadDataWithPlotData(plotData); int size = possibleScatterplots.GetLength(0); //Debug.Log("GetLength: Own" + possibleScatterplots.GetLength(0)); int[] temp = new int[size]; for (int i = 0; i < possibleScatterplots.GetLength(0); i++) { temp[i] = i; } int[] scatterplotIndices = temp; scatterplotIndicesGlobal = temp; CreateScatterplotMatrix(scatterplotIndices); }
public ScottPlotService(PngFileName filename, PlotData data) { _pngfilename = filename ?? throw new ArgumentNullException(nameof(filename)); _data = data ?? throw new ArgumentNullException(nameof(data)); // !Note: Ticks and SaveFig riase exception "Parameter is not valid.", if XValues and YValues has one value if (_data.XValues == null || _data.XValues.Length < 2) { throw new ArgumentException("ScottPlot for XValues requires at least one value"); } if (_data.YValues == null || _data.YValues.Length < 2) { throw new ArgumentException("ScottPlot for YValues requires at least one value"); } }
public BuildingData addBuildingData(Vector3Int pos, int buildingID, int instanceID) { int randomUID; do { randomUID = CreatBuildingUID(); } while (randomUID == 0); BuildingData BuildingDataTemp = new BuildingData(); BuildingDataTemp.nowLevel = 0; BuildingDataTemp.pos = pos; BuildingDataTemp.buildingType = (BuildingEnum.buildingType)dataManager.GetBuildingItemByID(buildingID).buildingTypeID; BuildingDataTemp.buildingScene = FarmSceneManager._Instance.nowScene; BuildingDataTemp.isUpgrading = true; BuildingDataTemp.upgradeDays = 0; BuildingDataTemp.buildingInstanceID = instanceID; TryGetNowBuildingDataDic().Add(randomUID, BuildingDataTemp); for (int x = 0; x < dataManager.GetBuildingItemByID(buildingID).size[0]; x++) { for (int y = 0; y < dataManager.GetBuildingItemByID(buildingID).size[1]; y++) { Vector3Int nowCellPos = new Vector3Int(); nowCellPos.x = pos.x + x; nowCellPos.y = pos.y + y; nowCellPos.z = pos.z; if (TryGetNowPlotDataDic().TryGetValue(nowCellPos, out PlotData plotData)) { plotData = new PlotData(); plotData.isBlocked = true; } else { PlotData temp = new PlotData(); temp.isBlocked = true; TryGetNowPlotDataDic().Add(nowCellPos, temp); } } } Dictionary <Vector3Int, PlotData> ttt = TryGetNowPlotDataDic(); return(BuildingDataTemp); }
public void Render(int frame, float time, float horDistance, float horDistance39, float alt, float TAS, float IAS, float mach, float acc, float liftG, float reqCL, float angle, float tgtDistance1, float tgtDistance2, float tgtDistance39) { var data = new PlotData(frame, time, horDistance, horDistance39, alt, TAS, IAS, mach, acc, liftG, reqCL, angle, tgtDistance1, tgtDistance2, tgtDistance39); if (isFirstFrame == false) { RenderPlotData(data, plotData[plotData.Count - 1]); } else { RenderPlotData(data, null); } plotData.Add(data); isFirstFrame = false; }
public void DisplayPlotData(PlotData data) { //_leftSeries.Points.Clear(); //_rightSeries.Points.Clear(); _leftSeries.Points.Add(new DataPoint(data.LeftPoint.X, data.LeftPoint.Y)); if (_leftSeries.Points.Count > _numberOfPoints) _leftSeries.Points.RemoveAt(0); _rightSeries.Points.Add(new DataPoint(data.RightPoint.X, data.RightPoint.Y)); if (_rightSeries.Points.Count > _numberOfPoints) _rightSeries.Points.RemoveAt(0); Debug.WriteLine("Centers: {0}, {1}", data.LeftPoint, data.RightPoint); this.plotView.InvalidatePlot(true); }
//Handles clicking on garden plots public void Farm(GardenPlot plot, Seed seed, InventorySlot slot) { PlotData data; if (plots.TryGetValue(plot.gameObject.name, out data)) { if (data.stage == Status.harvestable) { Harvest(plot); } else { return; } } else { if (seed == null) { GameObject inv = GameObject.FindGameObjectWithTag("inventory"); inv.GetComponent <CanvasGroup>().alpha = 1; inv.GetComponent <CanvasGroup>().interactable = true; inv.GetComponent <CanvasGroup>().blocksRaycasts = true; return; } plot.gameObject.GetComponent <AudioSource>().Play(); PlotData newData = new PlotData(); //Set values for plot newData.stage = Status.growing; newData.type = seed.SeedType; newData.growthTime = seed.GrowthTime; newData.currentTime = 0; newData.index = 0; newData.plotScene = SceneManager.GetActiveScene().name; //Add plot to dict plots.Add(plot.gameObject.name, newData); //Remove seed from inv Inventory.RemoveItem(slot); //Set plot sprite SpriteRenderer[] sr = plot.gameObject.GetComponentsInChildren <SpriteRenderer>(); for (int i = 1; i < 4; i++) { sr[i].sprite = Resources.Load <Sprite>("Plants/" + seed.SeedType); } } }
static void correlationLengthAnalysis() { List<Series> series = new List<Series>(); //Estimate correlation length var A = new ThreeDIsing(25); //for (double i = 4; i < 5; i += .1) { for (double i = 3; i < 8; i += 1) { Func<double, double> ising = b => { A.SetBeta(i); A.Randomize(); A.Equilibrate(1000000); Debug.Print("Temp: " + i.ToString()); return Math.Log(A.AutoCorrelation((int)b, 50000)); }; series.Add( ising.GetSeriesForGraph(0, 10, 1)); } PlotData data = new PlotData(series.ToArray()); data.Graph(); }
public PlotData formTaskReport(FinalResult FINAL, DateTime startDate) { //DateTime startDate = new DateTime(2018, 3, 1); int step = 1; var plot = new PlotData(); plot.DataName = "Сколько берется в работу"; plot.Periods = new List <Period>(); for (DateTime date = startDate; date < DateTime.Today; date = date.AddMonths(step)) { //создаём объект типа период, в который будем включать таски, попавшие в промежуток startDate/endDate var period = new Period(); period.items = new List <ResultItem>(); period.startDate = date; period.endDate = date.AddMonths(step); //Определяем сколько таск было создано/закрыто/взято в работу в текщий период foreach (ResultItem i in FINAL.resultItems) { if (i.value[0].fields.ActivatedDate != null && DateTime.Parse(i.value[0].fields.ActivatedDate) < date.AddMonths(step) && DateTime.Parse(i.value[0].fields.ActivatedDate) > date) { period.items.Add(i); period.activatedCount++; } if (i.value[0].fields.ClosedDate != null && DateTime.Parse(i.value[0].fields.ClosedDate) < date.AddMonths(step) && DateTime.Parse(i.value[0].fields.ClosedDate) > date) { period.items.Add(i); period.closedCount++; } if (DateTime.Parse(i.value[0].fields.CreatedDate) < date.AddMonths(step) && DateTime.Parse(i.value[0].fields.CreatedDate) > date) { period.items.Add(i); period.createdCount++; } } plot.Periods.Add(period); } return(plot); }
public void addMeasure(int index) { measures.Add(index); //Create data object associated with measure PlotData measureData = new PlotData(); measureData.measure = index; plotsData.Add(measureData); if (selfSplitMode) { //create selfMeasure PlotData selfMeasureData = new PlotData(); selfMeasureData.measure = index; selfPlotsData.Add(selfMeasureData); } UpdateData(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent(PlotData seriesToPlot) { System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // // chart1 // chartArea1.Name = "ChartArea1"; chartArea1.AxisX.Enabled = AxisEnabled.True; this.chart1.ChartAreas.Add(chartArea1); this.chart1.Dock = System.Windows.Forms.DockStyle.Fill; legend1.Name = "Legend1"; this.chart1.Legends.Add(legend1); this.chart1.Location = new System.Drawing.Point(0, 0); this.chart1.Name = "chart1"; foreach (var ser in seriesToPlot.GetData()) { this.chart1.Series.Add(ser); } this.chart1.Size = new System.Drawing.Size(728, 433); this.chart1.TabIndex = 0; this.chart1.Text = "chart1"; // // Chart // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(728, 433); this.Controls.Add(this.chart1); this.Name = "Chart"; this.Text = "DataChart"; ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); this.ResumeLayout(false); }
public Graph(PlotData p) { InitializeComponent(p); }
public void Evolve(double ti, double tf, double dt) { double[] yvals = initialValues; var series = new RungeKutta().Evaluate(ti, tf, dt, 4, yvals, updateYVals); var data = new PlotData(series); data.Graph(); }
static void PendulumTrial() { var pen = new Pendulum(5, 10, 9.8, .9, .1); PlotData p = new PlotData(pen, 0, 10, .01); p.AddTrial("time", "theta"); p.AddTrial("time", "dTheta"); //p.AddTrial("time", "potentialEnergy"); //p.AddTrial("time", "kineticEnergy"); //p.AddTrial("time", "totalEnergy"); p.Graph(); }
static void LaminarFrictionProjectileTrial() { LaminarFrictionProjectile proj = new LaminarFrictionProjectile(2); proj.SetvMag(10); var target = new Tuple<double, double>(2, .1); var angle = proj.GetAngleToTarget(target.Item1, target.Item2); PlotData p = new PlotData(proj, 0, 2, .01); p.AddPoint(target.Item1, target.Item2, "Target to hit"); if (angle == double.MinValue) throw new Exception("no solution"); proj.SetvMagTheta(10, angle); p.AddParametricTrial("x", "y", "t", "Launch angle: " + angle.ToString()); p.Graph(); }
//Homework #2 static void ProjectileTrial() { var target = new Tuple<double, double>(5, 2); double vMag = 10; NoFrictionProjectile proj1 = new NoFrictionProjectile(); proj1.setVmag(vMag); var angle = proj1.GetAnglesToTarget(target.Item1, target.Item2).Item2; proj1.setTheta(angle); double t = proj1.GetTimeOfFlight(); PlotData p = new PlotData(proj1, 0, t, .01); p.AddPoint(target.Item1, target.Item2, "Target to hit"); p.AddParametricTrial("x", "y", "t", "No friction\nLaunch angle: \n" + angle.ToString()); LaminarFrictionProjectile proj2 = new LaminarFrictionProjectile(); p.SetNewEq(proj2); double gamma = .1; proj2.SetGamma(gamma); proj2.SetvMag(vMag); angle = proj2.GetAngleToTarget(target.Item1, target.Item2); proj2.SetvMagTheta(vMag, angle); p.AddParametricTrial("x", "y", "t", "Launch angle: \n" + angle.ToString() + "\nGamma: " + gamma.ToString()); gamma = .01; proj2.SetGamma(gamma); angle = proj2.GetAngleToTarget(target.Item1, target.Item2); proj2.SetvMagTheta(vMag, angle); p.AddParametricTrial("x", "y", "t", "Launch angle: \n" + angle.ToString() + "\nGamma: " + gamma.ToString()); gamma = .001; proj2.SetGamma(gamma); angle = proj2.GetAngleToTarget(target.Item1, target.Item2); proj2.SetvMagTheta(vMag, angle); p.AddParametricTrial("x", "y", "t", "Launch angle: \n" + angle.ToString() + "\nGamma: " + gamma.ToString()); //p.Graph(); for (double i = .3; i < .5; i+=.01) { proj2.SetGamma(i); proj2.SetvMag(vMag); angle = proj2.GetAngleToTarget(target.Item1, target.Item2); if(angle < 0){ Console.WriteLine("Largest gamma with which the projectile can reach the target:"); i -= .01; Console.WriteLine((i).ToString()); Console.WriteLine("\nNumber of iterations to convergence:"); proj2.SetGamma(i); Console.WriteLine(proj2.NumberOfIterationsToConvergence(target.Item1, target.Item2).ToString()); break; } } Console.Read(); //ProjectileTrial(.001); //ProjectileTrial(.01); //ProjectileTrial(.1); //ProjectileTrial(1); }
static void ProjectileTrial(double gamma) { double v0 = 10; var target = new Tuple<double, double>(5, 2); var p = new PlotData(0, 2, .01); p.AddPoint(target.Item1, target.Item2, "Target to hit"); var projFrict = new LaminarFrictionProjectile(gamma); projFrict.SetvMag(v0); double ang1 = projFrict.GetAngleToTarget(target.Item1, target.Item2); projFrict.SetvMagTheta(v0, ang1); p.SetNewEq(projFrict); p.AddParametricTrial("x", "y", "t", "Launch angle: " + ang1.ToString() + " gamma: " + gamma.ToString()); var projNoFric = new NoFrictionProjectile(); projNoFric.setVmag(v0); var ang2 = projNoFric.GetAnglesToTarget(target.Item1, target.Item2); projNoFric.setTheta(ang2.Item1); p.SetNewEq(projNoFric); p.AddParametricTrial("x", "y", "t", "Launch angle: " + ang2.Item1.ToString() + " gamma: " + gamma.ToString()); p.Graph(); projFrict.GetThetaForMaxDistance(); }
static void QuadraticFrictionProjectileTrial() { //var A = new QuadraticFrictionProjectile(.01, 173, 173); //var ser1 = A.GetDataSeries(0, 11, .05); var A = new QuadraticFrictionProjectile(.01, 200); var theta = A.GetThetaForMaxDistance(); var ser2 = A.GetDataSeries(0, 11, .05, theta); A = new QuadraticFrictionProjectile(.01, 200); theta = A.GetAngleToTarget(155, 90); var ser3 = A.GetDataSeries(0, 11, .05, theta); var data = new PlotData(ser2, ser3); data.AddPoint(155, 90, "target"); data.Graph(); }
private void DrawPlot(List<NetworkStatistics> stats, Func<NetworkStatistics, double> selectMethod, double[] xAxisData, string plotName, string xAxisLabel, string yAxisLabel, Color lineColor, string savePath) { var yAxisdata = new List<double>(); yAxisdata.AddRange(stats.Select(selectMethod)); var plots = new PlotData("ServerStatistics", xAxisData, yAxisdata.ToArray(), lineColor); uPlot.DrawPlot(plotName, plots, xAxisLabel, yAxisLabel, savePath, backColor, plotBackColor, legendBackColor); }
private void GetNewGraph() { try { selChanObj = new selectChannel(); //start new thread to plot the selected channels foreach (int stream in Globals.channelsSelected.Keys) { if (Globals.channelsSelected[stream].Count != 0) { GraphPlot = new PlotData(stream); GraphPlot.SuspendLayout(); GraphPlot.ResumeLayout(false); GraphPlot.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }