mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 02:10:16 +00:00
增加漏斗图基础代码支持
This commit is contained in:
@@ -247,13 +247,14 @@ namespace XCharts
|
|||||||
var gap = 0;
|
var gap = 0;
|
||||||
var namegap = 0;
|
var namegap = 0;
|
||||||
#endif
|
#endif
|
||||||
EditorGUI.PropertyField(new Rect(drawRect.x, drawRect.y, pos.width - 2 * nameWid - 2, pos.height), m_DataDimension);
|
EditorGUI.PropertyField(new Rect(drawRect.x, drawRect.y, pos.width - 2 * nameWid - 2, pos.height),
|
||||||
|
m_DataDimension);
|
||||||
var nameRect = new Rect(pos.width - 2 * nameWid + 14 + gap, drawRect.y, nameWid - gap, pos.height);
|
var nameRect = new Rect(pos.width - 2 * nameWid + 14 + gap, drawRect.y, nameWid - gap, pos.height);
|
||||||
if (XChartsSettings.editorBlockEnable)
|
if (XChartsSettings.editorBlockEnable)
|
||||||
{
|
{
|
||||||
nameRect.x += ChartEditorHelper.BLOCK_WIDTH;
|
nameRect.x += ChartEditorHelper.BLOCK_WIDTH;
|
||||||
}
|
}
|
||||||
if (GUI.Button(nameRect, new GUIContent("Name")))
|
if (GUI.Button(nameRect, new GUIContent("name")))
|
||||||
{
|
{
|
||||||
m_ShowDataName.boolValue = !m_ShowDataName.boolValue;
|
m_ShowDataName.boolValue = !m_ShowDataName.boolValue;
|
||||||
}
|
}
|
||||||
@@ -262,10 +263,17 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
iconRect.x += ChartEditorHelper.BLOCK_WIDTH;
|
iconRect.x += ChartEditorHelper.BLOCK_WIDTH;
|
||||||
}
|
}
|
||||||
if (GUI.Button(iconRect, new GUIContent("More...")))
|
if (GUI.Button(iconRect, new GUIContent("more")))
|
||||||
{
|
{
|
||||||
m_ShowDataIcon.boolValue = !m_ShowDataIcon.boolValue;
|
m_ShowDataIcon.boolValue = !m_ShowDataIcon.boolValue;
|
||||||
}
|
}
|
||||||
|
var jsonRect = new Rect(pos.width - 70, drawRect.y - pos.height - 2, 90, pos.height);
|
||||||
|
if (GUI.Button(jsonRect, new GUIContent("data from json")))
|
||||||
|
{
|
||||||
|
PraseJsonDataEditor.chart = prop.serializedObject.targetObject as BaseChart;
|
||||||
|
PraseJsonDataEditor.serieIndex = index;
|
||||||
|
PraseJsonDataEditor.ShowWindow();
|
||||||
|
}
|
||||||
AddSingleLineHeight();
|
AddSingleLineHeight();
|
||||||
var listSize = m_Datas.arraySize;
|
var listSize = m_Datas.arraySize;
|
||||||
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
|
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace XCharts
|
|||||||
PropertyField(prop, "m_LineType");
|
PropertyField(prop, "m_LineType");
|
||||||
PropertyField(prop, "m_LineColor");
|
PropertyField(prop, "m_LineColor");
|
||||||
PropertyField(prop, "m_LineWidth");
|
PropertyField(prop, "m_LineWidth");
|
||||||
|
PropertyField(prop, "m_LineGap");
|
||||||
PropertyField(prop, "m_LineLength1");
|
PropertyField(prop, "m_LineLength1");
|
||||||
PropertyField(prop, "m_LineLength2");
|
PropertyField(prop, "m_LineLength2");
|
||||||
PropertyField(prop, "m_TextStyle");
|
PropertyField(prop, "m_TextStyle");
|
||||||
|
|||||||
54
Assets/XCharts/Editor/Window/PraseJsonDataEditor.cs
Normal file
54
Assets/XCharts/Editor/Window/PraseJsonDataEditor.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/************************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/************************************************/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
public class PraseJsonDataEditor : EditorWindow
|
||||||
|
{
|
||||||
|
public static BaseChart chart;
|
||||||
|
public static int serieIndex;
|
||||||
|
private static PraseJsonDataEditor window;
|
||||||
|
private string inputJsonText = "";
|
||||||
|
|
||||||
|
public static void ShowWindow()
|
||||||
|
{
|
||||||
|
window = GetWindow<PraseJsonDataEditor>();
|
||||||
|
window.titleContent = new GUIContent("PraseJsonData");
|
||||||
|
window.minSize = new Vector2(450, 550);
|
||||||
|
window.Focus();
|
||||||
|
window.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnInspectorUpdate()
|
||||||
|
{
|
||||||
|
Repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGUI()
|
||||||
|
{
|
||||||
|
if (chart == null)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EditorGUILayout.LabelField("Input json data, or echarts serie data:");
|
||||||
|
inputJsonText = EditorGUILayout.TextArea(inputJsonText, GUILayout.Height(400));
|
||||||
|
if (GUILayout.Button("Add"))
|
||||||
|
{
|
||||||
|
var serie = chart.series.GetSerie(serieIndex);
|
||||||
|
if (serie != null)
|
||||||
|
{
|
||||||
|
serie.ParseJsonData(inputJsonText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XCharts/Editor/Window/PraseJsonDataEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/Window/PraseJsonDataEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dca7fd076eaf147c8839394e0652ecd0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -530,14 +530,14 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal virtual void UpdateLegendColor(string legendName, bool active)
|
public virtual void UpdateLegendColor(string legendName, bool active)
|
||||||
{
|
{
|
||||||
var legendIndex = m_LegendRealShowName.IndexOf(legendName);
|
var legendIndex = m_LegendRealShowName.IndexOf(legendName);
|
||||||
if (legendIndex >= 0)
|
if (legendIndex >= 0)
|
||||||
{
|
{
|
||||||
foreach (var legend in m_Legends)
|
foreach (var legend in m_Legends)
|
||||||
{
|
{
|
||||||
var iconColor = LegendHelper.GetIconColor(legend, legendIndex, m_Theme, m_Series, legendName, active);
|
var iconColor = LegendHelper.GetIconColor(this, legendIndex, legendName, active);
|
||||||
var contentColor = LegendHelper.GetContentColor(legend, m_Theme, active);
|
var contentColor = LegendHelper.GetContentColor(legend, m_Theme, active);
|
||||||
legend.UpdateButtonColor(legendName, iconColor);
|
legend.UpdateButtonColor(legendName, iconColor);
|
||||||
legend.UpdateContentColor(legendName, contentColor);
|
legend.UpdateContentColor(legendName, contentColor);
|
||||||
@@ -775,6 +775,11 @@ namespace XCharts
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual bool GetCustomSerieDataNameForColor()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public int GetLegendRealShowNameIndex(string name)
|
public int GetLegendRealShowNameIndex(string name)
|
||||||
{
|
{
|
||||||
return m_LegendRealShowName.IndexOf(name);
|
return m_LegendRealShowName.IndexOf(name);
|
||||||
|
|||||||
@@ -225,6 +225,35 @@ namespace XCharts
|
|||||||
Sum
|
Sum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据排序方式
|
||||||
|
/// </summary>
|
||||||
|
public enum SerieDataSortType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 按 data 的顺序
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
/// <summary>
|
||||||
|
/// 升序
|
||||||
|
/// </summary>
|
||||||
|
Ascending,
|
||||||
|
/// <summary>
|
||||||
|
/// 降序
|
||||||
|
/// </summary>
|
||||||
|
Descending,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 对齐方式
|
||||||
|
/// </summary>
|
||||||
|
public enum SerieAlign
|
||||||
|
{
|
||||||
|
Center,
|
||||||
|
Left,
|
||||||
|
Right
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 系列。每个系列通过 type 决定自己的图表类型。
|
/// 系列。每个系列通过 type 决定自己的图表类型。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -263,6 +292,8 @@ namespace XCharts
|
|||||||
|
|
||||||
[SerializeField] private float m_Min;
|
[SerializeField] private float m_Min;
|
||||||
[SerializeField] private float m_Max;
|
[SerializeField] private float m_Max;
|
||||||
|
[SerializeField] private float m_MinSize = 0f;
|
||||||
|
[SerializeField] private float m_MaxSize = 1f;
|
||||||
[SerializeField] private float m_StartAngle;
|
[SerializeField] private float m_StartAngle;
|
||||||
[SerializeField] private float m_EndAngle;
|
[SerializeField] private float m_EndAngle;
|
||||||
[SerializeField] private float m_MinAngle;
|
[SerializeField] private float m_MinAngle;
|
||||||
@@ -303,6 +334,10 @@ namespace XCharts
|
|||||||
[SerializeField] private float m_WaveSpeed = 5f;
|
[SerializeField] private float m_WaveSpeed = 5f;
|
||||||
[SerializeField] private float m_WaveOffset = 0f;
|
[SerializeField] private float m_WaveOffset = 0f;
|
||||||
[SerializeField] private RadarType m_RadarType = RadarType.Multiple;
|
[SerializeField] private RadarType m_RadarType = RadarType.Multiple;
|
||||||
|
|
||||||
|
[SerializeField] private SerieDataSortType m_DataSortType = SerieDataSortType.Descending;
|
||||||
|
[SerializeField] private Orient m_Orient = Orient.Vertical;
|
||||||
|
[SerializeField] private SerieAlign m_Align = SerieAlign.Center;
|
||||||
[SerializeField] private float m_Left;
|
[SerializeField] private float m_Left;
|
||||||
[SerializeField] private float m_Right;
|
[SerializeField] private float m_Right;
|
||||||
[SerializeField] private float m_Top;
|
[SerializeField] private float m_Top;
|
||||||
@@ -627,7 +662,7 @@ namespace XCharts
|
|||||||
set { if (value != null && value.Length == 2) { m_Radius = value; SetVerticesDirty(); } }
|
set { if (value != null && value.Length == 2) { m_Radius = value; SetVerticesDirty(); } }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最小值,映射到 startAngle。
|
/// 最小值。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float min
|
public float min
|
||||||
{
|
{
|
||||||
@@ -635,7 +670,7 @@ namespace XCharts
|
|||||||
set { if (PropertyUtil.SetStruct(ref m_Min, value)) SetVerticesDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_Min, value)) SetVerticesDirty(); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最大值,映射到 endAngle。
|
/// 最大值。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float max
|
public float max
|
||||||
{
|
{
|
||||||
@@ -643,6 +678,22 @@ namespace XCharts
|
|||||||
set { if (PropertyUtil.SetStruct(ref m_Max, value)) SetVerticesDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_Max, value)) SetVerticesDirty(); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 数据最小值 min 映射的宽度。
|
||||||
|
/// </summary>
|
||||||
|
public float minSize
|
||||||
|
{
|
||||||
|
get { return m_MinSize; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_MinSize, value)) SetVerticesDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 数据最大值 max 映射的宽度。
|
||||||
|
/// </summary>
|
||||||
|
public float maxSize
|
||||||
|
{
|
||||||
|
get { return m_MaxSize; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_MaxSize, value)) SetVerticesDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// 起始角度。和时钟一样,12点钟位置是0度,顺时针到360度。
|
/// 起始角度。和时钟一样,12点钟位置是0度,顺时针到360度。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float startAngle
|
public float startAngle
|
||||||
@@ -975,6 +1026,30 @@ namespace XCharts
|
|||||||
set { if (PropertyUtil.SetStruct(ref m_InsertDataToHead, value)) SetAllDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_InsertDataToHead, value)) SetAllDirty(); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 组件的数据排序。
|
||||||
|
/// </summary>
|
||||||
|
public SerieDataSortType dataSortType
|
||||||
|
{
|
||||||
|
get { return m_DataSortType; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_DataSortType, value)) SetVerticesDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 组件的朝向。
|
||||||
|
/// </summary>
|
||||||
|
public Orient orient
|
||||||
|
{
|
||||||
|
get { return m_Orient; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_Orient, value)) SetVerticesDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 组件水平方向对齐方式。
|
||||||
|
/// </summary>
|
||||||
|
public SerieAlign align
|
||||||
|
{
|
||||||
|
get { return m_Align; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_Align, value)) SetVerticesDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// 系列中的数据内容数组。SerieData可以设置1到n维数据。
|
/// 系列中的数据内容数组。SerieData可以设置1到n维数据。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<SerieData> data { get { return m_Data; } }
|
public List<SerieData> data { get { return m_Data; } }
|
||||||
@@ -1078,6 +1153,7 @@ namespace XCharts
|
|||||||
public float runtimeY { get; internal set; }
|
public float runtimeY { get; internal set; }
|
||||||
public float runtimeWidth { get; internal set; }
|
public float runtimeWidth { get; internal set; }
|
||||||
public float runtimeHeight { get; internal set; }
|
public float runtimeHeight { get; internal set; }
|
||||||
|
public List<SerieData> runtimeFilterData { get { return m_FilterData; } }
|
||||||
public bool nameDirty { get { return m_NameDirty; } }
|
public bool nameDirty { get { return m_NameDirty; } }
|
||||||
|
|
||||||
private void SetNameDirty()
|
private void SetNameDirty()
|
||||||
@@ -1584,7 +1660,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return m_Data;
|
return runtimeFilterData.Count > 0 ? runtimeFilterData : m_Data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ namespace XCharts
|
|||||||
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>();
|
||||||
|
private List<Vector2> m_PolygonPoints = new List<Vector2>();
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
@@ -381,5 +382,30 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (labelObject != null) labelObject.SetLabelActive(flag);
|
if (labelObject != null) labelObject.SetLabelActive(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetPolygon(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4)
|
||||||
|
{
|
||||||
|
m_PolygonPoints.Clear();
|
||||||
|
m_PolygonPoints.Add(p1);
|
||||||
|
m_PolygonPoints.Add(p2);
|
||||||
|
m_PolygonPoints.Add(p3);
|
||||||
|
m_PolygonPoints.Add(p4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInPolygon(Vector2 p)
|
||||||
|
{
|
||||||
|
if (m_PolygonPoints.Count == 0) return false;
|
||||||
|
var inside = false;
|
||||||
|
var j = m_PolygonPoints.Count - 1;
|
||||||
|
for (int i = 0; i < m_PolygonPoints.Count; j = i++)
|
||||||
|
{
|
||||||
|
var pi = m_PolygonPoints[i];
|
||||||
|
var pj = m_PolygonPoints[j];
|
||||||
|
if (((pi.y <= p.y && p.y < pj.y) || (pj.y <= p.y && p.y < pi.y)) &&
|
||||||
|
(p.x < (pj.x - pi.x) * (p.y - pi.y) / (pj.y - pi.y) + pi.x))
|
||||||
|
inside = !inside;
|
||||||
|
}
|
||||||
|
return inside;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,20 +44,20 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Top,
|
Top,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the left of symbol.
|
|
||||||
/// 图形标志的左边。
|
|
||||||
/// </summary>
|
|
||||||
//Left,
|
|
||||||
/// <summary>
|
|
||||||
/// the right of symbol.
|
|
||||||
/// 图形标志的右边。
|
|
||||||
/// </summary>
|
|
||||||
//Right,
|
|
||||||
/// <summary>
|
|
||||||
/// the bottom of symbol.
|
/// the bottom of symbol.
|
||||||
/// 图形标志的底部。
|
/// 图形标志的底部。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Bottom,
|
Bottom,
|
||||||
|
/// <summary>
|
||||||
|
/// the left of symbol.
|
||||||
|
/// 图形标志的左边。
|
||||||
|
/// </summary>
|
||||||
|
Left,
|
||||||
|
/// <summary>
|
||||||
|
/// the right of symbol.
|
||||||
|
/// 图形标志的右边。
|
||||||
|
/// </summary>
|
||||||
|
Right,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -91,6 +91,7 @@ namespace XCharts
|
|||||||
[SerializeField] private LineType m_LineType = LineType.BrokenLine;
|
[SerializeField] private LineType m_LineType = LineType.BrokenLine;
|
||||||
[SerializeField] private Color32 m_LineColor = ChartConst.clearColor32;
|
[SerializeField] private Color32 m_LineColor = ChartConst.clearColor32;
|
||||||
[SerializeField] private float m_LineWidth = 1.0f;
|
[SerializeField] private float m_LineWidth = 1.0f;
|
||||||
|
[SerializeField] private float m_LineGap = 1.0f;
|
||||||
[SerializeField] private float m_LineLength1 = 25f;
|
[SerializeField] private float m_LineLength1 = 25f;
|
||||||
[SerializeField] private float m_LineLength2 = 15f;
|
[SerializeField] private float m_LineLength2 = 15f;
|
||||||
[SerializeField] private bool m_Border = false;
|
[SerializeField] private bool m_Border = false;
|
||||||
@@ -114,6 +115,7 @@ namespace XCharts
|
|||||||
m_LineType = LineType.BrokenLine;
|
m_LineType = LineType.BrokenLine;
|
||||||
m_LineColor = Color.clear;
|
m_LineColor = Color.clear;
|
||||||
m_LineWidth = 1.0f;
|
m_LineWidth = 1.0f;
|
||||||
|
m_LineGap = 1.0f;
|
||||||
m_LineLength1 = 25f;
|
m_LineLength1 = 25f;
|
||||||
m_LineLength2 = 15f;
|
m_LineLength2 = 15f;
|
||||||
m_Border = false;
|
m_Border = false;
|
||||||
@@ -251,6 +253,15 @@ namespace XCharts
|
|||||||
set { if (PropertyUtil.SetStruct(ref m_LineWidth, value)) SetVerticesDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_LineWidth, value)) SetVerticesDirty(); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// the gap of container and guild line.
|
||||||
|
/// 视觉引导线和容器的间距。
|
||||||
|
/// </summary>
|
||||||
|
public float lineGap
|
||||||
|
{
|
||||||
|
get { return m_LineGap; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_LineGap, value)) SetVerticesDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// The length of the first segment of visual guide line.
|
/// The length of the first segment of visual guide line.
|
||||||
/// 视觉引导线第一段的长度。
|
/// 视觉引导线第一段的长度。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -325,5 +336,45 @@ namespace XCharts
|
|||||||
get { return m_TextStyle; }
|
get { return m_TextStyle; }
|
||||||
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetAllDirty(); }
|
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetAllDirty(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsInside()
|
||||||
|
{
|
||||||
|
return position == Position.Inside || position == Position.Center;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color GetColor(Color defaultColor)
|
||||||
|
{
|
||||||
|
if (ChartHelper.IsClearColor(textStyle.color))
|
||||||
|
{
|
||||||
|
return IsInside() ? Color.black : defaultColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return textStyle.color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextAnchor GetAutoAlignment()
|
||||||
|
{
|
||||||
|
if (textStyle.autoAlign) return textStyle.alignment;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (position)
|
||||||
|
{
|
||||||
|
case SerieLabel.Position.Inside:
|
||||||
|
case SerieLabel.Position.Center:
|
||||||
|
case SerieLabel.Position.Top:
|
||||||
|
case SerieLabel.Position.Bottom:
|
||||||
|
return TextAnchor.MiddleCenter;
|
||||||
|
case SerieLabel.Position.Outside:
|
||||||
|
case SerieLabel.Position.Right:
|
||||||
|
return TextAnchor.MiddleLeft;
|
||||||
|
case SerieLabel.Position.Left:
|
||||||
|
return TextAnchor.MiddleRight;
|
||||||
|
default:
|
||||||
|
return TextAnchor.MiddleCenter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace XCharts
|
|||||||
public class TextStyle : SubComponent
|
public class TextStyle : SubComponent
|
||||||
{
|
{
|
||||||
[SerializeField] private Font m_Font;
|
[SerializeField] private Font m_Font;
|
||||||
[SerializeField] private bool m_AutoWrap = true;
|
[SerializeField] private bool m_AutoWrap = false;
|
||||||
[SerializeField] private bool m_AutoAlign = true;
|
[SerializeField] private bool m_AutoAlign = true;
|
||||||
[SerializeField] private float m_Rotate = 0;
|
[SerializeField] private float m_Rotate = 0;
|
||||||
[SerializeField] private Vector2 m_Offset = Vector2.zero;
|
[SerializeField] private Vector2 m_Offset = Vector2.zero;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace XCharts
|
|||||||
private static Regex s_RegexN = new Regex(@"^\d+", RegexOptions.IgnoreCase);
|
private static Regex s_RegexN = new Regex(@"^\d+", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexN_N = new Regex(@"\d+-\d+", RegexOptions.IgnoreCase);
|
private static Regex s_RegexN_N = new Regex(@"\d+-\d+", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexFn = new Regex(@"[c-g|x|p|r]\d*|0\.#*", RegexOptions.IgnoreCase);
|
private static Regex s_RegexFn = new Regex(@"[c-g|x|p|r]\d*|0\.#*", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexNewLine = new Regex(@"[\\|/]+n", RegexOptions.IgnoreCase);
|
private static Regex s_RegexNewLine = new Regex(@"[\\|/]+n|</br>|<br>|<br/>", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexForAxisLabel = new Regex(@"{value(:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
private static Regex s_RegexForAxisLabel = new Regex(@"{value(:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexSubForAxisLabel = new Regex(@"(value)|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase);
|
private static Regex s_RegexSubForAxisLabel = new Regex(@"(value)|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase);
|
||||||
private static Regex s_RegexForSerieLabel = new Regex(@"{[a-d|\.](:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
private static Regex s_RegexForSerieLabel = new Regex(@"{[a-d|\.](:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase);
|
||||||
|
|||||||
@@ -18,18 +18,19 @@ namespace XCharts
|
|||||||
else return theme.legend.unableColor;
|
else return theme.legend.unableColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color GetIconColor(Legend legend, int readIndex, ChartTheme theme, Series series, string legendName, bool active)
|
public static Color GetIconColor(BaseChart chart, int readIndex, string legendName, bool active)
|
||||||
{
|
{
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
|
var legend = chart.legend;
|
||||||
if (legend.itemAutoColor || legend.GetIcon(readIndex) == null)
|
if (legend.itemAutoColor || legend.GetIcon(readIndex) == null)
|
||||||
{
|
{
|
||||||
return SeriesHelper.GetNameColor(series, readIndex, legendName, theme);
|
return SeriesHelper.GetNameColor(chart, readIndex, legendName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Color.white;
|
return Color.white;
|
||||||
}
|
}
|
||||||
else return theme.legend.unableColor;
|
else return chart.theme.legend.unableColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LegendItem AddLegendItem(Legend legend, int i, string legendName, Transform parent,
|
public static LegendItem AddLegendItem(Legend legend, int i, string legendName, Transform parent,
|
||||||
@@ -279,9 +280,9 @@ namespace XCharts
|
|||||||
return show;
|
return show;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsSerieLegend(Series series, string legendName, SerieType type)
|
public static bool IsSerieLegend(BaseChart chart, string legendName, SerieType type)
|
||||||
{
|
{
|
||||||
foreach (var serie in series.list)
|
foreach (var serie in chart.series.list)
|
||||||
{
|
{
|
||||||
if (serie.type == type)
|
if (serie.type == type)
|
||||||
{
|
{
|
||||||
@@ -295,6 +296,19 @@ namespace XCharts
|
|||||||
if (legendName.Equals(serieData.name)) return true;
|
if (legendName.Equals(serieData.name)) return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SerieType.Custom:
|
||||||
|
if (chart.GetCustomSerieDataNameForColor())
|
||||||
|
{
|
||||||
|
foreach (var serieData in serie.data)
|
||||||
|
{
|
||||||
|
if (legendName.Equals(serieData.name)) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (legendName.Equals(serie.name)) return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (legendName.Equals(serie.name)) return true;
|
if (legendName.Equals(serie.name)) return true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -540,5 +540,41 @@ namespace XCharts
|
|||||||
serie.m_FilterData = emptyFilter;
|
serie.m_FilterData = emptyFilter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UpdateSerieRuntimeFilterData(Serie serie, bool filterInvisible = true)
|
||||||
|
{
|
||||||
|
serie.runtimeFilterData.Clear();
|
||||||
|
foreach (var serieData in serie.data)
|
||||||
|
{
|
||||||
|
if (!filterInvisible || (filterInvisible && serieData.show))
|
||||||
|
serie.runtimeFilterData.Add(serieData);
|
||||||
|
}
|
||||||
|
switch (serie.dataSortType)
|
||||||
|
{
|
||||||
|
case SerieDataSortType.Ascending:
|
||||||
|
serie.runtimeFilterData.Sort(delegate (SerieData data1, SerieData data2)
|
||||||
|
{
|
||||||
|
var value1 = data1.GetData(1);
|
||||||
|
var value2 = data2.GetData(1);
|
||||||
|
if (value1 == value2) return 0;
|
||||||
|
else if (value1 > value2) return 1;
|
||||||
|
else return -1;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case SerieDataSortType.Descending:
|
||||||
|
serie.runtimeFilterData.Sort(delegate (SerieData data1, SerieData data2)
|
||||||
|
{
|
||||||
|
var value1 = data1.GetData(1);
|
||||||
|
var value2 = data2.GetData(1);
|
||||||
|
if (value1 == value2) return 0;
|
||||||
|
else if (value1 > value2) return -1;
|
||||||
|
else return 1;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case SerieDataSortType.None:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,45 +89,46 @@ namespace XCharts
|
|||||||
/// 获得所有系列名,不包含空名字。
|
/// 获得所有系列名,不包含空名字。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void UpdateSerieNameList(Series series, ref List<string> serieNameList)
|
public static void UpdateSerieNameList(BaseChart chart, ref List<string> serieNameList)
|
||||||
{
|
{
|
||||||
serieNameList.Clear();
|
serieNameList.Clear();
|
||||||
for (int n = 0; n < series.list.Count; n++)
|
for (int n = 0; n < chart.series.list.Count; n++)
|
||||||
{
|
{
|
||||||
var serie = series.GetSerie(n);
|
var serie = chart.series.GetSerie(n);
|
||||||
switch (serie.type)
|
if (serie.type == SerieType.Pie
|
||||||
|
|| serie.type == SerieType.Radar
|
||||||
|
|| serie.type == SerieType.Ring
|
||||||
|
|| (serie.type == SerieType.Custom && chart.GetCustomSerieDataNameForColor()))
|
||||||
{
|
{
|
||||||
case SerieType.Pie:
|
for (int i = 0; i < serie.data.Count; i++)
|
||||||
case SerieType.Radar:
|
{
|
||||||
case SerieType.Ring:
|
if (serie.type == SerieType.Pie && serie.IsIgnoreValue(serie.data[i])) continue;
|
||||||
for (int i = 0; i < serie.data.Count; i++)
|
if (string.IsNullOrEmpty(serie.data[i].name))
|
||||||
{
|
serieNameList.Add(ChartCached.IntToStr(i));
|
||||||
if (serie.type == SerieType.Pie && serie.IsIgnoreValue(serie.data[i])) continue;
|
else if (!serieNameList.Contains(serie.data[i].name))
|
||||||
if (string.IsNullOrEmpty(serie.data[i].name))
|
serieNameList.Add(serie.data[i].name);
|
||||||
serieNameList.Add(ChartCached.IntToStr(i));
|
}
|
||||||
else if (!serieNameList.Contains(serie.data[i].name))
|
}
|
||||||
serieNameList.Add(serie.data[i].name);
|
else
|
||||||
}
|
{
|
||||||
break;
|
if (string.IsNullOrEmpty(serie.name))
|
||||||
default:
|
serieNameList.Add(ChartCached.IntToStr(n));
|
||||||
if (string.IsNullOrEmpty(serie.name))
|
else if (!serieNameList.Contains(serie.name))
|
||||||
serieNameList.Add(ChartCached.IntToStr(n));
|
serieNameList.Add(serie.name);
|
||||||
else if (!serieNameList.Contains(serie.name))
|
|
||||||
serieNameList.Add(serie.name);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color GetNameColor(Series series, int index, string name, ChartTheme theme)
|
public static Color GetNameColor(BaseChart chart, int index, string name)
|
||||||
{
|
{
|
||||||
Serie destSerie = null;
|
Serie destSerie = null;
|
||||||
SerieData destSerieData = null;
|
SerieData destSerieData = null;
|
||||||
|
var series = chart.series;
|
||||||
for (int n = 0; n < series.list.Count; n++)
|
for (int n = 0; n < series.list.Count; n++)
|
||||||
{
|
{
|
||||||
var serie = series.GetSerie(n);
|
var serie = series.GetSerie(n);
|
||||||
if (serie.type == SerieType.Pie || serie.type == SerieType.Radar || serie.type == SerieType.Ring)
|
if (serie.type == SerieType.Pie || serie.type == SerieType.Radar || serie.type == SerieType.Ring
|
||||||
|
|| (serie.type == SerieType.Custom && chart.GetCustomSerieDataNameForColor()))
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int i = 0; i < serie.data.Count; i++)
|
for (int i = 0; i < serie.data.Count; i++)
|
||||||
@@ -152,7 +153,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SerieHelper.GetItemColor(destSerie, destSerieData, theme, index, false);
|
return SerieHelper.GetItemColor(destSerie, destSerieData, chart.theme, index, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsNeedTooltipSerie(Serie serie, Tooltip tooltip)
|
public static bool IsNeedTooltipSerie(Serie serie, Tooltip tooltip)
|
||||||
{
|
{
|
||||||
//if (serie.type == SerieType.Pie || serie.type == SerieType.Radar || serie.type == SerieType.Ring)
|
//if (serie.type == SerieType.Pie || serie.type == SerieType.Radar || serie.type == SerieType.Ring)
|
||||||
if (serie.type == SerieType.Pie || serie.type == SerieType.Ring)
|
if (serie.type == SerieType.Pie || serie.type == SerieType.Ring)
|
||||||
@@ -505,7 +505,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsSelectedSerie(Tooltip tooltip, int serieIndex)
|
public static bool IsSelectedSerie(Tooltip tooltip, int serieIndex)
|
||||||
{
|
{
|
||||||
if (tooltip.runtimeSerieIndex.ContainsKey(serieIndex))
|
if (tooltip.runtimeSerieIndex.ContainsKey(serieIndex))
|
||||||
{
|
{
|
||||||
@@ -514,14 +514,14 @@ namespace XCharts
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetItemFormatter(Tooltip tooltip, Serie serie, SerieData serieData)
|
public static string GetItemFormatter(Tooltip tooltip, Serie serie, SerieData serieData)
|
||||||
{
|
{
|
||||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
||||||
if (!string.IsNullOrEmpty(itemStyle.tooltipFormatter)) return itemStyle.tooltipFormatter;
|
if (!string.IsNullOrEmpty(itemStyle.tooltipFormatter)) return itemStyle.tooltipFormatter;
|
||||||
else return tooltip.itemFormatter;
|
else return tooltip.itemFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)
|
public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)
|
||||||
{
|
{
|
||||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
||||||
if (!string.IsNullOrEmpty(itemStyle.numericFormatter)) return itemStyle.numericFormatter;
|
if (!string.IsNullOrEmpty(itemStyle.numericFormatter)) return itemStyle.numericFormatter;
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ namespace XCharts
|
|||||||
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
|
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
|
||||||
legend.gameObject = legendObject;
|
legend.gameObject = legendObject;
|
||||||
legendObject.hideFlags = chartHideFlags;
|
legendObject.hideFlags = chartHideFlags;
|
||||||
SeriesHelper.UpdateSerieNameList(m_Series, ref m_LegendRealShowName);
|
SeriesHelper.UpdateSerieNameList(this, ref m_LegendRealShowName);
|
||||||
List<string> datas;
|
List<string> datas;
|
||||||
if (legend.show && legend.data.Count > 0)
|
if (legend.show && legend.data.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -452,7 +452,7 @@ namespace XCharts
|
|||||||
string legendName = legend.GetFormatterContent(datas[i]);
|
string legendName = legend.GetFormatterContent(datas[i]);
|
||||||
var readIndex = m_LegendRealShowName.IndexOf(datas[i]);
|
var readIndex = m_LegendRealShowName.IndexOf(datas[i]);
|
||||||
var active = IsActiveByLegend(datas[i]);
|
var active = IsActiveByLegend(datas[i]);
|
||||||
var bgColor = LegendHelper.GetIconColor(legend, readIndex, theme, m_Series, datas[i], active);
|
var bgColor = LegendHelper.GetIconColor(this, readIndex , datas[i], active);
|
||||||
var item = LegendHelper.AddLegendItem(legend, i, datas[i], legendObject.transform, m_Theme,
|
var item = LegendHelper.AddLegendItem(legend, i, datas[i], legendObject.transform, m_Theme,
|
||||||
legendName, bgColor, active);
|
legendName, bgColor, active);
|
||||||
legend.SetButton(legendName, item, totalLegend);
|
legend.SetButton(legendName, item, totalLegend);
|
||||||
@@ -716,7 +716,7 @@ namespace XCharts
|
|||||||
if (m_ReinitLabel)
|
if (m_ReinitLabel)
|
||||||
{
|
{
|
||||||
m_ReinitLabel = false;
|
m_ReinitLabel = false;
|
||||||
SeriesHelper.UpdateSerieNameList(m_Series, ref m_LegendRealShowName);
|
SeriesHelper.UpdateSerieNameList(this, ref m_LegendRealShowName);
|
||||||
InitSerieLabel();
|
InitSerieLabel();
|
||||||
}
|
}
|
||||||
if (m_ReinitTitle)
|
if (m_ReinitTitle)
|
||||||
@@ -864,7 +864,6 @@ namespace XCharts
|
|||||||
vh.Clear();
|
vh.Clear();
|
||||||
DrawBackground(vh);
|
DrawBackground(vh);
|
||||||
DrawPainterBase(vh);
|
DrawPainterBase(vh);
|
||||||
DrawLegend(vh);
|
|
||||||
foreach (var draw in m_ComponentHandlers) draw.DrawBase(vh);
|
foreach (var draw in m_ComponentHandlers) draw.DrawBase(vh);
|
||||||
foreach (var draw in m_DrawSeries) draw.DrawBase(vh);
|
foreach (var draw in m_DrawSeries) draw.DrawBase(vh);
|
||||||
if (m_OnCustomDrawBaseCallback != null)
|
if (m_OnCustomDrawBaseCallback != null)
|
||||||
@@ -899,6 +898,7 @@ namespace XCharts
|
|||||||
protected virtual void OnDrawPainterTop(VertexHelper vh, Painter painter)
|
protected virtual void OnDrawPainterTop(VertexHelper vh, Painter painter)
|
||||||
{
|
{
|
||||||
vh.Clear();
|
vh.Clear();
|
||||||
|
DrawLegend(vh);
|
||||||
DrawPainterTop(vh);
|
DrawPainterTop(vh);
|
||||||
foreach (var draw in m_ComponentHandlers) draw.DrawTop(vh);
|
foreach (var draw in m_ComponentHandlers) draw.DrawTop(vh);
|
||||||
if (m_OnCustomDrawTopCallback != null)
|
if (m_OnCustomDrawTopCallback != null)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace XCharts
|
|||||||
public bool OnLegendButtonClick(int index, string legendName, bool show)
|
public bool OnLegendButtonClick(int index, string legendName, bool show)
|
||||||
{
|
{
|
||||||
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Pie)) return false;
|
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Pie)) return false;
|
||||||
if (!LegendHelper.IsSerieLegend(chart.series, legendName, SerieType.Pie)) return false;
|
if (!LegendHelper.IsSerieLegend(chart, legendName, SerieType.Pie)) return false;
|
||||||
LegendHelper.CheckDataShow(chart.series, legendName, show);
|
LegendHelper.CheckDataShow(chart.series, legendName, show);
|
||||||
chart.UpdateLegendColor(legendName, show);
|
chart.UpdateLegendColor(legendName, show);
|
||||||
chart.RefreshChart();
|
chart.RefreshChart();
|
||||||
@@ -119,7 +119,7 @@ namespace XCharts
|
|||||||
public bool OnLegendButtonEnter(int index, string legendName)
|
public bool OnLegendButtonEnter(int index, string legendName)
|
||||||
{
|
{
|
||||||
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Pie)) return false;
|
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Pie)) return false;
|
||||||
if (!LegendHelper.IsSerieLegend(chart.series, legendName, SerieType.Pie)) return false;
|
if (!LegendHelper.IsSerieLegend(chart, legendName, SerieType.Pie)) return false;
|
||||||
m_IsEnterPieLegendButtom = true;
|
m_IsEnterPieLegendButtom = true;
|
||||||
LegendHelper.CheckDataHighlighted(chart.series, legendName, true);
|
LegendHelper.CheckDataHighlighted(chart.series, legendName, true);
|
||||||
chart.RefreshChart();
|
chart.RefreshChart();
|
||||||
@@ -129,7 +129,7 @@ namespace XCharts
|
|||||||
public bool OnLegendButtonExit(int index, string legendName)
|
public bool OnLegendButtonExit(int index, string legendName)
|
||||||
{
|
{
|
||||||
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Pie)) return false;
|
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Pie)) return false;
|
||||||
if (!LegendHelper.IsSerieLegend(chart.series, legendName, SerieType.Pie)) return false;
|
if (!LegendHelper.IsSerieLegend(chart, legendName, SerieType.Pie)) return false;
|
||||||
m_IsEnterPieLegendButtom = false;
|
m_IsEnterPieLegendButtom = false;
|
||||||
LegendHelper.CheckDataHighlighted(chart.series, legendName, false);
|
LegendHelper.CheckDataHighlighted(chart.series, legendName, false);
|
||||||
chart.RefreshChart();
|
chart.RefreshChart();
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ namespace XCharts
|
|||||||
public bool OnLegendButtonClick(int index, string legendName, bool show)
|
public bool OnLegendButtonClick(int index, string legendName, bool show)
|
||||||
{
|
{
|
||||||
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Radar)) return false;
|
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Radar)) return false;
|
||||||
if (!LegendHelper.IsSerieLegend(chart.series, legendName, SerieType.Radar)) return false;
|
if (!LegendHelper.IsSerieLegend(chart, legendName, SerieType.Radar)) return false;
|
||||||
LegendHelper.CheckDataShow(chart.series, legendName, show);
|
LegendHelper.CheckDataShow(chart.series, legendName, show);
|
||||||
chart.UpdateLegendColor(legendName, show);
|
chart.UpdateLegendColor(legendName, show);
|
||||||
chart.RefreshChart();
|
chart.RefreshChart();
|
||||||
@@ -209,7 +209,7 @@ namespace XCharts
|
|||||||
public bool OnLegendButtonEnter(int index, string legendName)
|
public bool OnLegendButtonEnter(int index, string legendName)
|
||||||
{
|
{
|
||||||
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Radar)) return false;
|
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Radar)) return false;
|
||||||
if (!LegendHelper.IsSerieLegend(chart.series, legendName, SerieType.Radar)) return false;
|
if (!LegendHelper.IsSerieLegend(chart, legendName, SerieType.Radar)) return false;
|
||||||
m_IsEnterLegendButtom = true;
|
m_IsEnterLegendButtom = true;
|
||||||
LegendHelper.CheckDataHighlighted(chart.series, legendName, true);
|
LegendHelper.CheckDataHighlighted(chart.series, legendName, true);
|
||||||
chart.RefreshChart();
|
chart.RefreshChart();
|
||||||
@@ -219,7 +219,7 @@ namespace XCharts
|
|||||||
public bool OnLegendButtonExit(int index, string legendName)
|
public bool OnLegendButtonExit(int index, string legendName)
|
||||||
{
|
{
|
||||||
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Radar)) return false;
|
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Radar)) return false;
|
||||||
if (!LegendHelper.IsSerieLegend(chart.series, legendName, SerieType.Radar)) return false;
|
if (!LegendHelper.IsSerieLegend(chart, legendName, SerieType.Radar)) return false;
|
||||||
m_IsEnterLegendButtom = false;
|
m_IsEnterLegendButtom = false;
|
||||||
LegendHelper.CheckDataHighlighted(chart.series, legendName, false);
|
LegendHelper.CheckDataHighlighted(chart.series, legendName, false);
|
||||||
chart.RefreshChart();
|
chart.RefreshChart();
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace XCharts
|
|||||||
public bool OnLegendButtonClick(int index, string legendName, bool show)
|
public bool OnLegendButtonClick(int index, string legendName, bool show)
|
||||||
{
|
{
|
||||||
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Ring)) return false;
|
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Ring)) return false;
|
||||||
if (!LegendHelper.IsSerieLegend(chart.series, legendName, SerieType.Ring)) return false;
|
if (!LegendHelper.IsSerieLegend(chart, legendName, SerieType.Ring)) return false;
|
||||||
LegendHelper.CheckDataShow(chart.series, legendName, show);
|
LegendHelper.CheckDataShow(chart.series, legendName, show);
|
||||||
chart.UpdateLegendColor(legendName, show);
|
chart.UpdateLegendColor(legendName, show);
|
||||||
chart.RefreshChart();
|
chart.RefreshChart();
|
||||||
@@ -173,7 +173,7 @@ namespace XCharts
|
|||||||
public bool OnLegendButtonEnter(int index, string legendName)
|
public bool OnLegendButtonEnter(int index, string legendName)
|
||||||
{
|
{
|
||||||
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Ring)) return false;
|
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Ring)) return false;
|
||||||
if (!LegendHelper.IsSerieLegend(chart.series, legendName, SerieType.Ring)) return false;
|
if (!LegendHelper.IsSerieLegend(chart, legendName, SerieType.Ring)) return false;
|
||||||
m_IsEnterLegendButtom = true;
|
m_IsEnterLegendButtom = true;
|
||||||
LegendHelper.CheckDataHighlighted(chart.series, legendName, true);
|
LegendHelper.CheckDataHighlighted(chart.series, legendName, true);
|
||||||
chart.RefreshChart();
|
chart.RefreshChart();
|
||||||
@@ -183,7 +183,7 @@ namespace XCharts
|
|||||||
public bool OnLegendButtonExit(int index, string legendName)
|
public bool OnLegendButtonExit(int index, string legendName)
|
||||||
{
|
{
|
||||||
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Ring)) return false;
|
if (!SeriesHelper.ContainsSerie(chart.series, SerieType.Ring)) return false;
|
||||||
if (!LegendHelper.IsSerieLegend(chart.series, legendName, SerieType.Ring)) return false;
|
if (!LegendHelper.IsSerieLegend(chart, legendName, SerieType.Ring)) return false;
|
||||||
m_IsEnterLegendButtom = false;
|
m_IsEnterLegendButtom = false;
|
||||||
LegendHelper.CheckDataHighlighted(chart.series, legendName, false);
|
LegendHelper.CheckDataHighlighted(chart.series, legendName, false);
|
||||||
chart.RefreshChart();
|
chart.RefreshChart();
|
||||||
|
|||||||
Reference in New Issue
Block a user