/// <summary> /// Diese Methode färbt falls er bei der Klassifizierung fehelrhaft interpretiert worden ist ein. /// </summary> public void colorError(CSVDataSource dataSource) { int columnindex = 0; int j = 0; foreach (var column in dataSource) { if (column.Identifier.Equals(dataSource.categoryColumn)) { columnindex = j; } // dann möchte ich den index und befülle diesen index dann unten j++; } if (!(dataSource.results[index].Equals(dataSource.getOriginalValue(dataSource[columnindex].Data[index], dataSource[columnindex].Identifier).ToString()))) { Renderer renderer = this.GetComponent <Renderer>(); if (dataSource.resultColor != null) { color = Utilities.HexToColor(dataSource.resultColor); renderer.material.color = color; } else { color = Color.red; renderer.material.color = color; } } }
private void PropagateSetText(int[] indices, int viewID) { // Get the visualisation again Visualisation visualisation = PhotonView.Find(viewID).GetComponentInChildren <Visualisation>(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("<b>{0} (x):</b> {1}\n", visualisation.xDimension.Attribute, dataSource.getOriginalValue(indices[0], visualisation.xDimension.Attribute)); stringBuilder.AppendFormat("<b>{0} (y):</b> {1}\n", visualisation.yDimension.Attribute, dataSource.getOriginalValue(indices[0], visualisation.yDimension.Attribute)); if (visualisation.zDimension.Attribute != "Undefined") { stringBuilder.AppendFormat("<b>{0} (z):</b> {1}\n", visualisation.zDimension.Attribute, dataSource.getOriginalValue(indices[0], visualisation.zDimension.Attribute)); } stringBuilder.Append("--------\n"); if (indices.Length > 1) { stringBuilder.AppendFormat("<i>{0} stacked points</i>", indices.Length); } else { for (int i = 0; i < dataSource.DimensionCount; i++) { string dimension = dataSource[i].Identifier; object value = dataSource.getOriginalValue(indices[0], dimension); if (dataSource[dimension].MetaData.type == DataType.Float && value.ToString().Length > 4) { stringBuilder.AppendFormat("<b>{0}:</b> {1}\n", dimension, ((float)value).ToString("#,##0.00")); } else { stringBuilder.AppendFormat("<b>{0}:</b> {1}\n", dimension, value); } } } frontText.text = stringBuilder.ToString(); frontText.ForceMeshUpdate(); // Resize the panel based on the text Vector2 scale = frontText.GetRenderedValues(); scale.x = scale.x / 2 + 0.01f; scale.y = scale.y / 2 + 0.01f; panel.transform.localScale = new Vector3(scale.x, scale.y, 0.01f); panel.transform.localPosition = new Vector3(scale.x / 2 + 0.01f, scale.y / 2 + 0.01f, 0); frontText.transform.localPosition = new Vector3(0.01f, scale.y + 0.01f, -0.008f); // Set the text and position the back backText.text = stringBuilder.ToString(); backText.ForceMeshUpdate(); backText.transform.localPosition = new Vector3(scale.x + 0.01f, scale.y + 0.01f, 0.008f); }
/// <summary> /// Returns the data from the CSV-File which this DataPoint represents. /// The first dimension holds the three columns. /// The second dimension holds the columns identifier in index 0 and the value in index 1. /// </summary> /// <returns></returns> public string[,] GetData() { CSVDataSource dataSource = scatterplot.dataSource; int xDim = scatterplot.xDim; int yDim = scatterplot.yDim; int zDim = scatterplot.zDim; string[,] data = new string[3, 2]; data[0, 0] = dataSource[xDim].Identifier; data[0, 1] = dataSource.getOriginalValue(dataSource[xDim].Data[index], dataSource[xDim].Identifier).ToString(); data[1, 0] = dataSource[yDim].Identifier; data[1, 1] = dataSource.getOriginalValue(dataSource[yDim].Data[index], dataSource[yDim].Identifier).ToString(); data[2, 0] = dataSource[zDim].Identifier; data[2, 1] = dataSource.getOriginalValue(dataSource[zDim].Data[index], dataSource[zDim].Identifier).ToString(); return(data); }
void FacetBy(string attribute) { // categories // "B02598"; // "B02512" float[] uniqueValues = csvdata[attribute].MetaData.categories; accordion = new View [uniqueValues.Length]; for (int i = 0; i < uniqueValues.Length; i++) { View view = Facet(csvdata, csvdata.getOriginalValue(uniqueValues[i], attribute).ToString(), "Base", Random.ColorHSV()); view.transform.position = new Vector3(i, 0, 0); accordion[i] = view; } //View v1 = Faceting(csvdata, "B02598"); //v1.transform.position = Vector3.zero; //View v2 = Faceting(csvdata, "B02512"); //v2.transform.position = Vector3.right; }
/// <summary> /// Methode färbt die Datenpunkte. /// Bei Auto nach Zylinderanzahl. /// Bei Iris nach Spezies. /// </summary> /// <param name="dataSource"></param> public void colorPoint(CSVDataSource dataSource) { int irisColumn = 4; //3 verschiedene Farben int autoMpgColumn = 1; //5 verschiedene Farben int test = 3; int columnindex = 0; int j = 0; foreach (var column in dataSource) { if (column.Identifier.Equals(dataSource.categoryColumn)) { columnindex = j; } // dann möchte ich den index und befülle diesen index dann unten j++; } Renderer renderer = this.GetComponent <Renderer>(); //dynamic color marking List <List <string> > categorieColors = dataSource.categoryColors; if (categorieColors != null) { foreach (List <string> categorie in categorieColors) { for (int i = 0; i < categorie.Count; i += 2) { if (categorie[i].Equals(dataSource.getOriginalValue(dataSource[columnindex].Data[index], dataSource[columnindex].Identifier).ToString())) { renderer.material.color = Utilities.HexToColor(categorie[++i]); } } } } if (dataSource.data.name.Equals("auto-mpg.csv")) { //index == Zeilennummer //autoMpgNumber == Spaltennummer switch (dataSource.getOriginalValue(dataSource[autoMpgColumn].Data[index], dataSource[autoMpgColumn].Identifier).ToString()) { case "8": color = Color.red; renderer.material.color = color; break; case "6": color = Color.yellow; renderer.material.color = color; break; case "5": color = Color.blue; renderer.material.color = color; break; case "4": color = Color.cyan; renderer.material.color = color; break; case "3": color = Color.green; renderer.material.color = color; break; } } else if (dataSource.data.name.Equals("Iris.csv")) { switch (dataSource.getOriginalValue(dataSource[irisColumn].Data[index], dataSource[irisColumn].Identifier).ToString()) { case "Iris-setosa": color = Color.red; renderer.material.color = color; break; case "Iris-versicolor": color = Color.yellow; renderer.material.color = color; break; case "Iris-virginica": color = Color.green; renderer.material.color = color; break; } } }