diff --git a/Assets/XChart/Scripts/LineChart.cs b/Assets/XChart/Scripts/LineChart.cs index 5dc8d300..b4a23727 100644 --- a/Assets/XChart/Scripts/LineChart.cs +++ b/Assets/XChart/Scripts/LineChart.cs @@ -134,6 +134,8 @@ namespace xchart private int graduationCount = 4; [SerializeField] private int graduationStep = 10; + [SerializeField] + private int graduationWidth = 50; private float arrowLen = 10; private float arrowSize = 6; @@ -150,8 +152,9 @@ namespace xchart private bool isShowAll; private List graduationList = new List(); private Dictionary lineMap = new Dictionary(); - private float lastMax = 0; - private float lastHig = 0; + private float lastMaxData = 0; + private float lastChartHig = 0; + private float lastGraduationWid = 0; protected override void Awake() { @@ -165,7 +168,8 @@ namespace xchart line.dataList.Clear(); if (line.button) { - line.button.GetComponent().color = line.visible ? line.lineColor : Color.grey; + Color bcolor = line.visible ? line.lineColor : Color.grey; + line.button.GetComponent().color = bcolor; line.button.GetComponentInChildren().text = line.name; line.button.onClick.AddListener(delegate () { @@ -261,7 +265,7 @@ namespace xchart rect.anchorMax = Vector2.zero; rect.anchorMin = Vector2.zero; rect.pivot = Vector2.zero; - rect.sizeDelta = new Vector2(50, 20); + rect.sizeDelta = new Vector2(50-1, 20); rect.localPosition = new Vector3(i*50, chartHigh + 30, 0); Button btn = goBtn.GetComponent