public void PlottData() { Max = new float[dropDownList.Length - 1]; Min = new float[dropDownList.Length - 1]; nameList = new string[dropDownList.Length - 1]; if (TargetingScript.selectedTarget != null) { selectedIndex = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; } foreach (GameObject dataValues in GameObject.FindGameObjectsWithTag("DataBall")) { Destroy(dataValues); } foreach (var axisValue in GameObject.FindGameObjectsWithTag("3D_Axis_ValueText")) { Destroy(axisValue); } feature1Name = columnListDropDown[dropDownList[0].value]; feature2Name = columnListDropDown[dropDownList[1].value]; feature3Name = columnListDropDown[dropDownList[2].value]; feature4Name = columnListDropDown[dropDownList[3].value]; feature5Name = columnListDropDown[dropDownList[4].value]; for (int i = 0; i < dropDownList.Length - 1; i++) { nameList[i] = columnList[dropDownList[i].value + 1]; textList[i].text = nameList[i]; Min[i] = CalculationHelpers.FindMinValue(nameList[i], pointList); Max[i] = CalculationHelpers.FindMaxValue(nameList[i], pointList); } InstantiateDataPoint(Max, Min, nameList); RenderAxisValues(Max, Min); // Focus camera on new dataPoint if (CameraBehavior.teleportCamera) { CameraBehavior.RefocusCamera(pointList); } if (KNN.kPoints != null) { if (KNN.kPoints.Count > 0) { ColorManager.Blink(KNN.kPoints, pointList); } } }
private void Denormalize() { if (KNN.KNNMode) { KNN.KNNMove = true; } if (SceneManager.GetActiveScene().name == "ParallelCoordinatePlot") { float mellanskillnad = ParallelCoordinatePlotter.ThisInstans.yMax - ParallelCoordinatePlotter.ThisInstans.yMin; string newPosition = (ParallelCoordinatePlotter.ThisInstans.yMin + (mellanskillnad * TargetingScript.selectedTarget.transform.position.y) / 10).ToString(); newPosition = newPosition.Replace(',', '.'); index = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; ParallelCoordinatePlotter.ThisInstans.pointList[index][TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().TargetFeature] = newPosition; if (KNN.KNNMode) { KNN.KNNMove = true; } ParallelCoordinatePlotter.ThisInstans.DrawBackgroundGrid(); ParallelCoordinatePlotter.ThisInstans.ReorderColumns(); } else if (SceneManager.GetActiveScene().name == "ValfriTeknik") { for (int i = 0; i < 3; i++) { float mellanskillnad = ScatterplotDimensions.Max[i] - ScatterplotDimensions.Min[i]; string newPosition = ""; if (i == 0) { newPosition = (ScatterplotDimensions.Min[i] + (mellanskillnad * TargetingScript.selectedTarget.transform.position.x) / 10).ToString("0.0"); } else if (i == 1) { newPosition = (ScatterplotDimensions.Min[i] + (mellanskillnad * TargetingScript.selectedTarget.transform.position.y) / 10).ToString("0.0"); } else if (i == 2) { newPosition = (ScatterplotDimensions.Min[i] + (mellanskillnad * TargetingScript.selectedTarget.transform.position.z) / 10).ToString("0.0"); } newPosition = newPosition.Replace(',', '.'); index = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; ScatterplotDimensions.pointList[index][ScatterplotDimensions.nameList[i]] = newPosition; } ScatterplotDimensions.ThisInstans.PlottData(); } else if (SceneManager.GetActiveScene().name == "ScatterPlotMatrix") { float MinColumn = CalculationHelpers.FindMinValue(TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column, ScatterPlotMatrix.pointList); float MaxColumn = CalculationHelpers.FindMaxValue(TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column, ScatterPlotMatrix.pointList); float mellanskillnad = MaxColumn - MinColumn; string newPosition = (MinColumn + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.x - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.x)) / 10).ToString("0.0"); newPosition = newPosition.Replace(',', '.'); index = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; ScatterPlotMatrix.pointList[index][TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column] = newPosition; float MinRow = CalculationHelpers.FindMinValue(TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row, ScatterPlotMatrix.pointList); float MaxRow = CalculationHelpers.FindMaxValue(TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row, ScatterPlotMatrix.pointList); mellanskillnad = MaxRow - MinRow; newPosition = (MinRow + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.y - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.y)) / 10).ToString("0.0"); newPosition = newPosition.Replace(',', '.'); index = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; ScatterPlotMatrix.pointList[index][TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row] = newPosition; ScatterPlotMatrix.ThisInstans.PlottData(); } else { float mellanskillnad = DataPlotter.ThisInstans.xMax - DataPlotter.ThisInstans.xMin; string newPosition = (DataPlotter.ThisInstans.xMin + (mellanskillnad * TargetingScript.selectedTarget.transform.position.x) / 10).ToString(); newPosition = newPosition.Replace(',', '.'); index = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; DataPlotter.pointList[index][DataPlotter.xName] = newPosition; mellanskillnad = DataPlotter.ThisInstans.yMax - DataPlotter.ThisInstans.yMin; newPosition = (DataPlotter.ThisInstans.yMin + (mellanskillnad * TargetingScript.selectedTarget.transform.position.y) / 10).ToString(); newPosition = newPosition.Replace(',', '.'); index = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; DataPlotter.pointList[index][DataPlotter.yName] = newPosition; if (MainMenu.renderMode == 1) { mellanskillnad = DataPlotter.ThisInstans.zMax - DataPlotter.ThisInstans.zMin; newPosition = (DataPlotter.ThisInstans.zMin + (mellanskillnad * TargetingScript.selectedTarget.transform.position.z) / 10).ToString(); newPosition = newPosition.Replace(',', '.'); index = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; DataPlotter.pointList[index][DataPlotter.zName] = newPosition; } DataPlotter.ThisInstans.PlottData(); } }
//Uppdatera edit position fältet i realtid private void Denormalize() { int index = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; if (SceneManager.GetActiveScene().name == "ValfriTeknik") { for (int i = 0; i < 3; i++) { float mellanskillnad = ScatterplotDimensions.Max[i] - ScatterplotDimensions.Min[i]; if (i == 0) { Xvalue.text = (ScatterplotDimensions.Min[i] + (mellanskillnad * TargetingScript.selectedTarget.transform.position.x) / 10).ToString("0.0").Replace('.', ','); } else if (i == 1) { Yvalue.text = (ScatterplotDimensions.Min[i] + (mellanskillnad * TargetingScript.selectedTarget.transform.position.y) / 10).ToString("0.0").Replace('.', ','); } else if (i == 2) { Zvalue.text = (ScatterplotDimensions.Min[i] + (mellanskillnad * TargetingScript.selectedTarget.transform.position.z) / 10).ToString("0.0").Replace('.', ','); } } } else if (SceneManager.GetActiveScene().name == "ScatterPlotMatrix") { float MinColumn = CalculationHelpers.FindMinValue(TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column, ScatterPlotMatrix.pointList); float MaxColumn = CalculationHelpers.FindMaxValue(TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column, ScatterPlotMatrix.pointList); float mellanskillnad = MaxColumn - MinColumn; float MinRow = CalculationHelpers.FindMinValue(TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row, ScatterPlotMatrix.pointList); float MaxRow = CalculationHelpers.FindMaxValue(TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row, ScatterPlotMatrix.pointList); float mellanskillnadRow = MaxRow - MinRow; if (TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column == TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature1) { Xvalue.text = (MinColumn + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.x - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.x)) / 10).ToString("0.0"); } else if (TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row == TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature1) { Xvalue.text = (MinColumn + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.y - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.y)) / 10).ToString("0.0"); } else { Xvalue.text = ScatterPlotMatrix.pointList[index][TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature1].ToString().Replace('.', ','); } if (TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column == TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature2) { Yvalue.text = (MinColumn + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.x - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.x)) / 10).ToString("0.0"); } else if (TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row == TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature2) { Yvalue.text = (MinColumn + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.y - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.y)) / 10).ToString("0.0"); } else { Yvalue.text = ScatterPlotMatrix.pointList[index][TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature2].ToString().Replace('.', ','); } if (TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column == TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature3) { Zvalue.text = (MinColumn + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.x - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.x)) / 10).ToString("0.0"); } else if (TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row == TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature3) { Zvalue.text = (MinColumn + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.y - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.y)) / 10).ToString("0.0"); } else { Zvalue.text = ScatterPlotMatrix.pointList[index][TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature1].ToString().Replace('.', ','); } if (TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column == TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature4) { Avalue.text = (MinColumn + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.x - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.x)) / 10).ToString("0.0"); } else if (TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row == TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature4) { Avalue.text = (MinColumn + (mellanskillnad * (TargetingScript.selectedTarget.transform.position.y - TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder.y)) / 10).ToString("0.0"); } else { Avalue.text = ScatterPlotMatrix.pointList[index][TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Feature4].ToString().Replace('.', ','); } } else { float mellanskillnad = DataPlotter.ThisInstans.xMax - DataPlotter.ThisInstans.xMin; Xvalue.text = (DataPlotter.ThisInstans.xMin + (mellanskillnad * TargetingScript.selectedTarget.transform.position.x) / 10).ToString("0.0"); mellanskillnad = DataPlotter.ThisInstans.yMax - DataPlotter.ThisInstans.yMin; Yvalue.text = (DataPlotter.ThisInstans.yMin + (mellanskillnad * TargetingScript.selectedTarget.transform.position.y) / 10).ToString("0.0"); if (MainMenu.renderMode == 1) { mellanskillnad = DataPlotter.ThisInstans.zMax - DataPlotter.ThisInstans.zMin; Zvalue.text = (DataPlotter.ThisInstans.zMin + (mellanskillnad * TargetingScript.selectedTarget.transform.position.z) / 10).ToString("0.0"); } } }
public void PlottData() { if (TargetingScript.selectedTarget != null) { selectedIndex = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; } DestroyDataBallsAndAxisValues(); xName = columnList[xList.value + 1]; yName = columnList[yList.value + 1]; xAxisText.text = xName; yAxisText.text = yName; // Get maxes of each axis xMax = CalculationHelpers.FindMaxValue(xName, pointList); yMax = CalculationHelpers.FindMaxValue(yName, pointList); zMax = 0f; // Get minimums of each axis xMin = CalculationHelpers.FindMinValue(xName, pointList); yMin = CalculationHelpers.FindMinValue(yName, pointList); zMin = 0f; // If renderMode is 3D if (MainMenu.renderMode == 1) { zName = columnList[zList.value + 1]; zAxisText.text = zName; zMax = CalculationHelpers.FindMaxValue(zName, pointList); zMin = CalculationHelpers.FindMinValue(zName, pointList); } string valueString; // If renderMode is 2D if (MainMenu.renderMode == 0) { // Destroy all dataValues before plotting new ones foreach (GameObject dataValues in GameObject.FindGameObjectsWithTag("dataValues")) { Destroy(dataValues); } DrawBackgroundGridAndValues(); } // If renderMode is 3D if (MainMenu.renderMode == 1) { RenderAxisValues(); } // Loop through Pointlist for (var i = 0; i < pointList.Count; i++) { GameObject dataPoint; // Get value in poinList at ith "row", in "column" Name, normalize valueString = pointList[i][xName].ToString(); float x = (float.Parse(valueString, CultureInfo.InvariantCulture) - xMin) / (xMax - xMin); valueString = pointList[i][yName].ToString(); float y = (float.Parse(valueString, CultureInfo.InvariantCulture) - yMin) / (yMax - yMin); float z = 1; //Instantiate datapoints if (MainMenu.renderMode == 0) { dataPoint = Instantiate(PointPrefab, new Vector3(x, y, 0) * plotScale, Quaternion.identity); dataPoint.transform.name = pointList[i][columnList[0]] + " " + pointList[i][xName] + " " + pointList[i][yName] + " " + pointList[i][columnList[columnList.Count() - 1]]; dataPoint.transform.parent = PointHolder.transform; } else { valueString = pointList[i][zName].ToString(); z = (float.Parse(valueString, CultureInfo.InvariantCulture) - zMin) / (zMax - zMin); dataPoint = Instantiate(PointPrefab, new Vector3(x, y, z) * plotScale, Quaternion.identity); dataPoint.transform.name = pointList[i][columnList[0]] + " " + pointList[i][xName] + " " + pointList[i][yName] + " " + pointList[i][zName] + " " + pointList[i][columnList[columnList.Count() - 1]]; dataPoint.transform.parent = PointHolder.transform; } if (!pointList[i].ContainsKey("DataBall")) { pointList[i].Add("DataBall", dataPoint); } else { pointList[i]["DataBall"] = dataPoint; } //Store values in dataPoint dataPoint.GetComponent <StoreIndexInDataBall>().Index = i; dataPoint.GetComponent <StoreIndexInDataBall>().TargetFeature = pointList[i][columnList[columnList.Count - 1]].ToString(); dataPoint.GetComponent <StoreIndexInDataBall>().Feature1 = xName; dataPoint.GetComponent <StoreIndexInDataBall>().Feature2 = yName; if (zName != null) { dataPoint.GetComponent <StoreIndexInDataBall>().Feature3 = zName; } //Assign color to dataPoint int index = targetFeatures.IndexOf(pointList[i][columnList[columnList.Count - 1]].ToString()); if (targetFeatures.Count() <= 10) { ColorManager.ChangeColor(dataPoint, index); } else { dataPoint.GetComponent <Renderer>().material.color = new Color(x, y, z, 1.0f); } //Reselect target if one was selected before. if (selectedIndex == i) { TargetingScript.selectedTarget = dataPoint; TargetingScript.colorOff = TargetingScript.selectedTarget.GetComponent <Renderer>().material.color; TargetingScript.selectedTarget.GetComponent <Renderer>().material.color = Color.white; TargetingScript.selectedTarget.transform.localScale += new Vector3(+0.01f, +0.01f, +0.01f); selectedIndex = -1; } } // Focus camera on new dataPoint if (CameraBehavior.teleportCamera) { CameraBehavior.RefocusCamera(pointList); } if (KNN.kPoints != null) { if (KNN.kPoints.Count > 0) { ColorManager.Blink(KNN.kPoints, pointList); } } }
public void PlottData() { if (TargetingScript.selectedTarget != null) { selectedIndex = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Index; selectedRow = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Row; selectedColumn = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().Column; } ResetDataPlot(); for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { try { feature1Name = featureList[columnDropdownList[j].value]; feature2Name = featureList[columnDropdownList[k].value]; feature1 = featureList[columnDropdownList[0].value]; feature2 = featureList[columnDropdownList[1].value]; feature3 = featureList[columnDropdownList[2].value]; feature4 = featureList[columnDropdownList[3].value]; if (j == k) { GameObject summonPlane = Instantiate(planePointBackground, new Vector3(k * 1.2F + 0.5F, j * 1.2F + 0.5F, 0) * plotScale, Quaternion.Euler(0, 90, -90)); //Le textfält TMP_Text textField = Instantiate(ScatterplotMatrixText, new Vector3(k * 1.2F + 1, j * 1.2F + 0.3F, -0.01f) * plotScale, Quaternion.identity); textField.text = featureList[columnDropdownList[j].value]; } else if (k < j) { GameObject summonPlane = Instantiate(planePointBackground, new Vector3(k * 1.2F + 0.5F, j * 1.2F + 0.5F, 0) * plotScale, Quaternion.Euler(0, 90, -90)); // Get maxes of each axis float xMax = CalculationHelpers.FindMaxValue(feature1Name, pointList); float yMax = CalculationHelpers.FindMaxValue(feature2Name, pointList); // Get minimums of each axis float xMin = CalculationHelpers.FindMinValue(feature1Name, pointList); float yMin = CalculationHelpers.FindMinValue(feature2Name, pointList); string valueString; //Loop through Pointlist for (var i = 0; i < pointList.Count; i++) { GameObject dataPoint; // Get value in poinList at ith "row", in "column" Name, normalize valueString = pointList[i][feature1Name].ToString(); float x = (float.Parse(valueString, CultureInfo.InvariantCulture) - xMin) / (xMax - xMin); valueString = pointList[i][feature2Name].ToString(); float y = (float.Parse(valueString, CultureInfo.InvariantCulture) - yMin) / (yMax - yMin); int index = targetFeatures.IndexOf(pointList[i][columnList[columnList.Count - 1]].ToString()); // Instantiate dataPoint dataPoint = Instantiate(PointPrefab, new Vector3(x + k * 1.2F, y + j * 1.2F, 0) * plotScale, Quaternion.identity); // Set transform name dataPoint.transform.name = pointList[i][feature1Name] + " " + pointList[i][feature2Name]; // Set parent dataPoint.transform.parent = PointHolder.transform; dataPoint.GetComponent <StoreIndexInDataBall>().Index = i; dataPoint.GetComponent <StoreIndexInDataBall>().TargetFeature = pointList[i][columnList[columnList.Count - 1]].ToString(); dataPoint.GetComponent <StoreIndexInDataBall>().Feature1 = feature1; dataPoint.GetComponent <StoreIndexInDataBall>().Feature2 = feature2; dataPoint.GetComponent <StoreIndexInDataBall>().Column = featureList[columnDropdownList[j].value]; dataPoint.GetComponent <StoreIndexInDataBall>().Row = featureList[columnDropdownList[k].value]; dataPoint.GetComponent <StoreIndexInDataBall>().Feature3 = feature3; dataPoint.GetComponent <StoreIndexInDataBall>().Feature4 = feature4; dataPoint.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder = new Vector3(k * 1.2F + 0.5F, j * 1.2F + 0.5F, 0) * plotScale; dataPoint.GetComponent <StoreIndexInDataBall>().ScatterPlotMatrixPositionFinder += new Vector3(-5, -5, 0); if (!pointList[i].ContainsKey("DataBall")) { pointList[i].Add("DataBall", dataPoint); } else { pointList[i]["DataBall"] = dataPoint; } // Set color if (targetFeatures.Count() <= 10) { ColorManager.ChangeColor(dataPoint, index); } else { dataPoint.GetComponent <Renderer>().material.color = new Color(x, y, y, 1.0f); } //Reselect target if one was selected before. if (selectedIndex == i && dataPoint.GetComponent <StoreIndexInDataBall>().Column == selectedColumn && dataPoint.GetComponent <StoreIndexInDataBall>().Row == selectedRow) { TargetingScript.selectedTarget = dataPoint; TargetingScript.colorOff = TargetingScript.selectedTarget.GetComponent <Renderer>().material.color; TargetingScript.selectedTarget.GetComponent <Renderer>().material.color = Color.white; TargetingScript.selectedTarget.transform.localScale += new Vector3(+0.01f, +0.01f, +0.01f); selectedIndex = -1; } if (KNN.KNNMode && i == pointList.Count() - 1) { dataPoint.GetComponent <Renderer>().material.color = Color.white; dataPoint.transform.localScale += new Vector3(-0.01f, -0.01f, -0.01f); } } } } catch (Exception) { } if (KNN.kPoints != null) { if (KNN.kPoints.Count > 0) { ColorManager.Blink(KNN.kPoints, pointList); } } } } // Focus camera on new dataPoint if (CameraBehavior.teleportCamera) { CameraBehavior.RefocusCamera(pointList); } }
public void DrawBackgroundGrid() { foreach (GameObject dataValues in GameObject.FindGameObjectsWithTag("dataValues")) { Destroy(dataValues); } foreach (GameObject dataValues in GameObject.FindGameObjectsWithTag("DataLineGrid")) { Destroy(dataValues); } // Draw vertical lines for (int i = 1; i <= 4; i++) { float xPos = SetColumnPosition(i); GameObject xLine = Instantiate(LinePrefab, new Vector3(xPos, 0f, -0.001f) * plotScale, Quaternion.identity); xLine.transform.tag = "DataLineGrid"; xLine.transform.parent = PointHolder.transform; xLine.transform.name = $"Column{i}Line"; LineRenderer xLineRenderer = xLine.GetComponent <LineRenderer>(); xLineRenderer.positionCount = 2; xLineRenderer.startWidth = 0.025f; xLineRenderer.endWidth = 0.025f; xLineRenderer.SetPosition(0, new Vector3(xPos, -0.05f, -0.001f) * plotScale); xLineRenderer.SetPosition(1, new Vector3(xPos, 1.05f, -0.001f) * plotScale); xLineRenderer.material.color = new Color(0.5f, 0.5f, 0.5f, 0.5f); } yMax = 0f; yMin = float.Parse(pointList[0][featureList[0]].ToString(), CultureInfo.InvariantCulture); // Find and render Max- & Min-values on Y-Axis for (int i = 0; i < featureList.Count; i++) { float yMaxTempValue = CalculationHelpers.FindMaxValue(featureList[i], pointList); if (yMaxTempValue > yMax) { yMax = yMaxTempValue; } float yMinTempValue = CalculationHelpers.FindMinValue(featureList[i], pointList); if (yMinTempValue < yMin) { yMin = yMinTempValue; } } // Draw horizontal lines for (int i = 0; i <= 10; i++) { // Instantiate lines, set parent, set transform name GameObject yLine = Instantiate(LinePrefab, new Vector3(0, 0f, -0.001f) * plotScale, Quaternion.identity); yLine.transform.tag = "DataLineGrid"; yLine.transform.parent = PointHolder.transform; yLine.transform.name = $"Value{i}Line"; LineRenderer yLineRenderer = yLine.GetComponent <LineRenderer>(); yLineRenderer.positionCount = 2; yLineRenderer.startWidth = 0.025f; yLineRenderer.endWidth = 0.025f; yLineRenderer.SetPosition(0, new Vector3(0.15f, (float)i / 10, -0.001f) * plotScale); yLineRenderer.SetPosition(1, new Vector3(1.45f, (float)i / 10, -0.001f) * plotScale); yLineRenderer.material.color = new Color(0.5f, 0.5f, 0.5f, 0.4f); TMP_Text valuePointY = Instantiate(valuePrefab, new Vector3(1f, 0 + i, 0), Quaternion.identity); valuePointY.transform.name = $"Value{i}LineText"; float yValue = ((yMax - yMin) / 10) * i + yMin; valuePointY.text = yValue.ToString("0.00"); } }