From 75c1fcb1bc6c6875a48c0cb1b8b48c8656ff58d8 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Wed, 12 Sep 2018 07:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E5=8F=98=E5=8C=96=E6=97=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=B0=83=E6=95=B4=E6=8C=89=E9=92=AE=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/XChart/Scripts/LineChart.cs | 85 +++-- Assets/XChart/demo.unity | 591 +---------------------------- 2 files changed, 73 insertions(+), 603 deletions(-) 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