public void ValidateRange() { int min; int max; min = (int)MathExtension.GetMinValue(yvalues); max = (int)MathExtension.GetMaxValue(yvalues); int range = max - min; yMinValue = MathExtension.Round(min, range); yMaxValue = MathExtension.Round(max, range); if (yMinValue > min) { yMinValue = yMinValue / 2; } if (yMaxValue < max) { yMaxValue = yMaxValue * 2; } if (yMaxValue <= yMinValue || yMaxValue < max) { yMaxValue = max; } }
public void ValidateRange() { int min; int max; min = (int)MathExtension.GetMinValue(yvalues); max = (int)MathExtension.GetMaxValue(yvalues); int range = max - min; yMinValue = MathExtension.Round(min, range); yMaxValue = MathExtension.Round(max, range); // Debug.Log("yMinValue" + yMinValue); // Debug.Log("yMaxValue" + yMaxValue); if (yMinValue > min) { yMinValue = yMinValue / 2; } if (yMaxValue < max) { yMaxValue = yMaxValue * 2; } if (yMaxValue <= yMinValue || yMaxValue < max) { yMaxValue = max; } // Debug.Log("yMinValue" + yMinValue); // Debug.Log("yMaxValue" + yMaxValue); //if (yMinValue < yMaxValue / 2) //{ // // yMinValue = 0; //} }
/* * public void ModifyGraph() * { * * * * for (int i = 0; i < ListOfDataSet.Count; i++) * { * xvalues.RemoveAt(0); * yvalues.RemoveAt(0); * int lastIndex = ListOfDataSet[i].ListOfBars.Count - 1; * xvalues.Add(ListOfDataSet[i].ListOfBars[lastIndex].XValue); * yvalues.Add(ListOfDataSet[i].ListOfBars[lastIndex].YValue); * Graph.RemoveAndShiftXpoints(ListOfDataSet[i].ListOfBars[lastIndex].XValue); * * * * float yscaleFactor = (yMaxSize * segmentSizeOnYaxis) / (yMaxValue - yMinValue); * if (barColorProperty == BarColor.SolidColor) * Graph.GenerateBarWithAnimTypeTwo(lastIndex, i, ListOfDataSet[i].ListOfBars[lastIndex].YValue, yscaleFactor, animationSpeed, yMinValue, xMaxSize, ListOfDataSet[i].barColor); * // else * // Graph.GenerateBarWithAnimTypeTwo(lastIndex, i, ListOfDataSet[i].ListOfBars[lastIndex].YValue, yscaleFactor, animationSpeed, yMinValue, xMaxSize, ListOfDataSet[i].barMaterial); * * } * * * * } * */ public void ValidateGeneric() { for (int i = 0; i < ListOfDataSet.Count; i++) { if (ListOfDataSet[i].GroupName.Contains("pH")) { if (ListOfDataSet.Count == 1) { max = 14; } //if (max > 14 && max < 50) //{ //max = (int)MathExtension.GetMaxValue(yvalues); //} min = (int)MathExtension.GetMinValue(yvalues); //yMinValue = 0; int range = max - min; yMinValue = MathExtension.Round(min, range); yMaxValue = 14; } else if (ListOfDataSet[i].GroupName.Contains("Condutividade")) { if (ListOfDataSet.Count == 1) { max = 2; //Debug.Log("Count 1 max: " + max); } //if (max > 2 && max < 15) //{ //max = (int)MathExtension.GetMaxValue(yvalues); //} min = (int)MathExtension.GetMinValue(yvalues); int range = max - min; yMinValue = MathExtension.Round(min, range); //yMaxValue = 2; yMaxValue = currentMaxList[4]; } else if (ListOfDataSet[i].GroupName.Contains("Temp. Água")) { //Debug.Log("Temperatura Agua"); //min = 0; if (ListOfDataSet.Count == 1) { max = 30; //Debug.Log("Count 1 max: " + max); } //if (max > 30 && max < 50) //{ //max = (int)MathExtension.GetMaxValue(yvalues); //} min = (int)MathExtension.GetMinValue(yvalues); //yMinValue = 0; int range = max - min; yMinValue = MathExtension.Round(min, range); //yMaxValue = 30; yMaxValue = currentMaxList[2]; //Debug.Log("Temperatura da Agua: " + yMaxValue); } else if (ListOfDataSet[i].GroupName.Contains("Temp. Ambiente")) { //Debug.Log("Temperatura Ambiente"); //min = 0; if (ListOfDataSet.Count == 1) { max = 45; //Debug.Log("Count 1 max: " + max); } /* * if (max > 30 && max < 50) * { * Debug.Log("MAior que 30 Menor que 50"); * * //max = (int)MathExtension.GetMaxValue(yvalues); * }*/ min = (int)MathExtension.GetMinValue(yvalues); //yMinValue = 0; int range = max - min; yMinValue = MathExtension.Round(min, range); //yMaxValue = 45; yMaxValue = currentMaxList[1]; } else if (ListOfDataSet[i].GroupName.Contains("Humidade \n Relativa do Ar")) { min = (int)MathExtension.GetMinValue(yvalues); max = (int)MathExtension.GetMaxValue(yvalues); int range = max - min; yMinValue = MathExtension.Round(min, range); yMaxValue = MathExtension.Round(max, range); yMaxValue = currentMaxList[0]; } if (yMinValue > min) { yMinValue = yMinValue / 2; } if (yMaxValue <= yMinValue || yMaxValue < max) { yMaxValue = max; } for (int j = 0; j < currentMaxList.Length; j++) { if (currentMaxList[j] > yMaxValue) { yMaxValue = (float)Math.Round(currentMaxList[j], 2); } } } }