mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 13:28:47 +00:00
优化代码,更好的支持自定义图表
This commit is contained in:
@@ -129,22 +129,17 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
EditorGUILayout.PropertyField(m_Script);
|
EditorGUILayout.PropertyField(m_Script);
|
||||||
EditorGUILayout.PropertyField(m_ChartName);
|
EditorGUILayout.PropertyField(m_ChartName);
|
||||||
}
|
|
||||||
BlockEnd();
|
|
||||||
var fileds = m_Chart.GetCustomChartInspectorShowFileds();
|
var fileds = m_Chart.GetCustomChartInspectorShowFileds();
|
||||||
if (fileds != null && fileds.Length > 0)
|
if (fileds != null && fileds.Length > 0)
|
||||||
{
|
|
||||||
BlockStart();
|
|
||||||
m_CustomFoldout = EditorGUILayout.Foldout(m_CustomFoldout, "Custom", true);
|
|
||||||
if (m_CustomFoldout)
|
|
||||||
{
|
{
|
||||||
foreach (var filed in fileds)
|
foreach (var filed in fileds)
|
||||||
{
|
{
|
||||||
EditorGUILayout.PropertyField(serializedObject.FindProperty(filed));
|
EditorGUILayout.PropertyField(serializedObject.FindProperty(filed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlockEnd();
|
|
||||||
}
|
}
|
||||||
|
BlockEnd();
|
||||||
|
|
||||||
BlockField(m_Theme);
|
BlockField(m_Theme);
|
||||||
BlockField(m_Settings);
|
BlockField(m_Settings);
|
||||||
BlockField(m_Background);
|
BlockField(m_Background);
|
||||||
@@ -220,7 +215,8 @@ namespace XCharts
|
|||||||
var rect1 = new Rect(currRect.width + k_IconXOffset,
|
var rect1 = new Rect(currRect.width + k_IconXOffset,
|
||||||
currRect.y + k_IconYOffset,
|
currRect.y + k_IconYOffset,
|
||||||
k_IconWidth, EditorGUIUtility.singleLineHeight);
|
k_IconWidth, EditorGUIUtility.singleLineHeight);
|
||||||
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconAdd, ChartEditorHelper.Styles.invisibleButton))
|
EditorGUI.DrawRect(rect1, Color.blue);
|
||||||
|
if (GUI.Button(rect1, ChartEditorHelper.Styles.iconAdd))// ChartEditorHelper.Styles.invisibleButton))
|
||||||
{
|
{
|
||||||
prop.InsertArrayElementAtIndex(prop.arraySize > 0 ? prop.arraySize - 1 : 0);
|
prop.InsertArrayElementAtIndex(prop.arraySize > 0 ? prop.arraySize - 1 : 0);
|
||||||
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
|
var chart = prop.GetArrayElementAtIndex(0).serializedObject.targetObject as BaseChart;
|
||||||
|
|||||||
@@ -757,7 +757,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal float GetCurrMinValue(float duration)
|
public float GetCurrMinValue(float duration)
|
||||||
{
|
{
|
||||||
if (!Application.isPlaying) return m_RuntimeMinValue;
|
if (!Application.isPlaying) return m_RuntimeMinValue;
|
||||||
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
||||||
@@ -777,7 +777,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal float GetCurrMaxValue(float duration)
|
public float GetCurrMaxValue(float duration)
|
||||||
{
|
{
|
||||||
if (!Application.isPlaying) return m_RuntimeMaxValue;
|
if (!Application.isPlaying) return m_RuntimeMaxValue;
|
||||||
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
||||||
|
|||||||
@@ -1029,7 +1029,7 @@ namespace XCharts
|
|||||||
public float runtimePieDataTotal { get; internal set; }
|
public float runtimePieDataTotal { get; internal set; }
|
||||||
public float runtimeWaveSpeed { get; internal set; }
|
public float runtimeWaveSpeed { get; internal set; }
|
||||||
public Painter runtimeCanvas { get; internal set; }
|
public Painter runtimeCanvas { get; internal set; }
|
||||||
internal float runtimeCheckValue { get; set; }
|
public float runtimeCheckValue { get; set; }
|
||||||
public int runtimeGridIndex { get; internal set; }
|
public int runtimeGridIndex { get; internal set; }
|
||||||
public float runtimeX { get; internal set; }
|
public float runtimeX { get; internal set; }
|
||||||
public float runtimeY { get; internal set; }
|
public float runtimeY { get; internal set; }
|
||||||
@@ -1644,7 +1644,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal float GetBarWidth(float categoryWidth)
|
public float GetBarWidth(float categoryWidth)
|
||||||
{
|
{
|
||||||
if (m_BarWidth > 1) return m_BarWidth;
|
if (m_BarWidth > 1) return m_BarWidth;
|
||||||
else return m_BarWidth * categoryWidth;
|
else return m_BarWidth * categoryWidth;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace XCharts
|
|||||||
private Image m_ContentImage;
|
private Image m_ContentImage;
|
||||||
private RectTransform m_ContentRect;
|
private RectTransform m_ContentRect;
|
||||||
private RectTransform m_ContentTextRect;
|
private RectTransform m_ContentTextRect;
|
||||||
private List<int> lastDataIndex { get; set; }
|
private List<int> lastDataIndex = new List<int>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to show the tooltip component.
|
/// Whether to show the tooltip component.
|
||||||
@@ -246,22 +246,25 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前提示框所指示的Serie索引(目前只对散点图有效)。
|
/// 当前提示框所指示的Serie索引(目前只对散点图有效)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<int, List<int>> runtimeSerieIndex { get; internal set; }
|
public Dictionary<int, List<int>> runtimeSerieIndex = new Dictionary<int, List<int>>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The data index currently indicated by Tooltip.
|
/// The data index currently indicated by Tooltip.
|
||||||
/// 当前提示框所指示的数据项索引。
|
/// 当前提示框所指示的数据项索引。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<int> runtimeDataIndex { get; internal set; }
|
public List<int> runtimeDataIndex { get { return m_RuntimeDateIndex; } internal set { m_RuntimeDateIndex = value; } }
|
||||||
|
private List<int> m_RuntimeDateIndex = new List<int>() { -1, -1 };
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the value for x indicator label.
|
/// the value for x indicator label.
|
||||||
/// 指示器X轴上要显示的值。
|
/// 指示器X轴上要显示的值。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float[] runtimeXValues { get; internal set; }
|
public float[] runtimeXValues { get { return m_RuntimeXValue; } internal set { m_RuntimeXValue = value; } }
|
||||||
|
private float[] m_RuntimeXValue = new float[2] { -1, -1 };
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the value for y indicator label.
|
/// the value for y indicator label.
|
||||||
/// 指示器Y轴上要显示的值。
|
/// 指示器Y轴上要显示的值。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float[] runtimeYValues { get; internal set; }
|
public float[] runtimeYValues { get { return m_RuntimeYValue; } internal set { m_RuntimeYValue = value; } }
|
||||||
|
private float[] m_RuntimeYValue = new float[2] { -1, -1 };
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the current pointer position.
|
/// the current pointer position.
|
||||||
/// 当前鼠标位置。
|
/// 当前鼠标位置。
|
||||||
@@ -303,12 +306,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var tooltip = new Tooltip
|
var tooltip = new Tooltip
|
||||||
{
|
{
|
||||||
m_Show = true,
|
m_Show = true
|
||||||
runtimeXValues = new float[2] { -1, -1 },
|
|
||||||
runtimeYValues = new float[2] { -1, -1 },
|
|
||||||
runtimeDataIndex = new List<int>() { -1, -1 },
|
|
||||||
lastDataIndex = new List<int>() { -1, -1 },
|
|
||||||
runtimeSerieIndex = new Dictionary<int, List<int>>()
|
|
||||||
};
|
};
|
||||||
return tooltip;
|
return tooltip;
|
||||||
}
|
}
|
||||||
@@ -438,6 +436,7 @@ namespace XCharts
|
|||||||
public void SetActive(bool flag)
|
public void SetActive(bool flag)
|
||||||
{
|
{
|
||||||
if (!flag && m_AlwayShow) return;
|
if (!flag && m_AlwayShow) return;
|
||||||
|
if (lastDataIndex.Count >= 2)
|
||||||
lastDataIndex[0] = lastDataIndex[1] = -1;
|
lastDataIndex[0] = lastDataIndex[1] = -1;
|
||||||
if (m_GameObject && m_GameObject.activeInHierarchy != flag)
|
if (m_GameObject && m_GameObject.activeInHierarchy != flag)
|
||||||
m_GameObject.SetActive(flag);
|
m_GameObject.SetActive(flag);
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AllBarEnd()
|
public void AllBarEnd()
|
||||||
{
|
{
|
||||||
End();
|
End();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,10 +191,10 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 绘制区域。
|
/// 绘制区域。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Rect runtimeRect { get; internal set; }
|
public Rect runtimeRect { get; set; }
|
||||||
public float runtimeAngle { get; internal set; }
|
public float runtimeAngle { get; set; }
|
||||||
public Vector3 runtiemPieOffsetCenter { get; internal set; }
|
public Vector3 runtiemPieOffsetCenter { get; set; }
|
||||||
public float runtimeStackHig { get; internal set; }
|
public float runtimeStackHig { get; set; }
|
||||||
private List<float> m_PreviousData = new List<float>();
|
private List<float> m_PreviousData = new List<float>();
|
||||||
private List<float> m_DataUpdateTime = new List<float>();
|
private List<float> m_DataUpdateTime = new List<float>();
|
||||||
private List<bool> m_DataUpdateFlag = new List<bool>();
|
private List<bool> m_DataUpdateFlag = new List<bool>();
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace XCharts
|
|||||||
/// <param name="maxValue"></param>
|
/// <param name="maxValue"></param>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static string GetLabelName(Axis axis, float coordinateWidth, int index, float minValue, float maxValue,
|
public static string GetLabelName(Axis axis, float coordinateWidth, int index, float minValue, float maxValue,
|
||||||
DataZoom dataZoom, bool forcePercent)
|
DataZoom dataZoom, bool forcePercent)
|
||||||
{
|
{
|
||||||
int split = GetSplitNumber(axis, coordinateWidth, dataZoom);
|
int split = GetSplitNumber(axis, coordinateWidth, dataZoom);
|
||||||
@@ -208,7 +208,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)
|
public static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)
|
||||||
{
|
{
|
||||||
int splitNum = GetSplitNumber(axis, coordinateWidth, dataZoom);
|
int splitNum = GetSplitNumber(axis, coordinateWidth, dataZoom);
|
||||||
if (axis.IsCategory())
|
if (axis.IsCategory())
|
||||||
@@ -232,7 +232,7 @@ namespace XCharts
|
|||||||
/// <param name="coordinateWidth"></param>
|
/// <param name="coordinateWidth"></param>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)
|
public static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)
|
||||||
{
|
{
|
||||||
if (index < 0) return 0;
|
if (index < 0) return 0;
|
||||||
int num = GetScaleNumber(axis, coordinateWidth, dataZoom);
|
int num = GetScaleNumber(axis, coordinateWidth, dataZoom);
|
||||||
@@ -268,7 +268,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static float GetEachWidth(Axis axis, float coordinateWidth, DataZoom dataZoom = null)
|
public static float GetEachWidth(Axis axis, float coordinateWidth, DataZoom dataZoom = null)
|
||||||
{
|
{
|
||||||
var data = axis.GetDataList();
|
var data = axis.GetDataList();
|
||||||
if (data.Count > 0)
|
if (data.Count > 0)
|
||||||
@@ -288,7 +288,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="minValue"></param>
|
/// <param name="minValue"></param>
|
||||||
/// <param name="maxValue"></param>
|
/// <param name="maxValue"></param>
|
||||||
internal static void AdjustMinMaxValue(Axis axis, ref float minValue, ref float maxValue, bool needFormat, int ceilRate = 0)
|
public static void AdjustMinMaxValue(Axis axis, ref float minValue, ref float maxValue, bool needFormat, int ceilRate = 0)
|
||||||
{
|
{
|
||||||
if (axis.type == Axis.AxisType.Log)
|
if (axis.type == Axis.AxisType.Log)
|
||||||
{
|
{
|
||||||
@@ -357,7 +357,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool NeedShowSplit(Axis axis)
|
public static bool NeedShowSplit(Axis axis)
|
||||||
{
|
{
|
||||||
if (!axis.show) return false;
|
if (!axis.show) return false;
|
||||||
if (axis.IsCategory() && axis.GetDataList().Count <= 0) return false;
|
if (axis.IsCategory() && axis.GetDataList().Count <= 0) return false;
|
||||||
@@ -365,7 +365,7 @@ namespace XCharts
|
|||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void AdjustCircleLabelPos(ChartText txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
|
public static void AdjustCircleLabelPos(ChartText txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
|
||||||
{
|
{
|
||||||
var txtWidth = txt.GetPreferredWidth();
|
var txtWidth = txt.GetPreferredWidth();
|
||||||
var sizeDelta = new Vector2(txtWidth, txt.GetPreferredHeight());
|
var sizeDelta = new Vector2(txtWidth, txt.GetPreferredHeight());
|
||||||
@@ -387,7 +387,7 @@ namespace XCharts
|
|||||||
txt.SetLocalPosition(pos + offset);
|
txt.SetLocalPosition(pos + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void AdjustRadiusAxisLabelPos(ChartText txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
|
public static void AdjustRadiusAxisLabelPos(ChartText txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)
|
||||||
{
|
{
|
||||||
var txtWidth = txt.GetPreferredWidth();
|
var txtWidth = txt.GetPreferredWidth();
|
||||||
var sizeDelta = new Vector2(txtWidth, txt.GetPreferredHeight());
|
var sizeDelta = new Vector2(txtWidth, txt.GetPreferredHeight());
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 502c2be6d197b40f59ae65d9c659700f
|
guid: ca154a2444b924ff98ce6091280227c8
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -4,12 +4,10 @@
|
|||||||
/* https://github.com/monitor1394 */
|
/* https://github.com/monitor1394 */
|
||||||
/* */
|
/* */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
internal static class ItemStyleHelper
|
public static class ItemStyleHelper
|
||||||
{
|
{
|
||||||
public static bool IsNeedCorner(ItemStyle itemStyle)
|
public static bool IsNeedCorner(ItemStyle itemStyle)
|
||||||
{
|
{
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 14c20b85c2c6d44b08f57c928307080d
|
guid: 521b0ebf9d94445ec8478185c82da10f
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -9,7 +9,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
internal static class LegendHelper
|
public static class LegendHelper
|
||||||
{
|
{
|
||||||
public static Color GetContentColor(Legend legend, ChartTheme theme, bool active)
|
public static Color GetContentColor(Legend legend, ChartTheme theme, bool active)
|
||||||
{
|
{
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d03ce7a11ecde41b6930883612bf8f05
|
guid: 270acce470d13484f926a0468376b324
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -127,5 +128,417 @@ namespace XCharts
|
|||||||
serie.runtimeCenterPos = chartPosition + new Vector3(chartWidth / 2, chartHeight / 2);
|
serie.runtimeCenterPos = chartPosition + new Vector3(chartWidth / 2, chartHeight / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Color32 GetItemBackgroundColor(Serie serie, SerieData serieData, ChartTheme theme, int index,
|
||||||
|
bool highlight, bool useDefault = true)
|
||||||
|
{
|
||||||
|
var color = ChartConst.clearColor32;
|
||||||
|
if (highlight)
|
||||||
|
{
|
||||||
|
var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
|
||||||
|
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.backgroundColor))
|
||||||
|
{
|
||||||
|
color = itemStyleEmphasis.backgroundColor;
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var itemStyle = GetItemStyle(serie, serieData);
|
||||||
|
if (!ChartHelper.IsClearColor(itemStyle.backgroundColor))
|
||||||
|
{
|
||||||
|
color = itemStyle.backgroundColor;
|
||||||
|
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
else if (useDefault)
|
||||||
|
{
|
||||||
|
color = theme.GetColor(index);
|
||||||
|
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||||
|
color.a = 50;
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color32 GetItemColor(Serie serie, SerieData serieData, ChartTheme theme, int index, bool highlight)
|
||||||
|
{
|
||||||
|
if (serie == null) return ChartConst.clearColor32;
|
||||||
|
if (highlight)
|
||||||
|
{
|
||||||
|
var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
|
||||||
|
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.color))
|
||||||
|
{
|
||||||
|
var color = itemStyleEmphasis.color;
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var itemStyle = GetItemStyle(serie, serieData);
|
||||||
|
if (!ChartHelper.IsClearColor(itemStyle.color))
|
||||||
|
{
|
||||||
|
return itemStyle.GetColor();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var color = theme.GetColor(index);
|
||||||
|
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static Color32 GetItemColor0(Serie serie, SerieData serieData, ChartTheme theme, bool highlight, Color32 defaultColor)
|
||||||
|
{
|
||||||
|
if (serie == null) return ChartConst.clearColor32;
|
||||||
|
if (highlight)
|
||||||
|
{
|
||||||
|
var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
|
||||||
|
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.color))
|
||||||
|
{
|
||||||
|
var color = itemStyleEmphasis.color0;
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var itemStyle = GetItemStyle(serie, serieData);
|
||||||
|
if (!ChartHelper.IsClearColor(itemStyle.color0))
|
||||||
|
{
|
||||||
|
return itemStyle.GetColor0();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var color = defaultColor;
|
||||||
|
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color32 GetItemToColor(Serie serie, SerieData serieData, ChartTheme theme, int index, bool highlight)
|
||||||
|
{
|
||||||
|
if (highlight)
|
||||||
|
{
|
||||||
|
var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
|
||||||
|
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.toColor))
|
||||||
|
{
|
||||||
|
return itemStyleEmphasis.GetColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
||||||
|
if (itemStyle == null) itemStyle = serieData.itemStyle;
|
||||||
|
if (!ChartHelper.IsClearColor(itemStyle.toColor))
|
||||||
|
{
|
||||||
|
var color = itemStyle.toColor;
|
||||||
|
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
if (!ChartHelper.IsClearColor(itemStyle.color))
|
||||||
|
{
|
||||||
|
var color = itemStyle.color;
|
||||||
|
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var color = theme.GetColor(index);
|
||||||
|
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsDownPoint(Serie serie, int index)
|
||||||
|
{
|
||||||
|
var dataPoints = serie.dataPoints;
|
||||||
|
if (dataPoints.Count < 2) return false;
|
||||||
|
else if (index > 0 && index < dataPoints.Count - 1)
|
||||||
|
{
|
||||||
|
var lp = dataPoints[index - 1];
|
||||||
|
var np = dataPoints[index + 1];
|
||||||
|
var cp = dataPoints[index];
|
||||||
|
var dot = Vector3.Cross(np - lp, cp - np);
|
||||||
|
return dot.z < 0;
|
||||||
|
}
|
||||||
|
else if (index == 0)
|
||||||
|
{
|
||||||
|
return dataPoints[0].y < dataPoints[1].y;
|
||||||
|
}
|
||||||
|
else if (index == dataPoints.Count - 1)
|
||||||
|
{
|
||||||
|
return dataPoints[index].y < dataPoints[index - 1].y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, bool highlight = false)
|
||||||
|
{
|
||||||
|
if (highlight)
|
||||||
|
{
|
||||||
|
var style = GetItemStyleEmphasis(serie, serieData);
|
||||||
|
if (style == null) return GetItemStyle(serie, serieData, false);
|
||||||
|
else return style;
|
||||||
|
}
|
||||||
|
else if (serie.IsPerformanceMode()) return serie.itemStyle;
|
||||||
|
else if (serieData != null && serieData.enableItemStyle) return serieData.itemStyle;
|
||||||
|
else return serie.itemStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStyle GetItemStyleEmphasis(Serie serie, SerieData serieData)
|
||||||
|
{
|
||||||
|
if (!serie.IsPerformanceMode() && serieData != null && serieData.enableEmphasis && serieData.emphasis.show)
|
||||||
|
return serieData.emphasis.itemStyle;
|
||||||
|
else if (serie.emphasis.show) return serie.emphasis.itemStyle;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SerieLabel GetSerieLabel(Serie serie, SerieData serieData, bool highlight = false)
|
||||||
|
{
|
||||||
|
if (highlight)
|
||||||
|
{
|
||||||
|
if (!serie.IsPerformanceMode() && serieData.enableEmphasis && serieData.emphasis.show)
|
||||||
|
return serieData.emphasis.label;
|
||||||
|
else if (serie.emphasis.show) return serie.emphasis.label;
|
||||||
|
else return serie.label;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!serie.IsPerformanceMode() && serieData.enableLabel) return serieData.label;
|
||||||
|
else return serie.label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData)
|
||||||
|
{
|
||||||
|
if (!serie.IsPerformanceMode() && serieData.enableSymbol) return serieData.symbol;
|
||||||
|
else return serie.symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color32 GetAreaColor(Serie serie, ChartTheme theme, int index, bool highlight)
|
||||||
|
{
|
||||||
|
var areaStyle = serie.areaStyle;
|
||||||
|
var color = !ChartHelper.IsClearColor(areaStyle.color) ? areaStyle.color : theme.GetColor(index);
|
||||||
|
if (highlight)
|
||||||
|
{
|
||||||
|
if (!ChartHelper.IsClearColor(areaStyle.highlightColor)) color = areaStyle.highlightColor;
|
||||||
|
else color = ChartHelper.GetHighlightColor(color);
|
||||||
|
}
|
||||||
|
ChartHelper.SetColorOpacity(ref color, areaStyle.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color32 GetAreaToColor(Serie serie, ChartTheme theme, int index, bool highlight)
|
||||||
|
{
|
||||||
|
var areaStyle = serie.areaStyle;
|
||||||
|
if (!ChartHelper.IsClearColor(areaStyle.toColor))
|
||||||
|
{
|
||||||
|
var color = areaStyle.toColor;
|
||||||
|
if (highlight)
|
||||||
|
{
|
||||||
|
if (!ChartHelper.IsClearColor(areaStyle.highlightToColor)) color = areaStyle.highlightToColor;
|
||||||
|
else color = ChartHelper.GetHighlightColor(color);
|
||||||
|
}
|
||||||
|
ChartHelper.SetColorOpacity(ref color, areaStyle.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return GetAreaColor(serie, theme, index, highlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color32 GetLineColor(Serie serie, ChartTheme theme, int index, bool highlight)
|
||||||
|
{
|
||||||
|
Color32 color = ChartConst.clearColor32;
|
||||||
|
if (highlight)
|
||||||
|
{
|
||||||
|
var itemStyleEmphasis = GetItemStyleEmphasis(serie, null);
|
||||||
|
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.color))
|
||||||
|
{
|
||||||
|
color = itemStyleEmphasis.color;
|
||||||
|
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ChartHelper.IsClearColor(serie.lineStyle.color)) color = serie.lineStyle.GetColor();
|
||||||
|
else if (!ChartHelper.IsClearColor(serie.itemStyle.color)) color = serie.itemStyle.GetColor();
|
||||||
|
if (ChartHelper.IsClearColor(color))
|
||||||
|
{
|
||||||
|
color = theme.GetColor(index);
|
||||||
|
ChartHelper.SetColorOpacity(ref color, serie.lineStyle.opacity);
|
||||||
|
}
|
||||||
|
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float GetSymbolBorder(Serie serie, SerieData serieData, ChartTheme theme, bool highlight, bool useLineWidth = true)
|
||||||
|
{
|
||||||
|
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
||||||
|
if (itemStyle != null && itemStyle.borderWidth != 0) return itemStyle.borderWidth;
|
||||||
|
else return serie.lineStyle.GetWidth(theme.serie.lineWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, bool highlight)
|
||||||
|
{
|
||||||
|
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
||||||
|
if (itemStyle != null) return itemStyle.cornerRadius;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetNumericFormatter(Serie serie, SerieData serieData)
|
||||||
|
{
|
||||||
|
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
||||||
|
if (!string.IsNullOrEmpty(itemStyle.numericFormatter)) return itemStyle.numericFormatter;
|
||||||
|
else return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得指定维数的最大最小值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dimension"></param>
|
||||||
|
/// <param name="dataZoom"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static void UpdateMinMaxData(Serie serie, int dimension, int ceilRate = 0, DataZoom dataZoom = null)
|
||||||
|
{
|
||||||
|
float min = 0, max = 0;
|
||||||
|
GetMinMaxData(serie, dimension, out min, out max, dataZoom);
|
||||||
|
if (ceilRate < 0)
|
||||||
|
{
|
||||||
|
serie.runtimeDataMin = min;
|
||||||
|
serie.runtimeDataMax = max;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serie.runtimeDataMin = ChartHelper.GetMinDivisibleValue(min, ceilRate);
|
||||||
|
serie.runtimeDataMax = ChartHelper.GetMaxDivisibleValue(max, ceilRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GetAllMinMaxData(Serie serie, int ceilRate = 0, DataZoom dataZoom = null)
|
||||||
|
{
|
||||||
|
float min = 0, max = 0;
|
||||||
|
GetMinMaxData(serie, out min, out max, dataZoom);
|
||||||
|
if (ceilRate < 0)
|
||||||
|
{
|
||||||
|
serie.runtimeDataMin = min;
|
||||||
|
serie.runtimeDataMax = max;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serie.runtimeDataMin = ChartHelper.GetMinDivisibleValue(min, ceilRate);
|
||||||
|
serie.runtimeDataMax = ChartHelper.GetMaxDivisibleValue(max, ceilRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<SerieData> emptyFilter = new List<SerieData>();
|
||||||
|
/// <summary>
|
||||||
|
/// 根据dataZoom更新数据列表缓存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataZoom"></param>
|
||||||
|
public static void UpdateFilterData(Serie serie, DataZoom dataZoom)
|
||||||
|
{
|
||||||
|
if (dataZoom == null || !dataZoom.enable) return;
|
||||||
|
if (dataZoom.xAxisIndexs.Contains(serie.xAxisIndex))
|
||||||
|
{
|
||||||
|
if (dataZoom.IsXAxisIndexValue(serie.xAxisIndex))
|
||||||
|
{
|
||||||
|
float min = 0, max = 0;
|
||||||
|
dataZoom.GetXAxisIndexValue(serie.xAxisIndex, out min, out max);
|
||||||
|
UpdateFilterData_XAxisValue(serie, dataZoom, 0, min, max);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UpdateFilterData_Category(serie, dataZoom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (dataZoom.yAxisIndexs.Contains(serie.yAxisIndex))
|
||||||
|
{
|
||||||
|
if (dataZoom.IsYAxisIndexValue(serie.yAxisIndex))
|
||||||
|
{
|
||||||
|
float min = 0, max = 0;
|
||||||
|
dataZoom.GetYAxisIndexValue(serie.yAxisIndex, out min, out max);
|
||||||
|
UpdateFilterData_XAxisValue(serie, dataZoom, 0, min, max);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UpdateFilterData_Category(serie, dataZoom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UpdateFilterData_XAxisValue(Serie serie, DataZoom dataZoom, int dimension, float min, float max)
|
||||||
|
{
|
||||||
|
var data = serie.data;
|
||||||
|
var startValue = min + (max - min) * dataZoom.start / 100;
|
||||||
|
var endValue = min + (max - min) * dataZoom.end / 100;
|
||||||
|
if (endValue < startValue) endValue = startValue;
|
||||||
|
|
||||||
|
if (startValue != serie.m_FilterStartValue || endValue != serie.m_FilterEndValue
|
||||||
|
|| dataZoom.minShowNum != serie.m_FilterMinShow || serie.m_NeedUpdateFilterData)
|
||||||
|
{
|
||||||
|
serie.m_FilterStartValue = startValue;
|
||||||
|
serie.m_FilterEndValue = endValue;
|
||||||
|
serie.m_FilterMinShow = dataZoom.minShowNum;
|
||||||
|
serie.m_NeedUpdateFilterData = false;
|
||||||
|
|
||||||
|
serie.m_FilterData.Clear();
|
||||||
|
foreach (var serieData in data)
|
||||||
|
{
|
||||||
|
var value = serieData.GetData(dimension);
|
||||||
|
if (value >= startValue && value <= endValue)
|
||||||
|
{
|
||||||
|
serie.m_FilterData.Add(serieData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (endValue == 0)
|
||||||
|
{
|
||||||
|
serie.m_FilterData = emptyFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UpdateFilterData_Category(Serie serie, DataZoom dataZoom)
|
||||||
|
{
|
||||||
|
var data = serie.data;
|
||||||
|
var startIndex = (int)((data.Count - 1) * dataZoom.start / 100);
|
||||||
|
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
|
||||||
|
if (endIndex < startIndex) endIndex = startIndex;
|
||||||
|
|
||||||
|
if (startIndex != serie.m_FilterStart || endIndex != serie.m_FilterEnd
|
||||||
|
|| dataZoom.minShowNum != serie.m_FilterMinShow || serie.m_NeedUpdateFilterData)
|
||||||
|
{
|
||||||
|
serie.m_FilterStart = startIndex;
|
||||||
|
serie.m_FilterEnd = endIndex;
|
||||||
|
serie.m_FilterMinShow = dataZoom.minShowNum;
|
||||||
|
serie.m_NeedUpdateFilterData = false;
|
||||||
|
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
||||||
|
if (count < dataZoom.minShowNum)
|
||||||
|
{
|
||||||
|
if (dataZoom.minShowNum > data.Count) count = data.Count;
|
||||||
|
else count = dataZoom.minShowNum;
|
||||||
|
}
|
||||||
|
if (data.Count > 0)
|
||||||
|
{
|
||||||
|
if (startIndex + count > data.Count)
|
||||||
|
{
|
||||||
|
int start = endIndex - count;
|
||||||
|
data = data.GetRange(start < 0 ? 0 : start, count);
|
||||||
|
}
|
||||||
|
else serie.m_FilterData = data.GetRange(startIndex, count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serie.m_FilterData = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (endIndex == 0)
|
||||||
|
{
|
||||||
|
serie.m_FilterData = emptyFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,7 +232,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void AvoidLabelOverlap(Serie serie)
|
public static void AvoidLabelOverlap(Serie serie)
|
||||||
{
|
{
|
||||||
if (!serie.avoidLabelOverlap) return;
|
if (!serie.avoidLabelOverlap) return;
|
||||||
var lastCheckPos = Vector3.zero;
|
var lastCheckPos = Vector3.zero;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: bbd57df98f6f145f299cf942b04229a4
|
guid: 0b81cddd3452545748563f9c6ea9be69
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -89,7 +89,7 @@ namespace XCharts
|
|||||||
/// 获得所有系列名,不包含空名字。
|
/// 获得所有系列名,不包含空名字。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static void UpdateSerieNameList(Series series, ref List<string> serieNameList)
|
public static void UpdateSerieNameList(Series series, ref List<string> serieNameList)
|
||||||
{
|
{
|
||||||
serieNameList.Clear();
|
serieNameList.Clear();
|
||||||
for (int n = 0; n < series.list.Count; n++)
|
for (int n = 0; n < series.list.Count; n++)
|
||||||
@@ -119,7 +119,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Color GetNameColor(Series series, int index, string name, ChartTheme theme)
|
public static Color GetNameColor(Series series, int index, string name, ChartTheme theme)
|
||||||
{
|
{
|
||||||
Serie destSerie = null;
|
Serie destSerie = null;
|
||||||
SerieData destSerieData = null;
|
SerieData destSerieData = null;
|
||||||
@@ -160,7 +160,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stack"></param>
|
/// <param name="stack"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static bool IsAnyGradientSerie(Series series, string stack)
|
public static bool IsAnyGradientSerie(Series series, string stack)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(stack)) return false;
|
if (string.IsNullOrEmpty(stack)) return false;
|
||||||
foreach (var serie in series.list)
|
foreach (var serie in series.list)
|
||||||
@@ -179,7 +179,7 @@ namespace XCharts
|
|||||||
/// 是否有需裁剪的serie。
|
/// 是否有需裁剪的serie。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static bool IsAnyClipSerie(Series series)
|
public static bool IsAnyClipSerie(Series series)
|
||||||
{
|
{
|
||||||
foreach (var serie in series.list)
|
foreach (var serie in series.list)
|
||||||
{
|
{
|
||||||
@@ -188,7 +188,7 @@ namespace XCharts
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool ContainsSerie(Series series, SerieType type)
|
public static bool ContainsSerie(Series series, SerieType type)
|
||||||
{
|
{
|
||||||
foreach (var serie in series.list)
|
foreach (var serie in series.list)
|
||||||
{
|
{
|
||||||
@@ -197,7 +197,7 @@ namespace XCharts
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool IsAnyUpdateAnimationSerie(Series series)
|
public static bool IsAnyUpdateAnimationSerie(Series series)
|
||||||
{
|
{
|
||||||
foreach (var serie in series.list)
|
foreach (var serie in series.list)
|
||||||
{
|
{
|
||||||
@@ -214,7 +214,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serie"></param>
|
/// <param name="serie"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static Serie GetLastStackSerie(Series series, Serie serie)
|
public static Serie GetLastStackSerie(Series series, Serie serie)
|
||||||
{
|
{
|
||||||
if (serie == null || string.IsNullOrEmpty(serie.stack)) return null;
|
if (serie == null || string.IsNullOrEmpty(serie.stack)) return null;
|
||||||
for (int i = serie.index - 1; i >= 0; i--)
|
for (int i = serie.index - 1; i >= 0; i--)
|
||||||
@@ -230,13 +230,13 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static Serie GetLastStackSerie(Series series, int index)
|
public static Serie GetLastStackSerie(Series series, int index)
|
||||||
{
|
{
|
||||||
var serie = series.GetSerie(index);
|
var serie = series.GetSerie(index);
|
||||||
return GetLastStackSerie(series, serie);
|
return GetLastStackSerie(series, serie);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Serie GetSerieByVesselIndex(Series series, int vesselIndex)
|
public static Serie GetSerieByVesselIndex(Series series, int vesselIndex)
|
||||||
{
|
{
|
||||||
foreach (var serie in series.list)
|
foreach (var serie in series.list)
|
||||||
{
|
{
|
||||||
@@ -250,7 +250,7 @@ namespace XCharts
|
|||||||
/// 是否由数据堆叠
|
/// 是否由数据堆叠
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static bool IsStack(Series series)
|
public static bool IsStack(Series series)
|
||||||
{
|
{
|
||||||
_setForStack.Clear();
|
_setForStack.Clear();
|
||||||
foreach (var serie in series.list)
|
foreach (var serie in series.list)
|
||||||
@@ -271,7 +271,7 @@ namespace XCharts
|
|||||||
/// <param name="stackName"></param>
|
/// <param name="stackName"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static bool IsStack(Series series, string stackName, SerieType type)
|
public static bool IsStack(Series series, string stackName, SerieType type)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(stackName)) return false;
|
if (string.IsNullOrEmpty(stackName)) return false;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -291,7 +291,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static bool IsPercentStack(Series series, SerieType type)
|
public static bool IsPercentStack(Series series, SerieType type)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool isPercentStack = false;
|
bool isPercentStack = false;
|
||||||
@@ -316,7 +316,7 @@ namespace XCharts
|
|||||||
/// <param name="stackName"></param>
|
/// <param name="stackName"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static bool IsPercentStack(Series series, string stackName, SerieType type)
|
public static bool IsPercentStack(Series series, string stackName, SerieType type)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(stackName)) return false;
|
if (string.IsNullOrEmpty(stackName)) return false;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -342,7 +342,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Dictionary<int"></param>
|
/// <param name="Dictionary<int"></param>
|
||||||
/// <param name="stackSeries"></param>
|
/// <param name="stackSeries"></param>
|
||||||
internal static void GetStackSeries(Series series, ref Dictionary<int, List<Serie>> stackSeries)
|
public static void GetStackSeries(Series series, ref Dictionary<int, List<Serie>> stackSeries)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
var serieCount = series.list.Count;
|
var serieCount = series.list.Count;
|
||||||
@@ -388,7 +388,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void UpdateStackDataList(Series series, Serie currSerie, DataZoom dataZoom, List<List<SerieData>> dataList)
|
public static void UpdateStackDataList(Series series, Serie currSerie, DataZoom dataZoom, List<List<SerieData>> dataList)
|
||||||
{
|
{
|
||||||
dataList.Clear();
|
dataList.Clear();
|
||||||
for (int i = 0; i <= currSerie.index; i++)
|
for (int i = 0; i <= currSerie.index; i++)
|
||||||
@@ -408,7 +408,7 @@ namespace XCharts
|
|||||||
/// <param name="axisIndex"></param>
|
/// <param name="axisIndex"></param>
|
||||||
/// <param name="minVaule"></param>
|
/// <param name="minVaule"></param>
|
||||||
/// <param name="maxValue"></param>
|
/// <param name="maxValue"></param>
|
||||||
internal static void GetXMinMaxValue(Series series, DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
public static void GetXMinMaxValue(Series series, DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
||||||
bool inverse, out float minVaule, out float maxValue, bool isPolar = false)
|
bool inverse, out float minVaule, out float maxValue, bool isPolar = false)
|
||||||
{
|
{
|
||||||
GetMinMaxValue(series, dataZoom, axisIndex, isValueAxis, inverse, false, out minVaule, out maxValue, isPolar);
|
GetMinMaxValue(series, dataZoom, axisIndex, isValueAxis, inverse, false, out minVaule, out maxValue, isPolar);
|
||||||
@@ -421,7 +421,7 @@ namespace XCharts
|
|||||||
/// <param name="axisIndex"></param>
|
/// <param name="axisIndex"></param>
|
||||||
/// <param name="minVaule"></param>
|
/// <param name="minVaule"></param>
|
||||||
/// <param name="maxValue"></param>
|
/// <param name="maxValue"></param>
|
||||||
internal static void GetYMinMaxValue(Series series, DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
public static void GetYMinMaxValue(Series series, DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
||||||
bool inverse, out float minVaule, out float maxValue, bool isPolar = false)
|
bool inverse, out float minVaule, out float maxValue, bool isPolar = false)
|
||||||
{
|
{
|
||||||
GetMinMaxValue(series, dataZoom, axisIndex, isValueAxis, inverse, true, out minVaule, out maxValue, isPolar);
|
GetMinMaxValue(series, dataZoom, axisIndex, isValueAxis, inverse, true, out minVaule, out maxValue, isPolar);
|
||||||
@@ -429,7 +429,7 @@ namespace XCharts
|
|||||||
|
|
||||||
private static Dictionary<int, List<Serie>> _stackSeriesForMinMax = new Dictionary<int, List<Serie>>();
|
private static Dictionary<int, List<Serie>> _stackSeriesForMinMax = new Dictionary<int, List<Serie>>();
|
||||||
private static Dictionary<int, float> _serieTotalValueForMinMax = new Dictionary<int, float>();
|
private static Dictionary<int, float> _serieTotalValueForMinMax = new Dictionary<int, float>();
|
||||||
internal static void GetMinMaxValue(Series series, DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
public static void GetMinMaxValue(Series series, DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
||||||
bool inverse, bool yValue, out float minVaule, out float maxValue, bool isPolar = false)
|
bool inverse, bool yValue, out float minVaule, out float maxValue, bool isPolar = false)
|
||||||
{
|
{
|
||||||
float min = int.MaxValue;
|
float min = int.MaxValue;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e7411a13172764cf89b10e643089c832
|
guid: 96a06a5949772464da15c44ae2ad400d
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -9,7 +9,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
internal static class ThemeHelper
|
public static class ThemeHelper
|
||||||
{
|
{
|
||||||
public static Color32 GetBackgroundColor(ChartTheme theme, Background background)
|
public static Color32 GetBackgroundColor(ChartTheme theme, Background background)
|
||||||
{
|
{
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5093880c2dbba4c01bb0231653ed3252
|
guid: cb35a91a23492484aa6f873b5ba75e57
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -9,7 +9,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
internal static class TitleStyleHelper
|
public static class TitleStyleHelper
|
||||||
{
|
{
|
||||||
public static void CheckTitle(Serie serie, ref bool m_ReinitTitle, ref bool m_UpdateTitleText)
|
public static void CheckTitle(Serie serie, ref bool m_ReinitTitle, ref bool m_UpdateTitleText)
|
||||||
{
|
{
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 35fa58aecc0f4414e8a2f03195b66175
|
guid: c0215e7ec59ca4e4fb55b19ed02213c9
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -10,7 +10,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
internal static class TooltipHelper
|
public static class TooltipHelper
|
||||||
{
|
{
|
||||||
private static void InitScatterTooltip(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
|
private static void InitScatterTooltip(ref StringBuilder sb, Tooltip tooltip, Serie serie, int index,
|
||||||
ChartTheme theme)
|
ChartTheme theme)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: f0fa1b19683a8424bb335802de5c9726
|
guid: ae34edb52008c442984c29a57197188a
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -68,7 +68,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Color32 GetLineGradientColor(VisualMap visualMap, Vector3 pos, CoordinateChart chart, Axis axis, Color32 defaultColor)
|
public static Color32 GetLineGradientColor(VisualMap visualMap, Vector3 pos, CoordinateChart chart, Axis axis, Color32 defaultColor)
|
||||||
{
|
{
|
||||||
float value = 0;
|
float value = 0;
|
||||||
switch (visualMap.direction)
|
switch (visualMap.direction)
|
||||||
@@ -102,7 +102,7 @@ namespace XCharts
|
|||||||
else return color;
|
else return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Color32 GetItemStyleGradientColor(ItemStyle itemStyle, Vector3 pos, CoordinateChart chart, Axis axis, Color32 defaultColor)
|
public static Color32 GetItemStyleGradientColor(ItemStyle itemStyle, Vector3 pos, CoordinateChart chart, Axis axis, Color32 defaultColor)
|
||||||
{
|
{
|
||||||
var min = axis.runtimeMinValue;
|
var min = axis.runtimeMinValue;
|
||||||
var max = axis.runtimeMaxValue;
|
var max = axis.runtimeMaxValue;
|
||||||
@@ -114,7 +114,7 @@ namespace XCharts
|
|||||||
else return color;
|
else return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Color32 GetLineStyleGradientColor(LineStyle lineStyle, Vector3 pos, CoordinateChart chart, Axis axis, Color32 defaultColor)
|
public static Color32 GetLineStyleGradientColor(LineStyle lineStyle, Vector3 pos, CoordinateChart chart, Axis axis, Color32 defaultColor)
|
||||||
{
|
{
|
||||||
var min = axis.runtimeMinValue;
|
var min = axis.runtimeMinValue;
|
||||||
var max = axis.runtimeMaxValue;
|
var max = axis.runtimeMaxValue;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 15e5106bd46f5484596429d512f6af5d
|
guid: 870f899098b0f42bdb4552ed65464c60
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -152,7 +152,7 @@ namespace XCharts
|
|||||||
CheckTooltip();
|
CheckTooltip();
|
||||||
CheckRefreshChart();
|
CheckRefreshChart();
|
||||||
CheckRefreshLabel();
|
CheckRefreshLabel();
|
||||||
CheckAnimation();
|
Internal_CheckAnimation();
|
||||||
foreach (var draw in m_DrawSeries) draw.Update();
|
foreach (var draw in m_DrawSeries) draw.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,7 +716,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckAnimation()
|
public void Internal_CheckAnimation()
|
||||||
{
|
{
|
||||||
if (!m_CheckAnimation)
|
if (!m_CheckAnimation)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1702,7 +1702,7 @@ namespace XCharts
|
|||||||
var content = "";
|
var content = "";
|
||||||
if (anyPercentStack && isPercentStack)
|
if (anyPercentStack && isPercentStack)
|
||||||
{
|
{
|
||||||
var tempTotal = GetSameStackTotalValue(serie.stack, j);
|
var tempTotal = Internal_GetBarSameStackTotalValue(serie.stack, j);
|
||||||
content = SerieLabelHelper.GetFormatterContent(serie, serieData, value, tempTotal,
|
content = SerieLabelHelper.GetFormatterContent(serie, serieData, value, tempTotal,
|
||||||
serieLabel, theme.GetColor(i));
|
serieLabel, theme.GetColor(i));
|
||||||
}
|
}
|
||||||
@@ -1958,13 +1958,13 @@ namespace XCharts
|
|||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckClipAndDrawPolygon(VertexHelper vh, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4,
|
public void Internal_CheckClipAndDrawPolygon(VertexHelper vh, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4,
|
||||||
Color32 color, bool clip, Grid grid)
|
Color32 color, bool clip, Grid grid)
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, p1, p2, p3, p4, color, color, clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, p1, p2, p3, p4, color, color, clip, grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckClipAndDrawPolygon(VertexHelper vh, Vector3 p, float radius, Color32 color,
|
public void Internal_CheckClipAndDrawPolygon(VertexHelper vh, Vector3 p, float radius, Color32 color,
|
||||||
bool clip, bool vertical, Grid grid)
|
bool clip, bool vertical, Grid grid)
|
||||||
{
|
{
|
||||||
if (!IsInChart(p)) return;
|
if (!IsInChart(p)) return;
|
||||||
@@ -1972,7 +1972,7 @@ namespace XCharts
|
|||||||
UGL.DrawSquare(vh, p, radius, color);
|
UGL.DrawSquare(vh, p, radius, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckClipAndDrawPolygon(VertexHelper vh, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4,
|
public void Internal_CheckClipAndDrawPolygon(VertexHelper vh, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4,
|
||||||
Color32 startColor, Color32 toColor, bool clip, Grid grid)
|
Color32 startColor, Color32 toColor, bool clip, Grid grid)
|
||||||
{
|
{
|
||||||
ClampInChart(ref p1);
|
ClampInChart(ref p1);
|
||||||
@@ -1990,7 +1990,7 @@ namespace XCharts
|
|||||||
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, startColor, toColor);
|
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, startColor, toColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckClipAndDrawPolygon(VertexHelper vh, ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4,
|
public void Internal_CheckClipAndDrawPolygon(VertexHelper vh, ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4,
|
||||||
Color32 startColor, Color32 toColor, bool clip, Grid grid)
|
Color32 startColor, Color32 toColor, bool clip, Grid grid)
|
||||||
{
|
{
|
||||||
ClampInChart(ref p1);
|
ClampInChart(ref p1);
|
||||||
@@ -2009,13 +2009,13 @@ namespace XCharts
|
|||||||
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, startColor, toColor);
|
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, startColor, toColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckClipAndDrawTriangle(VertexHelper vh, Vector3 p1, Vector3 p2, Vector3 p3, Color32 color,
|
public void Internal_CheckClipAndDrawTriangle(VertexHelper vh, Vector3 p1, Vector3 p2, Vector3 p3, Color32 color,
|
||||||
bool clip, Grid grid)
|
bool clip, Grid grid)
|
||||||
{
|
{
|
||||||
CheckClipAndDrawTriangle(vh, p1, p2, p3, color, color, color, clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, p1, p2, p3, color, color, color, clip, grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckClipAndDrawTriangle(VertexHelper vh, Vector3 p1, Vector3 p2, Vector3 p3, Color32 color,
|
public void Internal_CheckClipAndDrawTriangle(VertexHelper vh, Vector3 p1, Vector3 p2, Vector3 p3, Color32 color,
|
||||||
Color32 color2, Color32 color3, bool clip, Grid grid)
|
Color32 color2, Color32 color3, bool clip, Grid grid)
|
||||||
{
|
{
|
||||||
if (!IsInChart(p1) || !IsInChart(p2) || !IsInChart(p3)) return;
|
if (!IsInChart(p1) || !IsInChart(p2) || !IsInChart(p3)) return;
|
||||||
@@ -2023,7 +2023,7 @@ namespace XCharts
|
|||||||
UGL.DrawTriangle(vh, p1, p2, p3, color, color2, color3);
|
UGL.DrawTriangle(vh, p1, p2, p3, color, color2, color3);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckClipAndDrawLine(VertexHelper vh, Vector3 p1, Vector3 p2, float size, Color32 color,
|
public void Internal_CheckClipAndDrawLine(VertexHelper vh, Vector3 p1, Vector3 p2, float size, Color32 color,
|
||||||
bool clip, Grid grid)
|
bool clip, Grid grid)
|
||||||
{
|
{
|
||||||
if (!IsInChart(p1) || !IsInChart(p2)) return;
|
if (!IsInChart(p1) || !IsInChart(p2)) return;
|
||||||
@@ -2031,7 +2031,7 @@ namespace XCharts
|
|||||||
UGL.DrawLine(vh, p1, p2, size, color);
|
UGL.DrawLine(vh, p1, p2, size, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckClipAndDrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize, float tickness,
|
public void Internal_CheckClipAndDrawSymbol(VertexHelper vh, SerieSymbolType type, float symbolSize, float tickness,
|
||||||
Vector3 pos, Color32 color, Color32 toColor, float gap, bool clip, float[] cornerRadius, Grid grid)
|
Vector3 pos, Color32 color, Color32 toColor, float gap, bool clip, float[] cornerRadius, Grid grid)
|
||||||
{
|
{
|
||||||
if (!IsInChart(pos)) return;
|
if (!IsInChart(pos)) return;
|
||||||
@@ -2039,7 +2039,7 @@ namespace XCharts
|
|||||||
DrawSymbol(vh, type, symbolSize, tickness, pos, color, toColor, gap, cornerRadius);
|
DrawSymbol(vh, type, symbolSize, tickness, pos, color, toColor, gap, cornerRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckClipAndDrawZebraLine(VertexHelper vh, Vector3 p1, Vector3 p2, float size, float zebraWidth,
|
public void Internal_CheckClipAndDrawZebraLine(VertexHelper vh, Vector3 p1, Vector3 p2, float size, float zebraWidth,
|
||||||
float zebraGap, Color32 color, bool clip, Grid grid)
|
float zebraGap, Color32 color, bool clip, Grid grid)
|
||||||
{
|
{
|
||||||
ClampInChart(ref p1);
|
ClampInChart(ref p1);
|
||||||
@@ -2059,7 +2059,7 @@ namespace XCharts
|
|||||||
return Color32.Lerp(areaToColor, areaColor, (pos.x - grid.runtimeX) / grid.runtimeWidth);
|
return Color32.Lerp(areaToColor, areaColor, (pos.x - grid.runtimeX) / grid.runtimeWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Grid GetAxisGridOrDefault(Axis axis)
|
public Grid GetAxisGridOrDefault(Axis axis)
|
||||||
{
|
{
|
||||||
var index = axis.gridIndex;
|
var index = axis.gridIndex;
|
||||||
if (index >= 0 && index < m_Grids.Count)
|
if (index >= 0 && index < m_Grids.Count)
|
||||||
@@ -2076,7 +2076,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Grid GetDataZoomGridOrDefault(DataZoom dataZoom)
|
public Grid GetDataZoomGridOrDefault(DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
var xAxis = GetXAxis(dataZoom.xAxisIndexs[0]);
|
var xAxis = GetXAxis(dataZoom.xAxisIndexs[0]);
|
||||||
Grid grid = GetGrid(xAxis.gridIndex);
|
Grid grid = GetGrid(xAxis.gridIndex);
|
||||||
@@ -2106,7 +2106,7 @@ namespace XCharts
|
|||||||
return grid;
|
return grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected XAxis GetSerieXAxisOrDefault(Serie serie)
|
public XAxis GetSerieXAxisOrDefault(Serie serie)
|
||||||
{
|
{
|
||||||
var axis = GetXAxis(serie.xAxisIndex);
|
var axis = GetXAxis(serie.xAxisIndex);
|
||||||
if (axis == null)
|
if (axis == null)
|
||||||
@@ -2117,7 +2117,7 @@ namespace XCharts
|
|||||||
return axis;
|
return axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected YAxis GetSerieYAxisOrDefault(Serie serie)
|
public YAxis GetSerieYAxisOrDefault(Serie serie)
|
||||||
{
|
{
|
||||||
var axis = GetYAxis(serie.yAxisIndex);
|
var axis = GetYAxis(serie.yAxisIndex);
|
||||||
if (axis == null)
|
if (axis == null)
|
||||||
@@ -2139,7 +2139,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetXAxisOnZeroOffset(XAxis axis)
|
public float GetXAxisOnZeroOffset(XAxis axis)
|
||||||
{
|
{
|
||||||
if (!axis.axisLine.onZero) return 0;
|
if (!axis.axisLine.onZero) return 0;
|
||||||
foreach (var yAxis in m_YAxes)
|
foreach (var yAxis in m_YAxes)
|
||||||
@@ -2149,7 +2149,7 @@ namespace XCharts
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetYAxisOnZeroOffset(YAxis axis)
|
public float GetYAxisOnZeroOffset(YAxis axis)
|
||||||
{
|
{
|
||||||
if (!axis.axisLine.onZero) return 0;
|
if (!axis.axisLine.onZero) return 0;
|
||||||
foreach (var xAxis in m_XAxes)
|
foreach (var xAxis in m_XAxes)
|
||||||
@@ -2159,7 +2159,7 @@ namespace XCharts
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private YAxis GetRelatedYAxis(XAxis axis)
|
public YAxis GetRelatedYAxis(XAxis axis)
|
||||||
{
|
{
|
||||||
foreach (var yAxis in m_YAxes)
|
foreach (var yAxis in m_YAxes)
|
||||||
{
|
{
|
||||||
@@ -2168,7 +2168,7 @@ namespace XCharts
|
|||||||
return m_YAxes[0];
|
return m_YAxes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private XAxis GetRelatedXAxis(YAxis axis)
|
public XAxis GetRelatedXAxis(YAxis axis)
|
||||||
{
|
{
|
||||||
foreach (var xAxis in m_XAxes)
|
foreach (var xAxis in m_XAxes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ namespace XCharts
|
|||||||
var grid = GetSerieGridOrDefault(serie);
|
var grid = GetSerieGridOrDefault(serie);
|
||||||
var showData = serie.GetDataList(dataZoom);
|
var showData = serie.GetDataList(dataZoom);
|
||||||
float categoryWidth = AxisHelper.GetDataWidth(yAxis, grid.runtimeHeight, showData.Count, dataZoom);
|
float categoryWidth = AxisHelper.GetDataWidth(yAxis, grid.runtimeHeight, showData.Count, dataZoom);
|
||||||
float barGap = GetBarGap();
|
float barGap = Internal_GetBarGap();
|
||||||
float totalBarWidth = GetBarTotalWidth(categoryWidth, barGap);
|
float totalBarWidth = Internal_GetBarTotalWidth(categoryWidth, barGap);
|
||||||
float barWidth = serie.GetBarWidth(categoryWidth);
|
float barWidth = serie.GetBarWidth(categoryWidth);
|
||||||
float offset = (categoryWidth - totalBarWidth) / 2;
|
float offset = (categoryWidth - totalBarWidth) / 2;
|
||||||
float barGapWidth = barWidth + barWidth * barGap;
|
float barGapWidth = barWidth + barWidth * barGap;
|
||||||
float space = serie.barGap == -1 ? offset : offset + GetBarIndex(serie) * barGapWidth;
|
float space = serie.barGap == -1 ? offset : offset + Internal_GetBarIndex(serie) * barGapWidth;
|
||||||
var isStack = SeriesHelper.IsStack(m_Series, serie.stack, SerieType.Bar);
|
var isStack = SeriesHelper.IsStack(m_Series, serie.stack, SerieType.Bar);
|
||||||
m_StackSerieData.Clear();
|
m_StackSerieData.Clear();
|
||||||
if (isStack) SeriesHelper.UpdateStackDataList(m_Series, serie, dataZoom, m_StackSerieData);
|
if (isStack) SeriesHelper.UpdateStackDataList(m_Series, serie, dataZoom, m_StackSerieData);
|
||||||
@@ -81,7 +81,7 @@ namespace XCharts
|
|||||||
var valueTotal = 0f;
|
var valueTotal = 0f;
|
||||||
if (isPercentStack)
|
if (isPercentStack)
|
||||||
{
|
{
|
||||||
valueTotal = GetSameStackTotalValue(serie.stack, i);
|
valueTotal = Internal_GetBarSameStackTotalValue(serie.stack, i);
|
||||||
barHig = valueTotal != 0 ? (value / valueTotal * grid.runtimeWidth) : 0;
|
barHig = valueTotal != 0 ? (value / valueTotal * grid.runtimeWidth) : 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -93,7 +93,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
serieData.runtimeStackHig = barHig;
|
serieData.runtimeStackHig = barHig;
|
||||||
var isBarEnd = false;
|
var isBarEnd = false;
|
||||||
float currHig = CheckAnimation(serie, i, barHig, out isBarEnd);
|
float currHig = Internal_CheckBarAnimation(serie, i, barHig, out isBarEnd);
|
||||||
if (!isBarEnd) isAllBarEnd = false;
|
if (!isBarEnd) isAllBarEnd = false;
|
||||||
Vector3 plt, prt, prb, plb, top;
|
Vector3 plt, prt, prb, plb, top;
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
@@ -143,7 +143,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float CheckAnimation(Serie serie, int dataIndex, float barHig, out bool isBarEnd)
|
public float Internal_CheckBarAnimation(Serie serie, int dataIndex, float barHig, out bool isBarEnd)
|
||||||
{
|
{
|
||||||
float currHig = serie.animation.CheckBarProgress(dataIndex, barHig, serie.dataCount, out isBarEnd);
|
float currHig = serie.animation.CheckBarProgress(dataIndex, barHig, serie.dataCount, out isBarEnd);
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
@@ -166,12 +166,12 @@ namespace XCharts
|
|||||||
m_StackSerieData.Clear();
|
m_StackSerieData.Clear();
|
||||||
if (isStack) SeriesHelper.UpdateStackDataList(m_Series, serie, dataZoom, m_StackSerieData);
|
if (isStack) SeriesHelper.UpdateStackDataList(m_Series, serie, dataZoom, m_StackSerieData);
|
||||||
float categoryWidth = AxisHelper.GetDataWidth(xAxis, grid.runtimeWidth, showData.Count, dataZoom);
|
float categoryWidth = AxisHelper.GetDataWidth(xAxis, grid.runtimeWidth, showData.Count, dataZoom);
|
||||||
float barGap = GetBarGap();
|
float barGap = Internal_GetBarGap();
|
||||||
float totalBarWidth = GetBarTotalWidth(categoryWidth, barGap);
|
float totalBarWidth = Internal_GetBarTotalWidth(categoryWidth, barGap);
|
||||||
float barWidth = serie.GetBarWidth(categoryWidth);
|
float barWidth = serie.GetBarWidth(categoryWidth);
|
||||||
float offset = (categoryWidth - totalBarWidth) / 2;
|
float offset = (categoryWidth - totalBarWidth) / 2;
|
||||||
float barGapWidth = barWidth + barWidth * barGap;
|
float barGapWidth = barWidth + barWidth * barGap;
|
||||||
float space = serie.barGap == -1 ? offset : offset + GetBarIndex(serie) * barGapWidth;
|
float space = serie.barGap == -1 ? offset : offset + Internal_GetBarIndex(serie) * barGapWidth;
|
||||||
int maxCount = serie.maxShow > 0
|
int maxCount = serie.maxShow > 0
|
||||||
? (serie.maxShow > showData.Count ? showData.Count : serie.maxShow)
|
? (serie.maxShow > showData.Count ? showData.Count : serie.maxShow)
|
||||||
: showData.Count;
|
: showData.Count;
|
||||||
@@ -215,7 +215,7 @@ namespace XCharts
|
|||||||
var valueTotal = 0f;
|
var valueTotal = 0f;
|
||||||
if (isPercentStack)
|
if (isPercentStack)
|
||||||
{
|
{
|
||||||
valueTotal = GetSameStackTotalValue(serie.stack, i);
|
valueTotal = Internal_GetBarSameStackTotalValue(serie.stack, i);
|
||||||
barHig = valueTotal != 0 ? (value / valueTotal * grid.runtimeHeight) : 0;
|
barHig = valueTotal != 0 ? (value / valueTotal * grid.runtimeHeight) : 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -228,7 +228,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
serieData.runtimeStackHig = barHig;
|
serieData.runtimeStackHig = barHig;
|
||||||
var isBarEnd = false;
|
var isBarEnd = false;
|
||||||
float currHig = CheckAnimation(serie, i, barHig, out isBarEnd);
|
float currHig = Internal_CheckBarAnimation(serie, i, barHig, out isBarEnd);
|
||||||
if (!isBarEnd) isAllBarEnd = false;
|
if (!isBarEnd) isAllBarEnd = false;
|
||||||
Vector3 plb, plt, prt, prb, top;
|
Vector3 plb, plt, prt, prb, top;
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
@@ -313,7 +313,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, plb, plt, prt, prb, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, plb, plt, prt, prb, areaColor, areaToColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
UGL.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, itemStyle.borderColor,
|
UGL.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, itemStyle.borderColor,
|
||||||
itemStyle.borderToColor, 0, itemStyle.cornerRadius, isYAxis);
|
itemStyle.borderToColor, 0, itemStyle.cornerRadius, isYAxis);
|
||||||
@@ -340,7 +340,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, areaColor, areaToColor,
|
Internal_CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, areaColor, areaToColor,
|
||||||
serie.clip, grid);
|
serie.clip, grid);
|
||||||
}
|
}
|
||||||
UGL.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, itemStyle.borderColor,
|
UGL.DrawBorder(vh, center, itemWidth, itemHeight, borderWidth, itemStyle.borderColor,
|
||||||
@@ -359,14 +359,14 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
plt = (plb + plt) / 2;
|
plt = (plb + plt) / 2;
|
||||||
prt = (prt + prb) / 2;
|
prt = (prt + prb) / 2;
|
||||||
CheckClipAndDrawZebraLine(vh, plt, prt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
|
Internal_CheckClipAndDrawZebraLine(vh, plt, prt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
|
||||||
areaColor, serie.clip, grid);
|
areaColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plb = (prb + plb) / 2;
|
plb = (prb + plb) / 2;
|
||||||
plt = (plt + prt) / 2;
|
plt = (plt + prt) / 2;
|
||||||
CheckClipAndDrawZebraLine(vh, plb, plt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
|
Internal_CheckClipAndDrawZebraLine(vh, plb, plt, barWidth / 2, serie.barZebraWidth, serie.barZebraGap,
|
||||||
areaColor, serie.clip, grid);
|
areaColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -395,14 +395,14 @@ namespace XCharts
|
|||||||
var barLen = prt.x - plt.x;
|
var barLen = prt.x - plt.x;
|
||||||
var rectStartColor = Color32.Lerp(areaColor, areaToColor, radius / barLen);
|
var rectStartColor = Color32.Lerp(areaColor, areaToColor, radius / barLen);
|
||||||
var rectEndColor = Color32.Lerp(areaColor, areaToColor, (barLen - radius) / barLen);
|
var rectEndColor = Color32.Lerp(areaColor, areaToColor, (barLen - radius) / barLen);
|
||||||
CheckClipAndDrawPolygon(vh, plb + diff, plt + diff, prt - diff, prb - diff, rectStartColor,
|
Internal_CheckClipAndDrawPolygon(vh, plb + diff, plt + diff, prt - diff, prb - diff, rectStartColor,
|
||||||
rectEndColor, serie.clip, grid);
|
rectEndColor, serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pcl, radius, areaColor, rectStartColor, 180, 360, 1, isYAxis);
|
UGL.DrawSector(vh, pcl, radius, areaColor, rectStartColor, 180, 360, 1, isYAxis);
|
||||||
UGL.DrawSector(vh, pcr, radius, rectEndColor, areaToColor, 0, 180, 1, isYAxis);
|
UGL.DrawSector(vh, pcr, radius, rectEndColor, areaToColor, 0, 180, 1, isYAxis);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, plb + diff, plt + diff, prt - diff, prb - diff, areaColor,
|
Internal_CheckClipAndDrawPolygon(vh, plb + diff, plt + diff, prt - diff, prb - diff, areaColor,
|
||||||
areaToColor, serie.clip, grid);
|
areaToColor, serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pcl, radius, areaColor, 180, 360);
|
UGL.DrawSector(vh, pcl, radius, areaColor, 180, 360);
|
||||||
UGL.DrawSector(vh, pcr, radius, areaToColor, 0, 180);
|
UGL.DrawSector(vh, pcr, radius, areaToColor, 0, 180);
|
||||||
@@ -420,14 +420,14 @@ namespace XCharts
|
|||||||
var barLen = plt.x - prt.x;
|
var barLen = plt.x - prt.x;
|
||||||
var rectStartColor = Color32.Lerp(areaColor, areaToColor, radius / barLen);
|
var rectStartColor = Color32.Lerp(areaColor, areaToColor, radius / barLen);
|
||||||
var rectEndColor = Color32.Lerp(areaColor, areaToColor, (barLen - radius) / barLen);
|
var rectEndColor = Color32.Lerp(areaColor, areaToColor, (barLen - radius) / barLen);
|
||||||
CheckClipAndDrawPolygon(vh, plb - diff, plt - diff, prt + diff, prb + diff, rectStartColor,
|
Internal_CheckClipAndDrawPolygon(vh, plb - diff, plt - diff, prt + diff, prb + diff, rectStartColor,
|
||||||
rectEndColor, serie.clip, grid);
|
rectEndColor, serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pcl, radius, rectStartColor, areaColor, 0, 180, 1, isYAxis);
|
UGL.DrawSector(vh, pcl, radius, rectStartColor, areaColor, 0, 180, 1, isYAxis);
|
||||||
UGL.DrawSector(vh, pcr, radius, areaToColor, rectEndColor, 180, 360, 1, isYAxis);
|
UGL.DrawSector(vh, pcr, radius, areaToColor, rectEndColor, 180, 360, 1, isYAxis);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, plb - diff, plt - diff, prt + diff, prb + diff, areaColor,
|
Internal_CheckClipAndDrawPolygon(vh, plb - diff, plt - diff, prt + diff, prb + diff, areaColor,
|
||||||
areaToColor, serie.clip, grid);
|
areaToColor, serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pcl, radius, areaColor, 0, 180);
|
UGL.DrawSector(vh, pcl, radius, areaColor, 0, 180);
|
||||||
UGL.DrawSector(vh, pcr, radius, areaToColor, 180, 360);
|
UGL.DrawSector(vh, pcr, radius, areaToColor, 180, 360);
|
||||||
@@ -449,14 +449,14 @@ namespace XCharts
|
|||||||
var barLen = plt.y - plb.y;
|
var barLen = plt.y - plb.y;
|
||||||
var rectStartColor = Color32.Lerp(areaColor, areaToColor, radius / barLen);
|
var rectStartColor = Color32.Lerp(areaColor, areaToColor, radius / barLen);
|
||||||
var rectEndColor = Color32.Lerp(areaColor, areaToColor, (barLen - radius) / barLen);
|
var rectEndColor = Color32.Lerp(areaColor, areaToColor, (barLen - radius) / barLen);
|
||||||
CheckClipAndDrawPolygon(vh, prb + diff, plb + diff, plt - diff, prt - diff, rectStartColor,
|
Internal_CheckClipAndDrawPolygon(vh, prb + diff, plb + diff, plt - diff, prt - diff, rectStartColor,
|
||||||
rectEndColor, serie.clip, grid);
|
rectEndColor, serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pct, radius, rectEndColor, areaToColor, 270, 450, 1, isYAxis);
|
UGL.DrawSector(vh, pct, radius, rectEndColor, areaToColor, 270, 450, 1, isYAxis);
|
||||||
UGL.DrawSector(vh, pcb, radius, rectStartColor, areaColor, 90, 270, 1, isYAxis);
|
UGL.DrawSector(vh, pcb, radius, rectStartColor, areaColor, 90, 270, 1, isYAxis);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, prb + diff, plb + diff, plt - diff, prt - diff, areaColor,
|
Internal_CheckClipAndDrawPolygon(vh, prb + diff, plb + diff, plt - diff, prt - diff, areaColor,
|
||||||
areaToColor, serie.clip, grid);
|
areaToColor, serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pct, radius, areaToColor, 270, 450);
|
UGL.DrawSector(vh, pct, radius, areaToColor, 270, 450);
|
||||||
UGL.DrawSector(vh, pcb, radius, areaColor, 90, 270);
|
UGL.DrawSector(vh, pcb, radius, areaColor, 90, 270);
|
||||||
@@ -474,14 +474,14 @@ namespace XCharts
|
|||||||
var barLen = plb.y - plt.y;
|
var barLen = plb.y - plt.y;
|
||||||
var rectStartColor = Color32.Lerp(areaColor, areaToColor, radius / barLen);
|
var rectStartColor = Color32.Lerp(areaColor, areaToColor, radius / barLen);
|
||||||
var rectEndColor = Color32.Lerp(areaColor, areaToColor, (barLen - radius) / barLen);
|
var rectEndColor = Color32.Lerp(areaColor, areaToColor, (barLen - radius) / barLen);
|
||||||
CheckClipAndDrawPolygon(vh, prb - diff, plb - diff, plt + diff, prt + diff, rectStartColor,
|
Internal_CheckClipAndDrawPolygon(vh, prb - diff, plb - diff, plt + diff, prt + diff, rectStartColor,
|
||||||
rectEndColor, serie.clip, grid);
|
rectEndColor, serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pct, radius, rectEndColor, areaToColor, 90, 270, 1, isYAxis);
|
UGL.DrawSector(vh, pct, radius, rectEndColor, areaToColor, 90, 270, 1, isYAxis);
|
||||||
UGL.DrawSector(vh, pcb, radius, rectStartColor, areaColor, 270, 450, 1, isYAxis);
|
UGL.DrawSector(vh, pcb, radius, rectStartColor, areaColor, 270, 450, 1, isYAxis);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, prb - diff, plb - diff, plt + diff, prt + diff, areaColor,
|
Internal_CheckClipAndDrawPolygon(vh, prb - diff, plb - diff, plt + diff, prt + diff, areaColor,
|
||||||
areaToColor, serie.clip, grid);
|
areaToColor, serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pct, radius, areaToColor, 90, 270);
|
UGL.DrawSector(vh, pct, radius, areaToColor, 90, 270);
|
||||||
UGL.DrawSector(vh, pcb, radius, areaColor, 270, 450);
|
UGL.DrawSector(vh, pcb, radius, areaColor, 270, 450);
|
||||||
@@ -510,7 +510,7 @@ namespace XCharts
|
|||||||
var diff = Vector3.right * radius;
|
var diff = Vector3.right * radius;
|
||||||
var pcl = (plt + plb) / 2 + diff;
|
var pcl = (plt + plb) / 2 + diff;
|
||||||
var pcr = (prt + prb) / 2 - diff;
|
var pcr = (prt + prb) / 2 - diff;
|
||||||
CheckClipAndDrawPolygon(vh, plb + diff, plt + diff, prt - diff, prb - diff, color, color, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, plb + diff, plt + diff, prt - diff, prb - diff, color, color, serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pcl, radius, color, 180, 360);
|
UGL.DrawSector(vh, pcl, radius, color, 180, 360);
|
||||||
UGL.DrawSector(vh, pcr, radius, color, 0, 180);
|
UGL.DrawSector(vh, pcr, radius, color, 0, 180);
|
||||||
if (itemStyle.NeedShowBorder())
|
if (itemStyle.NeedShowBorder())
|
||||||
@@ -534,7 +534,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ref plb, ref plt, ref prt, ref prb, color, color, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, ref plb, ref plt, ref prt, ref prb, color, color, serie.clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -551,7 +551,7 @@ namespace XCharts
|
|||||||
var diff = Vector3.up * radius;
|
var diff = Vector3.up * radius;
|
||||||
var pct = (plt + prt) / 2 - diff;
|
var pct = (plt + prt) / 2 - diff;
|
||||||
var pcb = (plb + prb) / 2 + diff;
|
var pcb = (plb + prb) / 2 + diff;
|
||||||
CheckClipAndDrawPolygon(vh, prb + diff, plb + diff, plt - diff, prt - diff, color, color,
|
Internal_CheckClipAndDrawPolygon(vh, prb + diff, plb + diff, plt - diff, prt - diff, color, color,
|
||||||
serie.clip, grid);
|
serie.clip, grid);
|
||||||
UGL.DrawSector(vh, pct, radius, color, 270, 450);
|
UGL.DrawSector(vh, pct, radius, color, 270, 450);
|
||||||
UGL.DrawSector(vh, pcb, radius, color, 90, 270);
|
UGL.DrawSector(vh, pcb, radius, color, 90, 270);
|
||||||
@@ -576,18 +576,18 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, color, color, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, color, color, serie.clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetBarGap()
|
public float Internal_GetBarGap()
|
||||||
{
|
{
|
||||||
float gap = 0.3f;
|
float gap = 0.3f;
|
||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
var serie = m_Series.list[i];
|
var serie = m_Series.list[i];
|
||||||
if (serie.type == SerieType.Bar || serie.type == SerieType.Candlestick)
|
if (serie.type == SerieType.Bar || serie.type == SerieType.Candlestick || serie.type == SerieType.Custom)
|
||||||
{
|
{
|
||||||
if (serie.barGap != 0)
|
if (serie.barGap != 0)
|
||||||
{
|
{
|
||||||
@@ -598,13 +598,13 @@ namespace XCharts
|
|||||||
return gap;
|
return gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetSameStackTotalValue(string stack, int dataIndex)
|
public float Internal_GetBarSameStackTotalValue(string stack, int dataIndex)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(stack)) return 0;
|
if (string.IsNullOrEmpty(stack)) return 0;
|
||||||
float total = 0;
|
float total = 0;
|
||||||
foreach (var serie in m_Series.list)
|
foreach (var serie in m_Series.list)
|
||||||
{
|
{
|
||||||
if (serie.type == SerieType.Bar)
|
if (serie.type == SerieType.Bar || serie.type == SerieType.Custom)
|
||||||
{
|
{
|
||||||
if (stack.Equals(serie.stack))
|
if (stack.Equals(serie.stack))
|
||||||
{
|
{
|
||||||
@@ -617,7 +617,7 @@ namespace XCharts
|
|||||||
|
|
||||||
|
|
||||||
private HashSet<string> barStackSet = new HashSet<string>();
|
private HashSet<string> barStackSet = new HashSet<string>();
|
||||||
private float GetBarTotalWidth(float categoryWidth, float gap)
|
public float Internal_GetBarTotalWidth(float categoryWidth, float gap)
|
||||||
{
|
{
|
||||||
float total = 0;
|
float total = 0;
|
||||||
float lastGap = 0;
|
float lastGap = 0;
|
||||||
@@ -626,7 +626,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var serie = m_Series.list[i];
|
var serie = m_Series.list[i];
|
||||||
if (!serie.show) continue;
|
if (!serie.show) continue;
|
||||||
if (serie.type == SerieType.Bar || serie.type == SerieType.Candlestick)
|
if (serie.type == SerieType.Bar || serie.type == SerieType.Candlestick || serie.type == SerieType.Custom)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(serie.stack))
|
if (!string.IsNullOrEmpty(serie.stack))
|
||||||
{
|
{
|
||||||
@@ -657,7 +657,7 @@ namespace XCharts
|
|||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
var serie = m_Series.list[i];
|
var serie = m_Series.list[i];
|
||||||
if ((serie.type == SerieType.Bar && serie.type == SerieType.Candlestick)
|
if ((serie.type == SerieType.Bar || serie.type == SerieType.Candlestick || serie.type == SerieType.Custom)
|
||||||
&& serie.show && now.stack.Equals(serie.stack))
|
&& serie.show && now.stack.Equals(serie.stack))
|
||||||
{
|
{
|
||||||
if (serie.barWidth > barWidth) barWidth = serie.barWidth;
|
if (serie.barWidth > barWidth) barWidth = serie.barWidth;
|
||||||
@@ -668,14 +668,14 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<string> tempList = new List<string>();
|
private List<string> tempList = new List<string>();
|
||||||
private int GetBarIndex(Serie currSerie)
|
public int Internal_GetBarIndex(Serie currSerie)
|
||||||
{
|
{
|
||||||
tempList.Clear();
|
tempList.Clear();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
var serie = m_Series.GetSerie(i);
|
var serie = m_Series.GetSerie(i);
|
||||||
if (serie.type != SerieType.Bar) continue;
|
if (serie.type != SerieType.Bar || serie.type == SerieType.Custom) continue;
|
||||||
if (string.IsNullOrEmpty(serie.stack))
|
if (string.IsNullOrEmpty(serie.stack))
|
||||||
{
|
{
|
||||||
if (serie.index == currSerie.index) return index;
|
if (serie.index == currSerie.index) return index;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
serieData.runtimeStackHig = barHig;
|
serieData.runtimeStackHig = barHig;
|
||||||
var isBarEnd = false;
|
var isBarEnd = false;
|
||||||
float currHig = CheckAnimation(serie, i, barHig, out isBarEnd);
|
float currHig = Internal_CheckBarAnimation(serie, i, barHig, out isBarEnd);
|
||||||
if (!isBarEnd) isAllBarEnd = false;
|
if (!isBarEnd) isAllBarEnd = false;
|
||||||
Vector3 plb, plt, prt, prb, top;
|
Vector3 plb, plt, prt, prb, top;
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, areaColor, areaColor,
|
Internal_CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, areaColor, areaColor,
|
||||||
serie.clip, grid);
|
serie.clip, grid);
|
||||||
}
|
}
|
||||||
UGL.DrawBorder(vh, center, itemWidth, itemHeight, 2 * borderWidth, borderColor, 0,
|
UGL.DrawBorder(vh, center, itemWidth, itemHeight, 2 * borderWidth, borderColor, 0,
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, color, color,
|
Internal_CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, color, color,
|
||||||
serie.clip, grid);
|
serie.clip, grid);
|
||||||
}
|
}
|
||||||
if (borderWidth != 0)
|
if (borderWidth != 0)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace XCharts
|
|||||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, m_Theme, highlight);
|
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, m_Theme, highlight);
|
||||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
||||||
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
|
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
|
||||||
CheckClipAndDrawSymbol(vh, symbol.type, symbolSize, symbolBorder, serie.dataPoints[i], symbolColor,
|
Internal_CheckClipAndDrawSymbol(vh, symbol.type, symbolSize, symbolBorder, serie.dataPoints[i], symbolColor,
|
||||||
symbolToColor, symbol.gap, clip, cornerRadius, grid);
|
symbolToColor, symbol.gap, clip, cornerRadius, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -773,8 +773,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
isShort = true;
|
isShort = true;
|
||||||
isStart = true;
|
isStart = true;
|
||||||
CheckClipAndDrawPolygon(vh, stPos1, upPos1, upPos2, stPos2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, stPos1, upPos1, upPos2, stPos2, lineColor, serie.clip, grid);
|
||||||
CheckClipAndDrawTriangle(vh, stPos2, upPos2, dnPos, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, stPos2, upPos2, dnPos, lineColor, serie.clip, grid);
|
||||||
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, stPos1, isEndPos);
|
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, stPos1, isEndPos);
|
||||||
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, upPos1, isEndPos);
|
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, upPos1, isEndPos);
|
||||||
TryAddToList(isTurnBack, isYAxis, smoothDownPoints, lastSmoothDownPoint, dnPos, isEndPos);
|
TryAddToList(isTurnBack, isYAxis, smoothDownPoints, lastSmoothDownPoint, dnPos, isEndPos);
|
||||||
@@ -784,7 +784,7 @@ namespace XCharts
|
|||||||
(!lastIsDown && IsInRightOrUp(isYAxis, lastDnPos, tp1)))
|
(!lastIsDown && IsInRightOrUp(isYAxis, lastDnPos, tp1)))
|
||||||
{
|
{
|
||||||
isStart = true;
|
isStart = true;
|
||||||
CheckClipAndDrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -793,24 +793,24 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (np != nnp)
|
if (np != nnp)
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ltp1, upPos1, dnPos, ltp2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, ltp1, upPos1, dnPos, ltp2, lineColor, serie.clip, grid);
|
||||||
CheckClipAndDrawTriangle(vh, upPos1, upPos2, dnPos, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, upPos1, upPos2, dnPos, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ltp1, upPos1, upPos2, ltp2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, ltp1, upPos1, upPos2, ltp2, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IsInRightOrUp(isYAxis, tp2, dnPos) || isTurnBack)
|
if (IsInRightOrUp(isYAxis, tp2, dnPos) || isTurnBack)
|
||||||
{
|
{
|
||||||
CheckClipAndDrawLine(vh, start, cp, serie.lineStyle.GetWidth(m_Theme.serie.lineWidth), lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, start, cp, serie.lineStyle.GetWidth(m_Theme.serie.lineWidth), lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ltp1, upPos1, dnPos, ltp2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, ltp1, upPos1, dnPos, ltp2, lineColor, serie.clip, grid);
|
||||||
CheckClipAndDrawTriangle(vh, upPos1, upPos2, dnPos, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, upPos1, upPos2, dnPos, lineColor, serie.clip, grid);
|
||||||
i = segment;
|
i = segment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -834,11 +834,11 @@ namespace XCharts
|
|||||||
isStart = true;
|
isStart = true;
|
||||||
isShort = true;
|
isShort = true;
|
||||||
if (np == nnp)
|
if (np == nnp)
|
||||||
CheckClipAndDrawPolygon(vh, stPos1, dnPos, upPos2, stPos2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, stPos1, dnPos, upPos2, stPos2, lineColor, serie.clip, grid);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, stPos1, dnPos, upPos1, stPos2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, stPos1, dnPos, upPos1, stPos2, lineColor, serie.clip, grid);
|
||||||
CheckClipAndDrawTriangle(vh, dnPos, upPos1, upPos2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, dnPos, upPos1, upPos2, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, dnPos, isEndPos);
|
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, dnPos, isEndPos);
|
||||||
TryAddToList(isTurnBack, isYAxis, smoothDownPoints, lastSmoothDownPoint, stPos2, isEndPos);
|
TryAddToList(isTurnBack, isYAxis, smoothDownPoints, lastSmoothDownPoint, stPos2, isEndPos);
|
||||||
@@ -851,7 +851,7 @@ namespace XCharts
|
|||||||
isStart = true;
|
isStart = true;
|
||||||
if (stPos2 != Vector3.zero)
|
if (stPos2 != Vector3.zero)
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, stPos1, tp1, tp2, stPos2, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -861,21 +861,21 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (np != nnp)
|
if (np != nnp)
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ltp1, dnPos, upPos1, ltp2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, ltp1, dnPos, upPos1, ltp2, lineColor, serie.clip, grid);
|
||||||
CheckClipAndDrawTriangle(vh, dnPos, upPos2, upPos1, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, dnPos, upPos2, upPos1, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
else CheckClipAndDrawPolygon(vh, ltp1, upPos1, upPos2, ltp2, lineColor, serie.clip, grid);
|
else Internal_CheckClipAndDrawPolygon(vh, ltp1, upPos1, upPos2, ltp2, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IsInRightOrUp(isYAxis, tp1, dnPos) || isTurnBack)
|
if (IsInRightOrUp(isYAxis, tp1, dnPos) || isTurnBack)
|
||||||
{
|
{
|
||||||
CheckClipAndDrawLine(vh, start, cp, serie.lineStyle.GetWidth(m_Theme.serie.lineWidth), lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, start, cp, serie.lineStyle.GetWidth(m_Theme.serie.lineWidth), lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ltp1, dnPos, upPos1, ltp2, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, ltp1, dnPos, upPos1, ltp2, lineColor, serie.clip, grid);
|
||||||
CheckClipAndDrawTriangle(vh, dnPos, upPos2, upPos1, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, dnPos, upPos2, upPos1, lineColor, serie.clip, grid);
|
||||||
i = segment;
|
i = segment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -979,7 +979,7 @@ namespace XCharts
|
|||||||
if ((isYAxis && ep.y > luPos.y) || (!isYAxis && ep.x > luPos.x))
|
if ((isYAxis && ep.y > luPos.y) || (!isYAxis && ep.x > luPos.x))
|
||||||
{
|
{
|
||||||
var tp = isYAxis ? new Vector3(luPos.x, sp.y) : new Vector3(sp.x, luPos.y);
|
var tp = isYAxis ? new Vector3(luPos.x, sp.y) : new Vector3(sp.x, luPos.y);
|
||||||
CheckClipAndDrawTriangle(vh, sp, luPos, tp, areaColor, areaToColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, sp, luPos, tp, areaColor, areaToColor, areaToColor, serie.clip, grid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, Vector3.zero);
|
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, Vector3.zero);
|
||||||
@@ -1001,7 +1001,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
first = true;
|
first = true;
|
||||||
var tp = isYAxis ? new Vector3(rdPos.x, ep.y) : new Vector3(ep.x, rdPos.y);
|
var tp = isYAxis ? new Vector3(rdPos.x, ep.y) : new Vector3(ep.x, rdPos.y);
|
||||||
CheckClipAndDrawTriangle(vh, rdPos, tp, ep, areaToColor, areaToColor, areaColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, rdPos, tp, ep, areaToColor, areaToColor, areaColor, serie.clip, grid);
|
||||||
sp = ep;
|
sp = ep;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1025,7 +1025,7 @@ namespace XCharts
|
|||||||
if ((isYAxis && ep.y > rdPos.y) || (!isYAxis && ep.x > rdPos.x))
|
if ((isYAxis && ep.y > rdPos.y) || (!isYAxis && ep.x > rdPos.x))
|
||||||
{
|
{
|
||||||
var tp = isYAxis ? new Vector3(rdPos.x, sp.y) : new Vector3(sp.x, rdPos.y);
|
var tp = isYAxis ? new Vector3(rdPos.x, sp.y) : new Vector3(sp.x, rdPos.y);
|
||||||
CheckClipAndDrawTriangle(vh, sp, rdPos, tp, areaColor, areaToColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, sp, rdPos, tp, areaColor, areaToColor, areaToColor, serie.clip, grid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (rdPos != Vector3.zero) DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, Vector3.zero);
|
if (rdPos != Vector3.zero) DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, Vector3.zero);
|
||||||
@@ -1047,7 +1047,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
first = true;
|
first = true;
|
||||||
var tp = isYAxis ? new Vector3(luPos.x, ep.y) : new Vector3(ep.x, luPos.y);
|
var tp = isYAxis ? new Vector3(luPos.x, ep.y) : new Vector3(ep.x, luPos.y);
|
||||||
CheckClipAndDrawTriangle(vh, ep, luPos, tp, areaColor, areaToColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, ep, luPos, tp, areaColor, areaToColor, areaToColor, serie.clip, grid);
|
||||||
sp = ep;
|
sp = ep;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1132,7 +1132,7 @@ namespace XCharts
|
|||||||
diff = isLessthan0 ? -lineWidth : lineWidth;
|
diff = isLessthan0 ? -lineWidth : lineWidth;
|
||||||
areaColor = GetYLerpColor(areaColor, areaToColor, sp, grid);
|
areaColor = GetYLerpColor(areaColor, areaToColor, sp, grid);
|
||||||
if (isLessthan0) areaDiff = -areaDiff;
|
if (isLessthan0) areaDiff = -areaDiff;
|
||||||
CheckClipAndDrawPolygon(vh, new Vector3(zeroPos.x + diff, sp.y), new Vector3(zeroPos.x + diff, ep.y),
|
Internal_CheckClipAndDrawPolygon(vh, new Vector3(zeroPos.x + diff, sp.y), new Vector3(zeroPos.x + diff, ep.y),
|
||||||
ep + areaDiff, sp + areaDiff, areaToColor, areaColor, clip, grid);
|
ep + areaDiff, sp + areaDiff, areaToColor, areaColor, clip, grid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1143,12 +1143,12 @@ namespace XCharts
|
|||||||
if (isLessthan0) areaDiff = -areaDiff;
|
if (isLessthan0) areaDiff = -areaDiff;
|
||||||
if (isLessthan0)
|
if (isLessthan0)
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, ep + areaDiff, sp + areaDiff, new Vector3(sp.x, zeroPos.y + diff),
|
Internal_CheckClipAndDrawPolygon(vh, ep + areaDiff, sp + areaDiff, new Vector3(sp.x, zeroPos.y + diff),
|
||||||
new Vector3(ep.x, zeroPos.y + diff), areaColor, areaToColor, clip, grid);
|
new Vector3(ep.x, zeroPos.y + diff), areaColor, areaToColor, clip, grid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawPolygon(vh, sp + areaDiff, ep + areaDiff, new Vector3(ep.x, zeroPos.y + diff),
|
Internal_CheckClipAndDrawPolygon(vh, sp + areaDiff, ep + areaDiff, new Vector3(ep.x, zeroPos.y + diff),
|
||||||
new Vector3(sp.x, zeroPos.y + diff), areaColor, areaToColor, clip, grid);
|
new Vector3(sp.x, zeroPos.y + diff), areaColor, areaToColor, clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1228,7 +1228,7 @@ namespace XCharts
|
|||||||
start = bezierPoints[i];
|
start = bezierPoints[i];
|
||||||
to = bezierPoints[i + 1];
|
to = bezierPoints[i + 1];
|
||||||
CheckLineGradientColor(start, serie.lineStyle, xAxis, defaultLineColor, ref lineColor);
|
CheckLineGradientColor(start, serie.lineStyle, xAxis, defaultLineColor, ref lineColor);
|
||||||
CheckClipAndDrawLine(vh, start, to, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, start, to, lineWidth, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1251,8 +1251,8 @@ namespace XCharts
|
|||||||
if (!serie.animation.IsInFadeOut())
|
if (!serie.animation.IsInFadeOut())
|
||||||
{
|
{
|
||||||
CheckLineGradientColor(lp, serie.lineStyle, xAxis, defaultLineColor, ref lineColor);
|
CheckLineGradientColor(lp, serie.lineStyle, xAxis, defaultLineColor, ref lineColor);
|
||||||
CheckClipAndDrawTriangle(vh, smoothStartPosUp, startUp, lp, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, smoothStartPosUp, startUp, lp, lineColor, serie.clip, grid);
|
||||||
CheckClipAndDrawTriangle(vh, smoothStartPosDn, startDn, lp, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, smoothStartPosDn, startDn, lp, lineColor, serie.clip, grid);
|
||||||
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, smoothStartPosUp, false);
|
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, smoothStartPosUp, false);
|
||||||
TryAddToList(isTurnBack, isYAxis, smoothDownPoints, lastSmoothDownPoint, smoothStartPosDn, false);
|
TryAddToList(isTurnBack, isYAxis, smoothDownPoints, lastSmoothDownPoint, smoothStartPosDn, false);
|
||||||
}
|
}
|
||||||
@@ -1279,8 +1279,8 @@ namespace XCharts
|
|||||||
toUp = to - diff;
|
toUp = to - diff;
|
||||||
toDn = to + diff;
|
toDn = to + diff;
|
||||||
CheckLineGradientColor(to, serie.lineStyle, xAxis, defaultLineColor, ref lineColor);
|
CheckLineGradientColor(to, serie.lineStyle, xAxis, defaultLineColor, ref lineColor);
|
||||||
if (isYAxis) CheckClipAndDrawPolygon(vh, startDn, toDn, toUp, startUp, lineColor, serie.clip, grid);
|
if (isYAxis) Internal_CheckClipAndDrawPolygon(vh, startDn, toDn, toUp, startUp, lineColor, serie.clip, grid);
|
||||||
else CheckClipAndDrawPolygon(vh, startUp, toUp, toDn, startDn, lineColor, serie.clip, grid);
|
else Internal_CheckClipAndDrawPolygon(vh, startUp, toUp, toDn, startDn, lineColor, serie.clip, grid);
|
||||||
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, toUp, true);
|
TryAddToList(isTurnBack, isYAxis, smoothPoints, lastSmoothPoint, toUp, true);
|
||||||
TryAddToList(isTurnBack, isYAxis, smoothDownPoints, lastSmoothDownPoint, toDn, true);
|
TryAddToList(isTurnBack, isYAxis, smoothDownPoints, lastSmoothDownPoint, toDn, true);
|
||||||
if (isEndPos)
|
if (isEndPos)
|
||||||
@@ -1383,12 +1383,12 @@ namespace XCharts
|
|||||||
if (k < lastSmoothPoints.Count - 1)
|
if (k < lastSmoothPoints.Count - 1)
|
||||||
{
|
{
|
||||||
tnp = lastSmoothPoints[lastCount - 1];
|
tnp = lastSmoothPoints[lastCount - 1];
|
||||||
CheckClipAndDrawTriangle(vh, start, to, tnp, areaColor, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, start, to, tnp, areaColor, areaColor, areaToColor, serie.clip, grid);
|
||||||
while (lastCount < lastSmoothPoints.Count)
|
while (lastCount < lastSmoothPoints.Count)
|
||||||
{
|
{
|
||||||
tlp = lastSmoothPoints[lastCount];
|
tlp = lastSmoothPoints[lastCount];
|
||||||
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
||||||
CheckClipAndDrawTriangle(vh, tnp, to, tlp, areaToColor, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, tnp, to, tlp, areaToColor, areaColor, areaToColor, serie.clip, grid);
|
||||||
lastCount++;
|
lastCount++;
|
||||||
tnp = tlp;
|
tnp = tlp;
|
||||||
}
|
}
|
||||||
@@ -1400,7 +1400,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
tlp = lastSmoothPoints[lastSmoothPoints.Count - 1];
|
tlp = lastSmoothPoints[lastSmoothPoints.Count - 1];
|
||||||
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
||||||
CheckClipAndDrawTriangle(vh, to, start, tlp, areaColor, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, to, start, tlp, areaColor, areaColor, areaToColor, serie.clip, grid);
|
||||||
start = to;
|
start = to;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1410,7 +1410,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
tlp = lastSmoothPoints[lastCount - 1];
|
tlp = lastSmoothPoints[lastCount - 1];
|
||||||
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
||||||
CheckClipAndDrawPolygon(vh, start, to, tnp, tlp, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawPolygon(vh, start, to, tnp, tlp, areaColor, areaToColor, serie.clip, grid);
|
||||||
lastCount++;
|
lastCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1418,12 +1418,12 @@ namespace XCharts
|
|||||||
if (diff < 0)
|
if (diff < 0)
|
||||||
{
|
{
|
||||||
tnp = lastSmoothPoints[lastCount - 1];
|
tnp = lastSmoothPoints[lastCount - 1];
|
||||||
CheckClipAndDrawTriangle(vh, start, to, tnp, areaColor, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, start, to, tnp, areaColor, areaColor, areaToColor, serie.clip, grid);
|
||||||
while (diff < 0 && lastCount < lastSmoothPoints.Count)
|
while (diff < 0 && lastCount < lastSmoothPoints.Count)
|
||||||
{
|
{
|
||||||
tlp = lastSmoothPoints[lastCount];
|
tlp = lastSmoothPoints[lastCount];
|
||||||
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
||||||
CheckClipAndDrawTriangle(vh, tnp, to, tlp, areaToColor, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, tnp, to, tlp, areaToColor, areaColor, areaToColor, serie.clip, grid);
|
||||||
lastCount++;
|
lastCount++;
|
||||||
diff = isYAxis ? tlp.y - to.y : tlp.x - to.x;
|
diff = isYAxis ? tlp.y - to.y : tlp.x - to.x;
|
||||||
tnp = tlp;
|
tnp = tlp;
|
||||||
@@ -1433,7 +1433,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
tlp = lastSmoothPoints[lastCount - 1];
|
tlp = lastSmoothPoints[lastCount - 1];
|
||||||
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
if (serie.animation.CheckDetailBreak(tlp, isYAxis)) break;
|
||||||
CheckClipAndDrawTriangle(vh, start, to, tlp, areaColor, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, start, to, tlp, areaColor, areaColor, areaToColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
start = to;
|
start = to;
|
||||||
@@ -1444,7 +1444,7 @@ namespace XCharts
|
|||||||
var p2 = lastSmoothPoints[lastSmoothPoints.Count - 1];
|
var p2 = lastSmoothPoints[lastSmoothPoints.Count - 1];
|
||||||
if (!serie.animation.CheckDetailBreak(p1, isYAxis) && !serie.animation.CheckDetailBreak(p2, isYAxis))
|
if (!serie.animation.CheckDetailBreak(p1, isYAxis) && !serie.animation.CheckDetailBreak(p2, isYAxis))
|
||||||
{
|
{
|
||||||
CheckClipAndDrawTriangle(vh, p1, start, p2, areaToColor, areaColor, areaToColor, serie.clip, grid);
|
Internal_CheckClipAndDrawTriangle(vh, p1, start, p2, areaToColor, areaColor, areaToColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1477,15 +1477,15 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
ep = linePointList[i];
|
ep = linePointList[i];
|
||||||
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
||||||
CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
||||||
sp = ep;
|
sp = ep;
|
||||||
}
|
}
|
||||||
CheckClipAndDrawPolygon(vh, middle, lineWidth, lineColor, serie.clip, true, grid);
|
Internal_CheckClipAndDrawPolygon(vh, middle, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dataIndex == 1) CheckClipAndDrawPolygon(vh, lp, lineWidth, lineColor, serie.clip, true, grid);
|
if (dataIndex == 1) Internal_CheckClipAndDrawPolygon(vh, lp, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
CheckClipAndDrawLine(vh, lp + diff1, middle + diff1, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, lp + diff1, middle + diff1, lineWidth, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
if (serie.areaStyle.show)
|
if (serie.areaStyle.show)
|
||||||
{
|
{
|
||||||
@@ -1505,7 +1505,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
ep = linePointList[i];
|
ep = linePointList[i];
|
||||||
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
||||||
CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
||||||
if (serie.areaStyle.show)
|
if (serie.areaStyle.show)
|
||||||
{
|
{
|
||||||
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
||||||
@@ -1516,7 +1516,7 @@ namespace XCharts
|
|||||||
if (nnp != np)
|
if (nnp != np)
|
||||||
{
|
{
|
||||||
if (serie.animation.CheckDetailBreak(np, isYAxis)) return false;
|
if (serie.animation.CheckDetailBreak(np, isYAxis)) return false;
|
||||||
CheckClipAndDrawPolygon(vh, np, lineWidth, lineColor, serie.clip, true, grid);
|
Internal_CheckClipAndDrawPolygon(vh, np, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
bool flag = ((isYAxis && nnp.x > np.x && np.x > zeroPos.x) || (!isYAxis && nnp.y > np.y && np.y > zeroPos.y));
|
bool flag = ((isYAxis && nnp.x > np.x && np.x > zeroPos.x) || (!isYAxis && nnp.y > np.y && np.y > zeroPos.y));
|
||||||
if (serie.areaStyle.show && flag)
|
if (serie.areaStyle.show && flag)
|
||||||
{
|
{
|
||||||
@@ -1542,7 +1542,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
ep = linePointList[i];
|
ep = linePointList[i];
|
||||||
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
||||||
CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
||||||
if (serie.areaStyle.show)
|
if (serie.areaStyle.show)
|
||||||
{
|
{
|
||||||
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
||||||
@@ -1550,7 +1550,7 @@ namespace XCharts
|
|||||||
sp = ep;
|
sp = ep;
|
||||||
}
|
}
|
||||||
if (serie.animation.CheckDetailBreak(middle1, isYAxis)) return false;
|
if (serie.animation.CheckDetailBreak(middle1, isYAxis)) return false;
|
||||||
CheckClipAndDrawPolygon(vh, middle1, lineWidth, lineColor, serie.clip, true, grid);
|
Internal_CheckClipAndDrawPolygon(vh, middle1, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
if (serie.areaStyle.show && Vector3.Dot(middleZero - middle1, middle2 - middle1) <= 0)
|
if (serie.areaStyle.show && Vector3.Dot(middleZero - middle1, middle2 - middle1) <= 0)
|
||||||
{
|
{
|
||||||
DrawPolygonToZero(vh, middle1 - diff1, middle1 + diff1, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
DrawPolygonToZero(vh, middle1 - diff1, middle1 + diff1, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
||||||
@@ -1558,8 +1558,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dataIndex == 1) CheckClipAndDrawPolygon(vh, lp, lineWidth, lineColor, serie.clip, true, grid);
|
if (dataIndex == 1) Internal_CheckClipAndDrawPolygon(vh, lp, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
CheckClipAndDrawLine(vh, lp + diff1, middle1 + diff1, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, lp + diff1, middle1 + diff1, lineWidth, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw middle1 to middle2
|
//draw middle1 to middle2
|
||||||
@@ -1570,10 +1570,10 @@ namespace XCharts
|
|||||||
for (int i = 1; i < linePointList.Count; i++)
|
for (int i = 1; i < linePointList.Count; i++)
|
||||||
{
|
{
|
||||||
ep = linePointList[i];
|
ep = linePointList[i];
|
||||||
CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
||||||
sp = ep;
|
sp = ep;
|
||||||
}
|
}
|
||||||
CheckClipAndDrawPolygon(vh, middle2, lineWidth, lineColor, serie.clip, true, grid);
|
Internal_CheckClipAndDrawPolygon(vh, middle2, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
if (serie.areaStyle.show && Vector3.Dot(middleZero - middle2, middle2 - middle1) >= 0)
|
if (serie.areaStyle.show && Vector3.Dot(middleZero - middle2, middle2 - middle1) >= 0)
|
||||||
{
|
{
|
||||||
DrawPolygonToZero(vh, middle2 - diff1, middle2 + diff1, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
DrawPolygonToZero(vh, middle2 - diff1, middle2 + diff1, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
||||||
@@ -1581,7 +1581,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawLine(vh, middle1 + diff2, middle2 + diff2, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, middle1 + diff2, middle2 + diff2, lineWidth, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
//draw middle2 to np
|
//draw middle2 to np
|
||||||
if (Vector3.Distance(middle2, np) > 2 * lineWidth)
|
if (Vector3.Distance(middle2, np) > 2 * lineWidth)
|
||||||
@@ -1592,7 +1592,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
ep = linePointList[i];
|
ep = linePointList[i];
|
||||||
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
||||||
CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
||||||
if (serie.areaStyle.show)
|
if (serie.areaStyle.show)
|
||||||
{
|
{
|
||||||
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
||||||
@@ -1600,7 +1600,7 @@ namespace XCharts
|
|||||||
sp = ep;
|
sp = ep;
|
||||||
}
|
}
|
||||||
if (serie.animation.CheckDetailBreak(np, isYAxis)) return false;
|
if (serie.animation.CheckDetailBreak(np, isYAxis)) return false;
|
||||||
CheckClipAndDrawPolygon(vh, np, lineWidth, lineColor, serie.clip, true, grid);
|
Internal_CheckClipAndDrawPolygon(vh, np, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
if (serie.areaStyle.show)
|
if (serie.areaStyle.show)
|
||||||
{
|
{
|
||||||
DrawPolygonToZero(vh, np - diff1, np + diff1, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
DrawPolygonToZero(vh, np - diff1, np + diff1, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
||||||
@@ -1608,7 +1608,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawLine(vh, middle1 + diff1, middle1 + diff1, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, middle1 + diff1, middle1 + diff1, lineWidth, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LineType.StepEnd:
|
case LineType.StepEnd:
|
||||||
@@ -1627,7 +1627,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
ep = linePointList[i];
|
ep = linePointList[i];
|
||||||
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
if (serie.animation.CheckDetailBreak(ep, isYAxis)) return false;
|
||||||
CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
||||||
if (serie.areaStyle.show)
|
if (serie.areaStyle.show)
|
||||||
{
|
{
|
||||||
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
DrawPolygonToZero(vh, sp, ep, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
||||||
@@ -1635,7 +1635,7 @@ namespace XCharts
|
|||||||
sp = ep;
|
sp = ep;
|
||||||
}
|
}
|
||||||
if (serie.animation.CheckDetailBreak(middle, isYAxis)) return false;
|
if (serie.animation.CheckDetailBreak(middle, isYAxis)) return false;
|
||||||
CheckClipAndDrawPolygon(vh, middle, lineWidth, lineColor, serie.clip, true, grid);
|
Internal_CheckClipAndDrawPolygon(vh, middle, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
if (serie.areaStyle.show && Vector3.Dot(np - middle, middleZero - middle) <= 0)
|
if (serie.areaStyle.show && Vector3.Dot(np - middle, middleZero - middle) <= 0)
|
||||||
{
|
{
|
||||||
DrawPolygonToZero(vh, middle - diff1, middle + diff1, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
DrawPolygonToZero(vh, middle - diff1, middle + diff1, axis, zeroPos, areaColor, areaToColor, areaDiff);
|
||||||
@@ -1643,8 +1643,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dataIndex == 1) CheckClipAndDrawPolygon(vh, lp, lineWidth, lineColor, serie.clip, true, grid);
|
if (dataIndex == 1) Internal_CheckClipAndDrawPolygon(vh, lp, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
CheckClipAndDrawLine(vh, lp + diff1, middle + diff1, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, lp + diff1, middle + diff1, lineWidth, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Vector3.Distance(middle, np) > 2 * lineWidth)
|
if (Vector3.Distance(middle, np) > 2 * lineWidth)
|
||||||
@@ -1654,14 +1654,14 @@ namespace XCharts
|
|||||||
for (int i = 1; i < linePointList.Count; i++)
|
for (int i = 1; i < linePointList.Count; i++)
|
||||||
{
|
{
|
||||||
ep = linePointList[i];
|
ep = linePointList[i];
|
||||||
CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, sp, ep, lineWidth, lineColor, serie.clip, grid);
|
||||||
sp = ep;
|
sp = ep;
|
||||||
}
|
}
|
||||||
if (nnp != np) CheckClipAndDrawPolygon(vh, np, lineWidth, lineColor, serie.clip, true, grid);
|
if (nnp != np) Internal_CheckClipAndDrawPolygon(vh, np, lineWidth, lineColor, serie.clip, true, grid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CheckClipAndDrawLine(vh, middle + diff2, np + diff2, lineWidth, lineColor, serie.clip, grid);
|
Internal_CheckClipAndDrawLine(vh, middle + diff2, np + diff2, lineWidth, lineColor, serie.clip, grid);
|
||||||
}
|
}
|
||||||
bool flag2 = ((isYAxis && middle.x > np.x && np.x > zeroPos.x) || (!isYAxis && middle.y > np.y && np.y > zeroPos.y));
|
bool flag2 = ((isYAxis && middle.x > np.x && np.x > zeroPos.x) || (!isYAxis && middle.y > np.y && np.y > zeroPos.y));
|
||||||
if (serie.areaStyle.show && flag2)
|
if (serie.areaStyle.show && flag2)
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
internal static class PolarHelper
|
public static class PolarHelper
|
||||||
{
|
{
|
||||||
internal static void UpdatePolarCenter(Polar polar, Vector3 chartPosition, float chartWidth, float chartHeight)
|
public static void UpdatePolarCenter(Polar polar, Vector3 chartPosition, float chartWidth, float chartHeight)
|
||||||
{
|
{
|
||||||
if (polar.center.Length < 2) return;
|
if (polar.center.Length < 2) return;
|
||||||
var centerX = polar.center[0] <= 1 ? chartWidth * polar.center[0] : polar.center[0];
|
var centerX = polar.center[0] <= 1 ? chartWidth * polar.center[0] : polar.center[0];
|
||||||
|
|||||||
@@ -1,427 +0,0 @@
|
|||||||
/************************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
|
||||||
/* https://github.com/monitor1394 */
|
|
||||||
/* */
|
|
||||||
/************************************************/
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace XCharts
|
|
||||||
{
|
|
||||||
public static partial class SerieHelper
|
|
||||||
{
|
|
||||||
internal static Color32 GetItemBackgroundColor(Serie serie, SerieData serieData, ChartTheme theme, int index,
|
|
||||||
bool highlight, bool useDefault = true)
|
|
||||||
{
|
|
||||||
var color = ChartConst.clearColor32;
|
|
||||||
if (highlight)
|
|
||||||
{
|
|
||||||
var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
|
|
||||||
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.backgroundColor))
|
|
||||||
{
|
|
||||||
color = itemStyleEmphasis.backgroundColor;
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var itemStyle = GetItemStyle(serie, serieData);
|
|
||||||
if (!ChartHelper.IsClearColor(itemStyle.backgroundColor))
|
|
||||||
{
|
|
||||||
color = itemStyle.backgroundColor;
|
|
||||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
else if (useDefault)
|
|
||||||
{
|
|
||||||
color = theme.GetColor(index);
|
|
||||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
|
||||||
color.a = 50;
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Color32 GetItemColor(Serie serie, SerieData serieData, ChartTheme theme, int index, bool highlight)
|
|
||||||
{
|
|
||||||
if (serie == null) return ChartConst.clearColor32;
|
|
||||||
if (highlight)
|
|
||||||
{
|
|
||||||
var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
|
|
||||||
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.color))
|
|
||||||
{
|
|
||||||
var color = itemStyleEmphasis.color;
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var itemStyle = GetItemStyle(serie, serieData);
|
|
||||||
if (!ChartHelper.IsClearColor(itemStyle.color))
|
|
||||||
{
|
|
||||||
return itemStyle.GetColor();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var color = theme.GetColor(index);
|
|
||||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
internal static Color32 GetItemColor0(Serie serie, SerieData serieData, ChartTheme theme, bool highlight, Color32 defaultColor)
|
|
||||||
{
|
|
||||||
if (serie == null) return ChartConst.clearColor32;
|
|
||||||
if (highlight)
|
|
||||||
{
|
|
||||||
var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
|
|
||||||
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.color))
|
|
||||||
{
|
|
||||||
var color = itemStyleEmphasis.color0;
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var itemStyle = GetItemStyle(serie, serieData);
|
|
||||||
if (!ChartHelper.IsClearColor(itemStyle.color0))
|
|
||||||
{
|
|
||||||
return itemStyle.GetColor0();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var color = defaultColor;
|
|
||||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Color32 GetItemToColor(Serie serie, SerieData serieData, ChartTheme theme, int index, bool highlight)
|
|
||||||
{
|
|
||||||
if (highlight)
|
|
||||||
{
|
|
||||||
var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
|
|
||||||
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.toColor))
|
|
||||||
{
|
|
||||||
return itemStyleEmphasis.GetColor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
|
||||||
if (itemStyle == null) itemStyle = serieData.itemStyle;
|
|
||||||
if (!ChartHelper.IsClearColor(itemStyle.toColor))
|
|
||||||
{
|
|
||||||
var color = itemStyle.toColor;
|
|
||||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
if (!ChartHelper.IsClearColor(itemStyle.color))
|
|
||||||
{
|
|
||||||
var color = itemStyle.color;
|
|
||||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var color = theme.GetColor(index);
|
|
||||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static bool IsDownPoint(Serie serie, int index)
|
|
||||||
{
|
|
||||||
var dataPoints = serie.dataPoints;
|
|
||||||
if (dataPoints.Count < 2) return false;
|
|
||||||
else if (index > 0 && index < dataPoints.Count - 1)
|
|
||||||
{
|
|
||||||
var lp = dataPoints[index - 1];
|
|
||||||
var np = dataPoints[index + 1];
|
|
||||||
var cp = dataPoints[index];
|
|
||||||
var dot = Vector3.Cross(np - lp, cp - np);
|
|
||||||
return dot.z < 0;
|
|
||||||
}
|
|
||||||
else if (index == 0)
|
|
||||||
{
|
|
||||||
return dataPoints[0].y < dataPoints[1].y;
|
|
||||||
}
|
|
||||||
else if (index == dataPoints.Count - 1)
|
|
||||||
{
|
|
||||||
return dataPoints[index].y < dataPoints[index - 1].y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static ItemStyle GetItemStyle(Serie serie, SerieData serieData, bool highlight = false)
|
|
||||||
{
|
|
||||||
if (highlight)
|
|
||||||
{
|
|
||||||
var style = GetItemStyleEmphasis(serie, serieData);
|
|
||||||
if (style == null) return GetItemStyle(serie, serieData, false);
|
|
||||||
else return style;
|
|
||||||
}
|
|
||||||
else if (serie.IsPerformanceMode()) return serie.itemStyle;
|
|
||||||
else if (serieData != null && serieData.enableItemStyle) return serieData.itemStyle;
|
|
||||||
else return serie.itemStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static ItemStyle GetItemStyleEmphasis(Serie serie, SerieData serieData)
|
|
||||||
{
|
|
||||||
if (!serie.IsPerformanceMode() && serieData != null && serieData.enableEmphasis && serieData.emphasis.show)
|
|
||||||
return serieData.emphasis.itemStyle;
|
|
||||||
else if (serie.emphasis.show) return serie.emphasis.itemStyle;
|
|
||||||
else return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SerieLabel GetSerieLabel(Serie serie, SerieData serieData, bool highlight = false)
|
|
||||||
{
|
|
||||||
if (highlight)
|
|
||||||
{
|
|
||||||
if (!serie.IsPerformanceMode() && serieData.enableEmphasis && serieData.emphasis.show)
|
|
||||||
return serieData.emphasis.label;
|
|
||||||
else if (serie.emphasis.show) return serie.emphasis.label;
|
|
||||||
else return serie.label;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!serie.IsPerformanceMode() && serieData.enableLabel) return serieData.label;
|
|
||||||
else return serie.label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData)
|
|
||||||
{
|
|
||||||
if (!serie.IsPerformanceMode() && serieData.enableSymbol) return serieData.symbol;
|
|
||||||
else return serie.symbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Color32 GetAreaColor(Serie serie, ChartTheme theme, int index, bool highlight)
|
|
||||||
{
|
|
||||||
var areaStyle = serie.areaStyle;
|
|
||||||
var color = !ChartHelper.IsClearColor(areaStyle.color) ? areaStyle.color : theme.GetColor(index);
|
|
||||||
if (highlight)
|
|
||||||
{
|
|
||||||
if (!ChartHelper.IsClearColor(areaStyle.highlightColor)) color = areaStyle.highlightColor;
|
|
||||||
else color = ChartHelper.GetHighlightColor(color);
|
|
||||||
}
|
|
||||||
ChartHelper.SetColorOpacity(ref color, areaStyle.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Color32 GetAreaToColor(Serie serie, ChartTheme theme, int index, bool highlight)
|
|
||||||
{
|
|
||||||
var areaStyle = serie.areaStyle;
|
|
||||||
if (!ChartHelper.IsClearColor(areaStyle.toColor))
|
|
||||||
{
|
|
||||||
var color = areaStyle.toColor;
|
|
||||||
if (highlight)
|
|
||||||
{
|
|
||||||
if (!ChartHelper.IsClearColor(areaStyle.highlightToColor)) color = areaStyle.highlightToColor;
|
|
||||||
else color = ChartHelper.GetHighlightColor(color);
|
|
||||||
}
|
|
||||||
ChartHelper.SetColorOpacity(ref color, areaStyle.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return GetAreaColor(serie, theme, index, highlight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Color32 GetLineColor(Serie serie, ChartTheme theme, int index, bool highlight)
|
|
||||||
{
|
|
||||||
Color32 color = ChartConst.clearColor32;
|
|
||||||
if (highlight)
|
|
||||||
{
|
|
||||||
var itemStyleEmphasis = GetItemStyleEmphasis(serie, null);
|
|
||||||
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.color))
|
|
||||||
{
|
|
||||||
color = itemStyleEmphasis.color;
|
|
||||||
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!ChartHelper.IsClearColor(serie.lineStyle.color)) color = serie.lineStyle.GetColor();
|
|
||||||
else if (!ChartHelper.IsClearColor(serie.itemStyle.color)) color = serie.itemStyle.GetColor();
|
|
||||||
if (ChartHelper.IsClearColor(color))
|
|
||||||
{
|
|
||||||
color = theme.GetColor(index);
|
|
||||||
ChartHelper.SetColorOpacity(ref color, serie.lineStyle.opacity);
|
|
||||||
}
|
|
||||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static float GetSymbolBorder(Serie serie, SerieData serieData, ChartTheme theme, bool highlight, bool useLineWidth = true)
|
|
||||||
{
|
|
||||||
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
|
||||||
if (itemStyle != null && itemStyle.borderWidth != 0) return itemStyle.borderWidth;
|
|
||||||
else return serie.lineStyle.GetWidth(theme.serie.lineWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, bool highlight)
|
|
||||||
{
|
|
||||||
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
|
||||||
if (itemStyle != null) return itemStyle.cornerRadius;
|
|
||||||
else return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string GetNumericFormatter(Serie serie, SerieData serieData)
|
|
||||||
{
|
|
||||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
|
||||||
if (!string.IsNullOrEmpty(itemStyle.numericFormatter)) return itemStyle.numericFormatter;
|
|
||||||
else return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获得指定维数的最大最小值
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dimension"></param>
|
|
||||||
/// <param name="dataZoom"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
internal static void UpdateMinMaxData(Serie serie, int dimension, int ceilRate = 0, DataZoom dataZoom = null)
|
|
||||||
{
|
|
||||||
float min = 0, max = 0;
|
|
||||||
GetMinMaxData(serie, dimension, out min, out max, dataZoom);
|
|
||||||
if (ceilRate < 0)
|
|
||||||
{
|
|
||||||
serie.runtimeDataMin = min;
|
|
||||||
serie.runtimeDataMax = max;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
serie.runtimeDataMin = ChartHelper.GetMinDivisibleValue(min, ceilRate);
|
|
||||||
serie.runtimeDataMax = ChartHelper.GetMaxDivisibleValue(max, ceilRate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void GetAllMinMaxData(Serie serie, int ceilRate = 0, DataZoom dataZoom = null)
|
|
||||||
{
|
|
||||||
float min = 0, max = 0;
|
|
||||||
GetMinMaxData(serie, out min, out max, dataZoom);
|
|
||||||
if (ceilRate < 0)
|
|
||||||
{
|
|
||||||
serie.runtimeDataMin = min;
|
|
||||||
serie.runtimeDataMax = max;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
serie.runtimeDataMin = ChartHelper.GetMinDivisibleValue(min, ceilRate);
|
|
||||||
serie.runtimeDataMax = ChartHelper.GetMaxDivisibleValue(max, ceilRate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<SerieData> emptyFilter = new List<SerieData>();
|
|
||||||
/// <summary>
|
|
||||||
/// 根据dataZoom更新数据列表缓存
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dataZoom"></param>
|
|
||||||
internal static void UpdateFilterData(Serie serie, DataZoom dataZoom)
|
|
||||||
{
|
|
||||||
if (dataZoom == null || !dataZoom.enable) return;
|
|
||||||
if (dataZoom.xAxisIndexs.Contains(serie.xAxisIndex))
|
|
||||||
{
|
|
||||||
if (dataZoom.IsXAxisIndexValue(serie.xAxisIndex))
|
|
||||||
{
|
|
||||||
float min = 0, max = 0;
|
|
||||||
dataZoom.GetXAxisIndexValue(serie.xAxisIndex, out min, out max);
|
|
||||||
UpdateFilterData_XAxisValue(serie, dataZoom, 0, min, max);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateFilterData_Category(serie, dataZoom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (dataZoom.yAxisIndexs.Contains(serie.yAxisIndex))
|
|
||||||
{
|
|
||||||
if (dataZoom.IsYAxisIndexValue(serie.yAxisIndex))
|
|
||||||
{
|
|
||||||
float min = 0, max = 0;
|
|
||||||
dataZoom.GetYAxisIndexValue(serie.yAxisIndex, out min, out max);
|
|
||||||
UpdateFilterData_XAxisValue(serie, dataZoom, 0, min, max);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateFilterData_Category(serie, dataZoom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void UpdateFilterData_XAxisValue(Serie serie, DataZoom dataZoom, int dimension, float min, float max)
|
|
||||||
{
|
|
||||||
var data = serie.data;
|
|
||||||
var startValue = min + (max - min) * dataZoom.start / 100;
|
|
||||||
var endValue = min + (max - min) * dataZoom.end / 100;
|
|
||||||
if (endValue < startValue) endValue = startValue;
|
|
||||||
|
|
||||||
if (startValue != serie.m_FilterStartValue || endValue != serie.m_FilterEndValue
|
|
||||||
|| dataZoom.minShowNum != serie.m_FilterMinShow || serie.m_NeedUpdateFilterData)
|
|
||||||
{
|
|
||||||
serie.m_FilterStartValue = startValue;
|
|
||||||
serie.m_FilterEndValue = endValue;
|
|
||||||
serie.m_FilterMinShow = dataZoom.minShowNum;
|
|
||||||
serie.m_NeedUpdateFilterData = false;
|
|
||||||
|
|
||||||
serie.m_FilterData.Clear();
|
|
||||||
foreach (var serieData in data)
|
|
||||||
{
|
|
||||||
var value = serieData.GetData(dimension);
|
|
||||||
if (value >= startValue && value <= endValue)
|
|
||||||
{
|
|
||||||
serie.m_FilterData.Add(serieData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (endValue == 0)
|
|
||||||
{
|
|
||||||
serie.m_FilterData = emptyFilter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void UpdateFilterData_Category(Serie serie, DataZoom dataZoom)
|
|
||||||
{
|
|
||||||
var data = serie.data;
|
|
||||||
var startIndex = (int)((data.Count - 1) * dataZoom.start / 100);
|
|
||||||
var endIndex = (int)((data.Count - 1) * dataZoom.end / 100);
|
|
||||||
if (endIndex < startIndex) endIndex = startIndex;
|
|
||||||
|
|
||||||
if (startIndex != serie.m_FilterStart || endIndex != serie.m_FilterEnd
|
|
||||||
|| dataZoom.minShowNum != serie.m_FilterMinShow || serie.m_NeedUpdateFilterData)
|
|
||||||
{
|
|
||||||
serie.m_FilterStart = startIndex;
|
|
||||||
serie.m_FilterEnd = endIndex;
|
|
||||||
serie.m_FilterMinShow = dataZoom.minShowNum;
|
|
||||||
serie.m_NeedUpdateFilterData = false;
|
|
||||||
var count = endIndex == startIndex ? 1 : endIndex - startIndex + 1;
|
|
||||||
if (count < dataZoom.minShowNum)
|
|
||||||
{
|
|
||||||
if (dataZoom.minShowNum > data.Count) count = data.Count;
|
|
||||||
else count = dataZoom.minShowNum;
|
|
||||||
}
|
|
||||||
if (data.Count > 0)
|
|
||||||
{
|
|
||||||
if (startIndex + count > data.Count)
|
|
||||||
{
|
|
||||||
int start = endIndex - count;
|
|
||||||
data = data.GetRange(start < 0 ? 0 : start, count);
|
|
||||||
}
|
|
||||||
else serie.m_FilterData = data.GetRange(startIndex, count);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
serie.m_FilterData = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (endIndex == 0)
|
|
||||||
{
|
|
||||||
serie.m_FilterData = emptyFilter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e5c421b17fb6f45a283f4f57efce686f
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -12,7 +12,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
public static class VesselHelper
|
public static class VesselHelper
|
||||||
{
|
{
|
||||||
internal static Color32 GetColor(Vessel vessel, Serie serie, ChartTheme theme, List<string> legendRealShowName)
|
public static Color32 GetColor(Vessel vessel, Serie serie, ChartTheme theme, List<string> legendRealShowName)
|
||||||
{
|
{
|
||||||
if (serie != null && vessel.autoColor)
|
if (serie != null && vessel.autoColor)
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void UpdateVesselCenter(Vessel vessel, Vector3 chartPosition, float chartWidth, float chartHeight)
|
public static void UpdateVesselCenter(Vessel vessel, Vector3 chartPosition, float chartWidth, float chartHeight)
|
||||||
{
|
{
|
||||||
if (vessel.center.Length < 2) return;
|
if (vessel.center.Length < 2) return;
|
||||||
var centerX = vessel.center[0] <= 1 ? chartWidth * vessel.center[0] : vessel.center[0];
|
var centerX = vessel.center[0] <= 1 ? chartWidth * vessel.center[0] : vessel.center[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user