У меня есть линейный график в моей игре Unity.
График рисует в соответствии со значениями, приведенными в списке.
Но когда значение становится высоким, координата исчезает с экрана. Как я могу уменьшить мой график, когда приходит большое значение?

Я использовал этот код для уменьшения графика, но он уменьшает только тогда, когда последнее значение в списке велико.
public void ChangeScale(){
Debug.Log (valueList [valueList.Count-1]);
temp = graphContainer.localScale;
if (valueList [valueList.Count - 1]>600) {
temp.x -= 1f;
temp.y -= 1f;
graphContainer.localScale = new Vector2 (temp.x, temp.y);
//temp.Set(temp.x+0.05f,temp.y+0.05f,0);
Debug.Log (temp.x);
Debug.Log (temp.y);
}
if (valueList [valueList.Count - 1]>1000) {
temp.x -= 0.6f;
temp.y -= 0.6f;
graphContainer.localScale = new Vector2 (temp.x, temp.y);
//temp.Set(temp.x+0.05f,temp.y+0.05f,0);
Debug.Log (temp.x);
Debug.Log (temp.y);
}
if (valueList [valueList.Count - 1]>1600) {
temp.x -= 0.3f;
temp.y -= 0.3f;
graphContainer.localScale = new Vector2 (temp.x, temp.y);
//temp.Set(temp.x+0.05f,temp.y+0.05f,0);
Debug.Log (temp.x);
Debug.Log (temp.y);
}
Debug.Log (temp.x);
Debug.Log (temp.y);
}