protected infoDatos SetInfoStruct(int[] datos) { int maxV = -1, maxI = -1, minV = -1, minI = -1; int index = 0, acum = 0; foreach (var dato in datos) { if (maxV == -1) { maxV = dato; maxI = index; } else { if (dato > maxV) { maxV = dato; maxI = index; } } if (minV == -1) { minV = dato; minI = index; } else { if (dato < minV) { minV = dato; minI = index; } } acum += dato; index++; } infoDatos info = new infoDatos { min = minV, minIndex = minI, max = maxV, maxIndex = maxI, median = (float)acum / datos.Length }; return(info); }
private infoDatos SetInfoStruct <T>(Dictionary <T, int> datos) { int maxV = -1, maxI = -1, minV = -1, minI = -1; int index = 0, acum = 0; foreach (var dato in datos) { if (maxV == -1) { maxV = dato.Value; maxI = index; } else { if (dato.Value > maxV) { maxV = dato.Value; maxI = index; } } if (minV == -1) { minV = dato.Value; minI = index; } else { if (dato.Value < minV) { minV = dato.Value; minI = index; } } acum += dato.Value; index++; } infoDatos info = new infoDatos { min = minV, minIndex = minI, max = maxV, maxIndex = maxI, median = (float)acum / datos.Count }; return(info); }
public virtual void Graficar <T>(Dictionary <T, int> datos, bool setSize = true) { ResetGraph(); if (setSize) { SetSizeVariables(); } if (debug) { valores = new int[cantidadDatos]; for (int i = 0; i < cantidadDatos; i++) { valores[i] = Random.Range(10, 200); } info = SetInfoStruct(valores); } else { cantidadDatos = datos.Count; } }