修复Legend都隐藏时Value轴还显示数值的问题

This commit is contained in:
monitor1394
2019-12-11 02:14:37 +08:00
parent ac61213db3
commit 067a70e385
3 changed files with 10 additions and 3 deletions

View File

@@ -495,6 +495,7 @@ namespace XCharts
int split = GetSplitNumber(coordinateWidth, dataZoom);
if (m_Type == AxisType.Value)
{
if (minValue == 0 && maxValue == 0) return string.Empty;
float value = 0;
if (forcePercent) maxValue = 100;
if (m_Interval > 0)
@@ -635,6 +636,7 @@ namespace XCharts
{
if (!show) return false;
if (IsCategory() && data.Count <= 0) return false;
else if (IsValue() && m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return false;
else return true;
}
@@ -658,7 +660,10 @@ namespace XCharts
switch (minMaxType)
{
case Axis.AxisMinMaxType.Default:
if (minValue > 0 && maxValue > 0)
if (minValue == 0 && maxValue == 0)
{
}
else if (minValue > 0 && maxValue > 0)
{
minValue = 0;
maxValue = needFormat ? ChartHelper.GetMaxDivisibleValue(maxValue) : maxValue;
@@ -685,6 +690,7 @@ namespace XCharts
internal float GetCurrMinValue(float duration)
{
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
if (!m_RuntimeMinValueChanged) return m_RuntimeMinValue;
var time = Time.time - m_RuntimeMinValueUpdateTime;
var total = duration / 1000;
@@ -702,6 +708,7 @@ namespace XCharts
internal float GetCurrMaxValue(float duration)
{
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
if (!m_RuntimeMaxValueChanged) return m_RuntimeMaxValue;
var time = Time.time - m_RuntimeMaxValueUpdateTime;
var total = duration / 1000;

View File

@@ -886,7 +886,7 @@ namespace XCharts
private void DrawYAxisTickAndSplit(VertexHelper vh, int yAxisIndex, YAxis yAxis)
{
if (yAxis.show)
if (yAxis.NeedShowSplit())
{
var size = yAxis.GetScaleNumber(coordinateWidth, m_DataZoom);
var totalWidth = coordinateY;

View File

@@ -25,7 +25,7 @@ namespace XCharts
public class XChartsMgr : MonoBehaviour
{
public const string version = "1.0.5";
public const int date = 20191204;
public const int date = 20191211;
[SerializeField] private string m_NowVersion;
[SerializeField] private string m_NewVersion;