mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-29 20:58:47 +00:00
AxisType.Value类型的坐标轴可以设置AxisMinMaxType控制最大最小刻度
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -48,14 +48,39 @@ namespace XCharts
|
|||||||
SerializedProperty m_BoundaryGap = prop.FindPropertyRelative("m_BoundaryGap");
|
SerializedProperty m_BoundaryGap = prop.FindPropertyRelative("m_BoundaryGap");
|
||||||
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
SerializedProperty m_Data = prop.FindPropertyRelative("m_Data");
|
||||||
SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick");
|
SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick");
|
||||||
|
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
|
||||||
|
SerializedProperty m_Min = prop.FindPropertyRelative("m_Min");
|
||||||
|
SerializedProperty m_Max = prop.FindPropertyRelative("m_Max");
|
||||||
|
|
||||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisModuleToggle, prop.displayName, m_Show);
|
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisModuleToggle, prop.displayName, m_Show);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
if (m_AxisModuleToggle)
|
if (m_AxisModuleToggle)
|
||||||
{
|
{
|
||||||
|
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
EditorGUI.PropertyField(drawRect, m_Type);
|
EditorGUI.PropertyField(drawRect, m_Type);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
if (type == Axis.AxisType.Value)
|
||||||
|
{
|
||||||
|
EditorGUI.PropertyField(drawRect, m_MinMaxType);
|
||||||
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex;
|
||||||
|
switch (minMaxType)
|
||||||
|
{
|
||||||
|
case Axis.AxisMinMaxType.Default:
|
||||||
|
break;
|
||||||
|
case Axis.AxisMinMaxType.MinMax:
|
||||||
|
break;
|
||||||
|
case Axis.AxisMinMaxType.Custom:
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
EditorGUI.PropertyField(drawRect, m_Min);
|
||||||
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
EditorGUI.PropertyField(drawRect, m_Max);
|
||||||
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
EditorGUI.PropertyField(drawRect, m_SplitNumber);
|
EditorGUI.PropertyField(drawRect, m_SplitNumber);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
EditorGUI.PropertyField(drawRect, m_TextRotation);
|
EditorGUI.PropertyField(drawRect, m_TextRotation);
|
||||||
@@ -82,7 +107,7 @@ namespace XCharts
|
|||||||
EditorGUI.PropertyField(drawRect, m_AxisTick);
|
EditorGUI.PropertyField(drawRect, m_AxisTick);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick);
|
drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||||
Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex;
|
|
||||||
if (type == Axis.AxisType.Category)
|
if (type == Axis.AxisType.Category)
|
||||||
{
|
{
|
||||||
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
drawRect.width = EditorGUIUtility.labelWidth + 10;
|
||||||
@@ -129,6 +154,14 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
height += EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing;
|
||||||
}
|
}
|
||||||
|
}else if(type == Axis.AxisType.Value)
|
||||||
|
{
|
||||||
|
height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType");
|
||||||
|
if(m_MinMaxType.enumValueIndex == (int)Axis.AxisMinMaxType.Custom)
|
||||||
|
{
|
||||||
|
height += EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
height += EditorGUI.GetPropertyHeight(m_AxisTick);
|
height += EditorGUI.GetPropertyHeight(m_AxisTick);
|
||||||
return height;
|
return height;
|
||||||
|
|||||||
@@ -15,6 +15,13 @@ namespace XCharts
|
|||||||
//Log
|
//Log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum AxisMinMaxType
|
||||||
|
{
|
||||||
|
Default,
|
||||||
|
MinMax,
|
||||||
|
Custom
|
||||||
|
}
|
||||||
|
|
||||||
public enum SplitLineType
|
public enum SplitLineType
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
@@ -54,6 +61,9 @@ namespace XCharts
|
|||||||
|
|
||||||
[SerializeField] protected bool m_Show = true;
|
[SerializeField] protected bool m_Show = true;
|
||||||
[SerializeField] protected AxisType m_Type;
|
[SerializeField] protected AxisType m_Type;
|
||||||
|
[SerializeField] protected AxisMinMaxType m_MinMaxType;
|
||||||
|
[SerializeField] protected int m_Min;
|
||||||
|
[SerializeField] protected int m_Max;
|
||||||
[SerializeField] protected int m_SplitNumber = 5;
|
[SerializeField] protected int m_SplitNumber = 5;
|
||||||
[SerializeField] protected int m_TextRotation = 0;
|
[SerializeField] protected int m_TextRotation = 0;
|
||||||
[SerializeField] protected bool m_ShowSplitLine = false;
|
[SerializeField] protected bool m_ShowSplitLine = false;
|
||||||
@@ -64,6 +74,9 @@ namespace XCharts
|
|||||||
|
|
||||||
public bool show { get { return m_Show; }set { m_Show = value; } }
|
public bool show { get { return m_Show; }set { m_Show = value; } }
|
||||||
public AxisType type { get { return m_Type; } set { m_Type = value; } }
|
public AxisType type { get { return m_Type; } set { m_Type = value; } }
|
||||||
|
public AxisMinMaxType minMaxType { get { return m_MinMaxType; } set { m_MinMaxType = value; } }
|
||||||
|
public int min { get { return m_Min; } set { m_Min = value; } }
|
||||||
|
public int max { get { return m_Max; } set { m_Max = value; } }
|
||||||
public int splitNumber { get { return m_SplitNumber; } set { m_SplitNumber = value; } }
|
public int splitNumber { get { return m_SplitNumber; } set { m_SplitNumber = value; } }
|
||||||
public int textRotation { get { return m_TextRotation; } set { m_TextRotation = value; } }
|
public int textRotation { get { return m_TextRotation; } set { m_TextRotation = value; } }
|
||||||
public bool showSplitLine { get { return m_ShowSplitLine; } set { m_ShowSplitLine = value; } }
|
public bool showSplitLine { get { return m_ShowSplitLine; } set { m_ShowSplitLine = value; } }
|
||||||
@@ -76,6 +89,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
m_Show = other.show;
|
m_Show = other.show;
|
||||||
m_Type = other.type;
|
m_Type = other.type;
|
||||||
|
m_Min = other.min;
|
||||||
|
m_Max = other.max;
|
||||||
m_SplitNumber = other.splitNumber;
|
m_SplitNumber = other.splitNumber;
|
||||||
m_TextRotation = other.textRotation;
|
m_TextRotation = other.textRotation;
|
||||||
m_ShowSplitLine = other.showSplitLine;
|
m_ShowSplitLine = other.showSplitLine;
|
||||||
@@ -187,6 +202,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
return show == other.show &&
|
return show == other.show &&
|
||||||
type == other.type &&
|
type == other.type &&
|
||||||
|
min == other.min &&
|
||||||
|
max == other.max &&
|
||||||
splitNumber == other.splitNumber &&
|
splitNumber == other.splitNumber &&
|
||||||
showSplitLine == other.showSplitLine &&
|
showSplitLine == other.showSplitLine &&
|
||||||
textRotation == other.textRotation &&
|
textRotation == other.textRotation &&
|
||||||
@@ -228,6 +245,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
m_Show = true,
|
m_Show = true,
|
||||||
m_Type = AxisType.Category,
|
m_Type = AxisType.Category,
|
||||||
|
m_Min = 0,
|
||||||
|
m_Max = 0,
|
||||||
m_SplitNumber = 5,
|
m_SplitNumber = 5,
|
||||||
m_TextRotation = 0,
|
m_TextRotation = 0,
|
||||||
m_ShowSplitLine = false,
|
m_ShowSplitLine = false,
|
||||||
@@ -254,6 +273,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
m_Show = true,
|
m_Show = true,
|
||||||
m_Type = AxisType.Value,
|
m_Type = AxisType.Value,
|
||||||
|
m_Min = 0,
|
||||||
|
m_Max = 0,
|
||||||
m_SplitNumber = 5,
|
m_SplitNumber = 5,
|
||||||
m_TextRotation = 0,
|
m_TextRotation = 0,
|
||||||
m_ShowSplitLine = false,
|
m_ShowSplitLine = false,
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ namespace XCharts
|
|||||||
CheckTooltip();
|
CheckTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
protected override void Reset()
|
protected override void Reset()
|
||||||
{
|
{
|
||||||
ChartHelper.DestoryAllChilds(transform);
|
ChartHelper.DestoryAllChilds(transform);
|
||||||
@@ -93,6 +94,7 @@ namespace XCharts
|
|||||||
InitLegend();
|
InitLegend();
|
||||||
InitTooltip();
|
InitTooltip();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
protected override void OnDestroy()
|
protected override void OnDestroy()
|
||||||
{
|
{
|
||||||
@@ -224,6 +226,7 @@ namespace XCharts
|
|||||||
anchorMin, anchorMax, pivot, new Vector2(m_Legend.itemWidth, m_Legend.itemHeight));
|
anchorMin, anchorMax, pivot, new Vector2(m_Legend.itemWidth, m_Legend.itemHeight));
|
||||||
|
|
||||||
m_Legend.SetButton(i, btn);
|
m_Legend.SetButton(i, btn);
|
||||||
|
m_Legend.SetActive(i, IsActive(i));
|
||||||
m_Legend.UpdateButtonColor(i, m_ThemeInfo.GetColor(i), m_ThemeInfo.unableColor);
|
m_Legend.UpdateButtonColor(i, m_ThemeInfo.GetColor(i), m_ThemeInfo.unableColor);
|
||||||
btn.GetComponentInChildren<Text>().text = m_Legend.data[i];
|
btn.GetComponentInChildren<Text>().text = m_Legend.data[i];
|
||||||
ChartHelper.AddEventListener(btn.gameObject, EventTriggerType.PointerDown, (data) =>
|
ChartHelper.AddEventListener(btn.gameObject, EventTriggerType.PointerDown, (data) =>
|
||||||
|
|||||||
@@ -335,7 +335,60 @@ namespace XCharts
|
|||||||
int tempMaxValue = 100;
|
int tempMaxValue = 100;
|
||||||
if (m_Series != null)
|
if (m_Series != null)
|
||||||
{
|
{
|
||||||
m_Series.GetMinMaxValue(m_Legend, out tempMinValue, out tempMaxValue);
|
m_Series.GetMinMaxValue(out tempMinValue, out tempMaxValue);
|
||||||
|
}
|
||||||
|
if (m_XAxis.type == Axis.AxisType.Value)
|
||||||
|
{
|
||||||
|
switch (m_XAxis.minMaxType)
|
||||||
|
{
|
||||||
|
case Axis.AxisMinMaxType.Default:
|
||||||
|
if (tempMinValue > 0 && tempMaxValue > 0)
|
||||||
|
{
|
||||||
|
tempMinValue = 0;
|
||||||
|
tempMaxValue = ChartHelper.GetMaxDivisibleValue(tempMaxValue);
|
||||||
|
}
|
||||||
|
else if (tempMinValue < 0 && tempMaxValue < 0)
|
||||||
|
{
|
||||||
|
tempMinValue = ChartHelper.GetMinDivisibleValue(tempMinValue);
|
||||||
|
tempMaxValue = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Axis.AxisMinMaxType.MinMax:
|
||||||
|
tempMinValue = ChartHelper.GetMinDivisibleValue(tempMinValue);
|
||||||
|
tempMaxValue = ChartHelper.GetMaxDivisibleValue(tempMaxValue);
|
||||||
|
break;
|
||||||
|
case Axis.AxisMinMaxType.Custom:
|
||||||
|
if (m_XAxis.min != 0) tempMinValue = m_XAxis.min;
|
||||||
|
if (m_XAxis.max != 0) tempMaxValue = m_XAxis.max;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_YAxis.type == Axis.AxisType.Value)
|
||||||
|
{
|
||||||
|
switch (m_YAxis.minMaxType)
|
||||||
|
{
|
||||||
|
case Axis.AxisMinMaxType.Default:
|
||||||
|
if (tempMinValue > 0 && tempMaxValue > 0)
|
||||||
|
{
|
||||||
|
tempMinValue = 0;
|
||||||
|
tempMaxValue = ChartHelper.GetMaxDivisibleValue(tempMaxValue);
|
||||||
|
}
|
||||||
|
else if (tempMinValue < 0 && tempMaxValue < 0)
|
||||||
|
{
|
||||||
|
tempMinValue = ChartHelper.GetMinDivisibleValue(tempMinValue);
|
||||||
|
tempMaxValue = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Axis.AxisMinMaxType.MinMax:
|
||||||
|
tempMinValue = ChartHelper.GetMinDivisibleValue(tempMinValue);
|
||||||
|
tempMaxValue = ChartHelper.GetMaxDivisibleValue(tempMaxValue);
|
||||||
|
break;
|
||||||
|
case Axis.AxisMinMaxType.Custom:
|
||||||
|
if (m_YAxis.min != 0) tempMinValue = m_YAxis.min;
|
||||||
|
if (m_YAxis.max != 0) tempMaxValue = m_YAxis.max;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (tempMinValue != minValue || tempMaxValue != maxValue)
|
if (tempMinValue != minValue || tempMaxValue != maxValue)
|
||||||
{
|
{
|
||||||
@@ -343,12 +396,12 @@ namespace XCharts
|
|||||||
maxValue = tempMaxValue;
|
maxValue = tempMaxValue;
|
||||||
if (m_XAxis.type == Axis.AxisType.Value)
|
if (m_XAxis.type == Axis.AxisType.Value)
|
||||||
{
|
{
|
||||||
m_ZeroXOffset = Mathf.Abs(minValue) * (coordinateWid / (Mathf.Abs(minValue) + Mathf.Abs(maxValue)));
|
m_ZeroXOffset = minValue > 0 ? 0 : Mathf.Abs(minValue) * (coordinateWid / (Mathf.Abs(minValue) + Mathf.Abs(maxValue)));
|
||||||
OnXMaxValueChanged();
|
OnXMaxValueChanged();
|
||||||
}
|
}
|
||||||
else if (m_YAxis.type == Axis.AxisType.Value)
|
else if (m_YAxis.type == Axis.AxisType.Value)
|
||||||
{
|
{
|
||||||
m_ZeroYOffset = Mathf.Abs(minValue) * (coordinateHig / (Mathf.Abs(minValue) + Mathf.Abs(maxValue)));
|
m_ZeroYOffset = minValue > 0 ? 0 : Mathf.Abs(minValue) * (coordinateHig / (Mathf.Abs(minValue) + Mathf.Abs(maxValue)));
|
||||||
OnYMaxValueChanged();
|
OnYMaxValueChanged();
|
||||||
}
|
}
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetMinMaxValue(Legend legend, out int minVaule, out int maxValue)
|
public void GetMinMaxValue(out int minVaule, out int maxValue)
|
||||||
{
|
{
|
||||||
float min = int.MaxValue;
|
float min = int.MaxValue;
|
||||||
float max = int.MinValue;
|
float max = int.MinValue;
|
||||||
@@ -199,7 +199,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
if (legend.IsActive(i))
|
if (IsActive(i))
|
||||||
{
|
{
|
||||||
if (m_Series[i].Max > max) max = m_Series[i].Max;
|
if (m_Series[i].Max > max) max = m_Series[i].Max;
|
||||||
if (m_Series[i].Min < min) min = m_Series[i].Min;
|
if (m_Series[i].Min < min) min = m_Series[i].Min;
|
||||||
@@ -211,21 +211,26 @@ namespace XCharts
|
|||||||
minVaule = 0;
|
minVaule = 0;
|
||||||
maxValue = 100;
|
maxValue = 100;
|
||||||
}
|
}
|
||||||
else if (max > 0 && min > 0)
|
|
||||||
{
|
|
||||||
minVaule = 0;
|
|
||||||
maxValue = ChartHelper.GetMaxDivisibleValue(max);
|
|
||||||
}
|
|
||||||
else if (min < 0 && max < 0)
|
|
||||||
{
|
|
||||||
minVaule = ChartHelper.GetMaxDivisibleValue(min);
|
|
||||||
maxValue = 0;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
minVaule = ChartHelper.GetMaxDivisibleValue(min);
|
minVaule = (int)min;
|
||||||
maxValue = ChartHelper.GetMaxDivisibleValue(max);
|
maxValue = (int)max;
|
||||||
}
|
}
|
||||||
|
//else if (max > 0 && min > 0)
|
||||||
|
//{
|
||||||
|
// minVaule = 0;
|
||||||
|
// maxValue = ChartHelper.GetMaxDivisibleValue(max);
|
||||||
|
//}
|
||||||
|
//else if (min < 0 && max < 0)
|
||||||
|
//{
|
||||||
|
// minVaule = ChartHelper.GetMaxDivisibleValue(min);
|
||||||
|
// maxValue = 0;
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// minVaule = ChartHelper.GetMaxDivisibleValue(min);
|
||||||
|
// maxValue = ChartHelper.GetMaxDivisibleValue(max);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetMaxValue(int index, int splitNumber = 0)
|
public float GetMaxValue(int index, int splitNumber = 0)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace XCharts
|
|||||||
Transform obj = transform;
|
Transform obj = transform;
|
||||||
while (obj.transform.parent)
|
while (obj.transform.parent)
|
||||||
{
|
{
|
||||||
name += "/"+obj.transform.parent.name;
|
name += "/" + obj.transform.parent.name;
|
||||||
obj = obj.transform.parent;
|
obj = obj.transform.parent;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
@@ -98,7 +98,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public static Text AddTextObject(string name, Transform parent, Font font, Color color,
|
public static Text AddTextObject(string name, Transform parent, Font font, Color color,
|
||||||
TextAnchor anchor, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 sizeDelta,
|
TextAnchor anchor, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 sizeDelta,
|
||||||
int fontSize = 14,float textRotation = 0)
|
int fontSize = 14, float textRotation = 0)
|
||||||
{
|
{
|
||||||
GameObject txtObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
|
GameObject txtObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
|
||||||
Text txt = GetOrAddComponent<Text>(txtObj);
|
Text txt = GetOrAddComponent<Text>(txtObj);
|
||||||
@@ -111,7 +111,7 @@ namespace XCharts
|
|||||||
txt.color = color;
|
txt.color = color;
|
||||||
if (textRotation > 0)
|
if (textRotation > 0)
|
||||||
{
|
{
|
||||||
txtObj.transform.localEulerAngles = new Vector3(0,0,textRotation);
|
txtObj.transform.localEulerAngles = new Vector3(0, 0, textRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
RectTransform rect = GetOrAddComponent<RectTransform>(txtObj);
|
RectTransform rect = GetOrAddComponent<RectTransform>(txtObj);
|
||||||
@@ -435,7 +435,7 @@ namespace XCharts
|
|||||||
if (Regex.IsMatch(jsonData, pattern))
|
if (Regex.IsMatch(jsonData, pattern))
|
||||||
{
|
{
|
||||||
MatchCollection m = Regex.Matches(jsonData, pattern);
|
MatchCollection m = Regex.Matches(jsonData, pattern);
|
||||||
foreach(Match match in m)
|
foreach (Match match in m)
|
||||||
{
|
{
|
||||||
list.Add(match.Groups[1].Value);
|
list.Add(match.Groups[1].Value);
|
||||||
}
|
}
|
||||||
@@ -460,22 +460,37 @@ namespace XCharts
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
float mm = bigger;
|
float mm = bigger;
|
||||||
if(mm > 10)
|
if (mm > 10)
|
||||||
{
|
{
|
||||||
mm = bigger - bigger % (Mathf.Pow(10, n));
|
mm = bigger - bigger % (Mathf.Pow(10, n));
|
||||||
//if (mm + Mathf.Pow(10, n) / 2 > bigger)
|
mm += max >0 ? Mathf.Pow(10, n) : -Mathf.Pow(10, n);
|
||||||
//{
|
|
||||||
// mm += Mathf.Pow(10, n) / 2;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
{
|
|
||||||
mm += Mathf.Pow(10, n);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (max < 0) return (int)-mm;
|
if (max < 0) return (int)-mm;
|
||||||
else return (int)mm;
|
else return (int)mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetMinDivisibleValue(float min)
|
||||||
|
{
|
||||||
|
if (min == 0) return 0;
|
||||||
|
int bigger = (int)Mathf.Abs(min);
|
||||||
|
int n = 1;
|
||||||
|
while (bigger / (Mathf.Pow(10, n)) > 10)
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
float mm = bigger;
|
||||||
|
if (mm > 10)
|
||||||
|
{
|
||||||
|
mm = bigger - bigger % (Mathf.Pow(10, n));
|
||||||
|
mm += min < 0 ? Mathf.Pow(10, n) : -Mathf.Pow(10, n);
|
||||||
|
}
|
||||||
|
if (min < 0)
|
||||||
|
{
|
||||||
|
return (int)-mm;
|
||||||
|
}
|
||||||
|
else return (int)mm;
|
||||||
|
}
|
||||||
|
|
||||||
public static void AddEventListener(GameObject obj, EventTriggerType type,
|
public static void AddEventListener(GameObject obj, EventTriggerType type,
|
||||||
UnityEngine.Events.UnityAction<BaseEventData> call)
|
UnityEngine.Events.UnityAction<BaseEventData> call)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user