This commit is contained in:
monitor1394
2022-05-22 22:17:38 +08:00
parent 003f4da9de
commit bafe032bb9
391 changed files with 3718 additions and 2774 deletions

View File

@@ -6,7 +6,6 @@ namespace XCharts.Runtime
public sealed class ListForComponent : ListFor
{
public ListForComponent(Type type) : base(type)
{
}
{ }
}
}

View File

@@ -6,7 +6,6 @@ namespace XCharts.Runtime
public sealed class ListForSerie : ListFor
{
public ListForSerie(Type type) : base(type)
{
}
{ }
}
}

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
namespace XCharts.Runtime
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class SerieDataExtraComponentAttribute : Attribute
{
public readonly List<Type> types = new List<Type>();
public SerieDataExtraComponentAttribute()
{ }
public SerieDataExtraComponentAttribute(Type type1)
{
AddType(type1);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2)
{
AddType(type1);
AddType(type2);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3)
{
AddType(type1);
AddType(type2);
AddType(type3);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4)
{
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)
{
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
AddType(type5);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)
{
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
AddType(type5);
AddType(type6);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)
{
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
AddType(type5);
AddType(type6);
AddType(type7);
}
private void AddType(Type type)
{
if (!SerieData.extraComponentMap.ContainsKey(type))
throw new ArgumentException("SerieData not support extra component:" + type);
types.Add(type);
}
public bool Contains<T>() where T : ISerieExtraComponent
{
return Contains(typeof(T));
}
public bool Contains(Type type)
{
return types.Contains(type);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a77e2e342c09c4c6b95a0094ad0fcffc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
namespace XCharts.Runtime
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class SerieDataExtraFieldAttribute : Attribute
{
public readonly List<string> fields = new List<string>();
public SerieDataExtraFieldAttribute()
{ }
public SerieDataExtraFieldAttribute(string field1)
{
AddFiled(field1);
}
public SerieDataExtraFieldAttribute(string field1, string field2)
{
AddFiled(field1);
AddFiled(field2);
}
public SerieDataExtraFieldAttribute(string field1, string field2, string field3)
{
AddFiled(field1);
AddFiled(field2);
AddFiled(field3);
}
public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4)
{
AddFiled(field1);
AddFiled(field2);
AddFiled(field3);
AddFiled(field4);
}
public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5)
{
AddFiled(field1);
AddFiled(field2);
AddFiled(field3);
AddFiled(field4);
AddFiled(field5);
}
public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6)
{
AddFiled(field1);
AddFiled(field2);
AddFiled(field3);
AddFiled(field4);
AddFiled(field5);
AddFiled(field6);
}
public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6, string field7)
{
AddFiled(field1);
AddFiled(field2);
AddFiled(field3);
AddFiled(field4);
AddFiled(field5);
AddFiled(field6);
AddFiled(field7);
}
private void AddFiled(string field)
{
if (!SerieData.extraFieldList.Contains(field))
throw new ArgumentException("SerieData not support field:" + field);
fields.Add(field);
}
public bool Contains(string field)
{
return fields.Contains(field);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c8b0cc5a1c11e497abb7e32c7d14b25f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -9,56 +9,62 @@ namespace XCharts.Runtime
public readonly List<Type> types = new List<Type>();
public SerieExtraComponentAttribute()
{
}
{ }
public SerieExtraComponentAttribute(Type type1)
{
types.Add(type1);
AddType(type1);
}
public SerieExtraComponentAttribute(Type type1, Type type2)
{
types.Add(type1);
types.Add(type2);
AddType(type1);
AddType(type2);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3)
{
types.Add(type1);
types.Add(type2);
types.Add(type3);
AddType(type1);
AddType(type2);
AddType(type3);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4)
{
types.Add(type1);
types.Add(type2);
types.Add(type3);
types.Add(type4);
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)
{
types.Add(type1);
types.Add(type2);
types.Add(type3);
types.Add(type4);
types.Add(type5);
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
AddType(type5);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)
{
types.Add(type1);
types.Add(type2);
types.Add(type3);
types.Add(type4);
types.Add(type5);
types.Add(type6);
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
AddType(type5);
AddType(type6);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)
{
types.Add(type1);
types.Add(type2);
types.Add(type3);
types.Add(type4);
types.Add(type5);
types.Add(type6);
types.Add(type7);
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
AddType(type5);
AddType(type6);
AddType(type7);
}
private void AddType(Type type)
{
if (!Serie.extraComponentMap.ContainsKey(type))
throw new ArgumentException("Serie not support extra component:" + type);
types.Add(type);
}
public bool Contains<T>() where T : ISerieExtraComponent

View File

@@ -8,7 +8,6 @@ namespace XCharts.Runtime
public readonly Type handler;
public readonly bool allowMultiple = true;
public SerieHandlerAttribute(Type handler)
{
this.handler = handler;

View File

@@ -1,8 +1,8 @@
using UnityEngine;
using System.Collections.Generic;
using System;
using UnityEngine.UI;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace XCharts.Runtime
{
@@ -100,7 +100,7 @@ namespace XCharts.Runtime
/// the callback function of click bar.
/// |点击柱形图柱条回调。参数eventData, dataIndex
/// </summary>
public Action<PointerEventData, int> onPointerClickBar { set { m_OnPointerClickBar = value; m_ForceOpenRaycastTarget = true; } }
public Action<PointerEventData, int> onPointerClickBar { set { m_OnPointerClickBar = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerClickBar; } }
/// <summary>
/// 坐标轴变更数据索引时回调。参数axis, dataIndex/dataValue
/// </summary>
@@ -142,6 +142,8 @@ namespace XCharts.Runtime
serie.ResetInteract();
m_RefreshChart = true;
if (m_Painter) m_Painter.Refresh();
foreach (var painter in m_PainterList) painter.Refresh();
if (m_PainterTop) m_PainterTop.Refresh();
}
/// <summary>
@@ -164,7 +166,6 @@ namespace XCharts.Runtime
RefreshPainter(serie);
}
/// <summary>
/// Remove all series and legend data.
/// |It just emptying all of serie's data without emptying the list of series.
@@ -374,7 +375,7 @@ namespace XCharts.Runtime
public bool IsInChart(float x, float y)
{
if (x < m_ChartX || x > m_ChartX + m_ChartWidth ||
y < m_ChartY || y > m_ChartY + m_ChartHeight)
y < m_ChartY || y > m_ChartY + m_ChartHeight)
{
return false;
}
@@ -527,9 +528,9 @@ namespace XCharts.Runtime
public Color32 GetItemColor(Serie serie, SerieData serieData, bool highlight = false)
{
var colorIndex = serieData == null || !serie.useDataNameForColor
? GetLegendRealShowNameIndex(serie.legendName)
: GetLegendRealShowNameIndex(serieData.legendName);
var colorIndex = serieData == null || !serie.useDataNameForColor ?
GetLegendRealShowNameIndex(serie.legendName) :
GetLegendRealShowNameIndex(serieData.legendName);
return SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, highlight);
}
@@ -538,4 +539,4 @@ namespace XCharts.Runtime
return SerieHelper.GetItemColor(serie, null, m_Theme, serie.context.colorIndex, highlight);
}
}
}
}

View File

@@ -1,7 +1,6 @@

using UnityEngine;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Runtime
{
@@ -42,7 +41,7 @@ namespace XCharts.Runtime
public T AddChartComponent<T>() where T : MainComponent
{
return (T)AddChartComponent(typeof(T));
return (T) AddChartComponent(typeof(T));
}
public T AddChartComponentWhenNoExist<T>() where T : MainComponent
@@ -119,7 +118,7 @@ namespace XCharts.Runtime
if (attrubte.handler == null)
return;
var handler = (MainComponentHandler)Activator.CreateInstance(attrubte.handler);
var handler = (MainComponentHandler) Activator.CreateInstance(attrubte.handler);
handler.attribute = attrubte;
handler.chart = this;
handler.SetComponent(component);
@@ -128,13 +127,13 @@ namespace XCharts.Runtime
}
public bool RemoveChartComponent<T>(int index = 0)
where T : MainComponent
where T : MainComponent
{
return RemoveChartComponent(typeof(T), index);
}
public int RemoveChartComponents<T>()
where T : MainComponent
where T : MainComponent
{
return RemoveChartComponents(typeof(T));
}
@@ -196,7 +195,7 @@ namespace XCharts.Runtime
}
public bool HasChartComponent<T>()
where T : MainComponent
where T : MainComponent
{
return HasChartComponent(typeof(T));
}
@@ -256,14 +255,14 @@ namespace XCharts.Runtime
}
public bool TryGetChartComponent<T>(out T component, int index = 0)
where T : MainComponent
where T : MainComponent
{
component = null;
foreach (var com in m_Components)
{
if (com is T && com.index == index)
{
component = (T)com;
component = (T) com;
return true;
}
}
@@ -402,11 +401,11 @@ namespace XCharts.Runtime
var yAxis = GetChartComponent<YAxis>();
if (yAxis.IsCategory())
{
return yAxis.GetData((int)yAxis.context.pointerValue, dataZoom);
return yAxis.GetData((int) yAxis.context.pointerValue, dataZoom);
}
else if (xAxis.IsCategory())
{
return xAxis.GetData((int)xAxis.context.pointerValue, dataZoom);
return xAxis.GetData((int) xAxis.context.pointerValue, dataZoom);
}
return null;
}
@@ -416,13 +415,13 @@ namespace XCharts.Runtime
var yAxis = GetChartComponent<YAxis>(serie.yAxisIndex);
if (yAxis.IsCategory())
{
return yAxis.GetData((int)yAxis.context.pointerValue, dataZoom);
return yAxis.GetData((int) yAxis.context.pointerValue, dataZoom);
}
else if (xAxis.IsCategory())
{
return xAxis.GetData((int)xAxis.context.pointerValue, dataZoom);
return xAxis.GetData((int) xAxis.context.pointerValue, dataZoom);
}
return null;
}
}
}
}

View File

@@ -1,15 +1,13 @@

using UnityEngine;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Runtime
{
public partial class BaseChart
{
public virtual void InitAxisRuntimeData(Axis axis)
{
}
{ }
public virtual void GetSeriesMinMaxValue(Axis axis, int axisIndex, out double tempMinValue, out double tempMaxValue)
{
@@ -31,4 +29,4 @@ namespace XCharts.Runtime
AxisHelper.AdjustMinMaxValue(axis, ref tempMinValue, ref tempMaxValue, true);
}
}
}
}

View File

@@ -1,4 +1,3 @@

using UnityEngine;
using UnityEngine.UI;
using XUGL;
@@ -35,13 +34,13 @@ namespace XCharts.Runtime
p3 = ClampInGrid(grid, p3);
p4 = ClampInGrid(grid, p4);
}
if (!clip || (clip && (grid.Contains(p1) && grid.Contains(p2) && grid.Contains(p3)
&& grid.Contains(p4))))
if (!clip || (clip && (grid.Contains(p1) && grid.Contains(p2) && grid.Contains(p3) &&
grid.Contains(p4))))
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, startColor, toColor);
}
public void DrawClipPolygon(VertexHelper vh, ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4,
Color32 startColor, Color32 toColor, bool clip, GridCoord grid)
Color32 startColor, Color32 toColor, bool clip, GridCoord grid)
{
ClampInChart(ref p1);
ClampInChart(ref p2);
@@ -54,9 +53,9 @@ namespace XCharts.Runtime
p3 = ClampInGrid(grid, p3);
p4 = ClampInGrid(grid, p4);
}
if (!clip
|| (clip && (grid.Contains(p1) && grid.Contains(p2) && grid.Contains(p3)
&& grid.Contains(p4))))
if (!clip ||
(clip && (grid.Contains(p1) && grid.Contains(p2) && grid.Contains(p3) &&
grid.Contains(p4))))
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, startColor, toColor);
}
@@ -132,4 +131,4 @@ namespace XCharts.Runtime
return Color32.Lerp(areaToColor, areaColor, (pos.x - grid.context.x) / grid.context.width);
}
}
}
}

View File

@@ -1,8 +1,7 @@

using UnityEngine;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
namespace XCharts.Runtime
{
@@ -320,6 +319,38 @@ namespace XCharts.Runtime
}
return null;
}
/// <summary>
/// Add a (time,y) data to serie.
/// |添加time,y数据到指定的系列中。
/// </summary>
/// <param name="serieName"></param>
/// <param name="time"></param>
/// <param name="yValue"></param>
/// <param name="dataName"></param>
/// <param name="dataId"></param>
/// <returns></returns>
public SerieData AddData(string serieName, DateTime time, double yValue, string dataName = null, string dataId = null)
{
var xValue = DateTimeUtil.GetTimestamp(time);
return AddData(serieName, xValue, yValue, dataName, dataId);
}
/// <summary>
/// Add a (time,y) data to serie.
/// |添加time,y数据到指定的系列中。
/// </summary>
/// <param name="serieIndex"></param>
/// <param name="time"></param>
/// <param name="yValue"></param>
/// <param name="dataName"></param>
/// <param name="dataId"></param>
/// <returns></returns>
public SerieData AddData(int serieIndex, DateTime time, double yValue, string dataName = null, string dataId = null)
{
var xValue = DateTimeUtil.GetTimestamp(time);
return AddData(serieIndex, xValue, yValue, dataName, dataId);
}
public SerieData AddData(int serieIndex, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)
{
var serie = GetSerie(serieIndex);
@@ -710,9 +741,30 @@ namespace XCharts.Runtime
return total;
}
public int GetSerieBarRealCount<T>() where T : Serie
{
var count = 0;
barStackSet.Clear();
for (int i = 0; i < m_Series.Count; i++)
{
var serie = m_Series[i];
if (!serie.show) continue;
if (serie is T)
{
if (!string.IsNullOrEmpty(serie.stack))
{
if (barStackSet.Contains(serie.stack)) continue;
barStackSet.Add(serie.stack);
}
count++;
}
}
return count;
}
private HashSet<string> barStackSet = new HashSet<string>();
public float GetSerieTotalWidth<T>(float categoryWidth, float gap) where T : Serie
public float GetSerieTotalWidth<T>(float categoryWidth, float gap, int realBarCount) where T : Serie
{
float total = 0;
float lastGap = 0;
@@ -728,14 +780,14 @@ namespace XCharts.Runtime
if (barStackSet.Contains(serie.stack)) continue;
barStackSet.Add(serie.stack);
}
var width = GetStackBarWidth<T>(categoryWidth, serie);
var width = GetStackBarWidth<T>(categoryWidth, serie, realBarCount);
if (gap == -1)
{
if (width > total) total = width;
}
else
{
lastGap = width * gap;
lastGap = ChartHelper.GetActualValue(gap, width);
total += width;
total += lastGap;
}
@@ -745,21 +797,65 @@ namespace XCharts.Runtime
return total;
}
private float GetStackBarWidth<T>(float categoryWidth, Serie now) where T : Serie
public float GetSerieTotalGap<T>(float categoryWidth, float gap, int index) where T : Serie
{
if (string.IsNullOrEmpty(now.stack)) return now.GetBarWidth(categoryWidth);
if (index <= 0) return 0;
float total = 0;
barStackSet.Clear();
var count = 0;
var totalRealBarCount = GetSerieBarRealCount<T>();
for (int i = 0; i < m_Series.Count; i++)
{
var serie = m_Series[i];
if (!serie.show) continue;
if (serie is T)
{
if (!string.IsNullOrEmpty(serie.stack))
{
if (barStackSet.Contains(serie.stack)) continue;
barStackSet.Add(serie.stack);
}
var width = GetStackBarWidth<T>(categoryWidth, serie, totalRealBarCount);
if (gap == -1)
{
if (width > total) total = width;
}
else
{
total += width + ChartHelper.GetActualValue(gap, width);
}
if (count + 1 >= index)
break;
else
count++;
}
}
return total;
}
private float GetStackBarWidth<T>(float categoryWidth, Serie now, int realBarCount) where T : Serie
{
if (string.IsNullOrEmpty(now.stack)) return now.GetBarWidth(categoryWidth, realBarCount);
float barWidth = 0;
for (int i = 0; i < m_Series.Count; i++)
{
var serie = m_Series[i];
if ((serie is T)
&& serie.show && now.stack.Equals(serie.stack))
if ((serie is T) &&
serie.show && now.stack.Equals(serie.stack))
{
if (serie.barWidth > barWidth) barWidth = serie.barWidth;
}
}
if (barWidth > 1) return barWidth;
else return barWidth * categoryWidth;
if (barWidth == 0)
{
var width = ChartHelper.GetActualValue(0.6f, categoryWidth);
if (realBarCount == 0)
return width < 1 ? categoryWidth : width;
else
return width / realBarCount;
}
else
return ChartHelper.GetActualValue(barWidth, categoryWidth);
}
private List<string> tempList = new List<string>();
@@ -816,7 +912,7 @@ namespace XCharts.Runtime
return;
}
var attribute = serie.GetType().GetAttribute<SerieHandlerAttribute>();
var handler = (SerieHandler)Activator.CreateInstance(attribute.handler);
var handler = (SerieHandler) Activator.CreateInstance(attribute.handler);
handler.attribute = attribute;
handler.chart = this;
handler.defaultDimension = 1;
@@ -886,4 +982,4 @@ namespace XCharts.Runtime
return false;
}
}
}
}

View File

@@ -1,11 +1,10 @@

using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
using System;
using UnityEngine.EventSystems;
using XUGL;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using XUGL;
namespace XCharts.Runtime
{
@@ -20,38 +19,39 @@ namespace XCharts.Runtime
[SerializeField] protected Settings m_Settings;
#pragma warning disable 0414
[SerializeField] [ListForComponent(typeof(AngleAxis))] private List<AngleAxis> m_AngleAxes = new List<AngleAxis>();
[SerializeField] [ListForComponent(typeof(Background))] private List<Background> m_Backgrounds = new List<Background>();
[SerializeField] [ListForComponent(typeof(DataZoom))] private List<DataZoom> m_DataZooms = new List<DataZoom>();
[SerializeField] [ListForComponent(typeof(GridCoord))] private List<GridCoord> m_Grids = new List<GridCoord>();
[SerializeField] [ListForComponent(typeof(Legend))] private List<Legend> m_Legends = new List<Legend>();
[SerializeField] [ListForComponent(typeof(MarkLine))] private List<MarkLine> m_MarkLines = new List<MarkLine>();
[SerializeField] [ListForComponent(typeof(MarkArea))] private List<MarkArea> m_MarkAreas = new List<MarkArea>();
[SerializeField] [ListForComponent(typeof(PolarCoord))] private List<PolarCoord> m_Polars = new List<PolarCoord>();
[SerializeField] [ListForComponent(typeof(RadarCoord))] private List<RadarCoord> m_Radars = new List<RadarCoord>();
[SerializeField] [ListForComponent(typeof(RadiusAxis))] private List<RadiusAxis> m_RadiusAxes = new List<RadiusAxis>();
[SerializeField] [ListForComponent(typeof(Title))] private List<Title> m_Titles = new List<Title>();
[SerializeField] [ListForComponent(typeof(Tooltip))] private List<Tooltip> m_Tooltips = new List<Tooltip>();
[SerializeField] [ListForComponent(typeof(VisualMap))] private List<VisualMap> m_VisualMaps = new List<VisualMap>();
[SerializeField] [ListForComponent(typeof(XAxis))] private List<XAxis> m_XAxes = new List<XAxis>();
[SerializeField] [ListForComponent(typeof(YAxis))] private List<YAxis> m_YAxes = new List<YAxis>();
[SerializeField] [ListForComponent(typeof(SingleAxis))] private List<SingleAxis> m_SingleAxes = new List<SingleAxis>();
[SerializeField] [ListForComponent(typeof(ParallelCoord))] private List<ParallelCoord> m_Parallels = new List<ParallelCoord>();
[SerializeField] [ListForComponent(typeof(ParallelAxis))] private List<ParallelAxis> m_ParallelAxes = new List<ParallelAxis>();
[SerializeField][ListForComponent(typeof(AngleAxis))] private List<AngleAxis> m_AngleAxes = new List<AngleAxis>();
[SerializeField][ListForComponent(typeof(Background))] private List<Background> m_Backgrounds = new List<Background>();
[SerializeField][ListForComponent(typeof(DataZoom))] private List<DataZoom> m_DataZooms = new List<DataZoom>();
[SerializeField][ListForComponent(typeof(GridCoord))] private List<GridCoord> m_Grids = new List<GridCoord>();
[SerializeField][ListForComponent(typeof(Legend))] private List<Legend> m_Legends = new List<Legend>();
[SerializeField][ListForComponent(typeof(MarkLine))] private List<MarkLine> m_MarkLines = new List<MarkLine>();
[SerializeField][ListForComponent(typeof(MarkArea))] private List<MarkArea> m_MarkAreas = new List<MarkArea>();
[SerializeField][ListForComponent(typeof(PolarCoord))] private List<PolarCoord> m_Polars = new List<PolarCoord>();
[SerializeField][ListForComponent(typeof(RadarCoord))] private List<RadarCoord> m_Radars = new List<RadarCoord>();
[SerializeField][ListForComponent(typeof(RadiusAxis))] private List<RadiusAxis> m_RadiusAxes = new List<RadiusAxis>();
[SerializeField][ListForComponent(typeof(Title))] private List<Title> m_Titles = new List<Title>();
[SerializeField][ListForComponent(typeof(Tooltip))] private List<Tooltip> m_Tooltips = new List<Tooltip>();
[SerializeField][ListForComponent(typeof(VisualMap))] private List<VisualMap> m_VisualMaps = new List<VisualMap>();
[SerializeField][ListForComponent(typeof(XAxis))] private List<XAxis> m_XAxes = new List<XAxis>();
[SerializeField][ListForComponent(typeof(YAxis))] private List<YAxis> m_YAxes = new List<YAxis>();
[SerializeField][ListForComponent(typeof(SingleAxis))] private List<SingleAxis> m_SingleAxes = new List<SingleAxis>();
[SerializeField][ListForComponent(typeof(ParallelCoord))] private List<ParallelCoord> m_Parallels = new List<ParallelCoord>();
[SerializeField][ListForComponent(typeof(ParallelAxis))] private List<ParallelAxis> m_ParallelAxes = new List<ParallelAxis>();
[SerializeField][ListForComponent(typeof(Comment))] private List<Comment> m_Comments = new List<Comment>();
[SerializeField] [ListForSerie(typeof(Bar))] private List<Bar> m_SerieBars = new List<Bar>();
[SerializeField] [ListForSerie(typeof(Candlestick))] private List<Candlestick> m_SerieCandlesticks = new List<Candlestick>();
[SerializeField] [ListForSerie(typeof(EffectScatter))] private List<EffectScatter> m_SerieEffectScatters = new List<EffectScatter>();
[SerializeField] [ListForSerie(typeof(Heatmap))] private List<Heatmap> m_SerieHeatmaps = new List<Heatmap>();
[SerializeField] [ListForSerie(typeof(Line))] private List<Line> m_SerieLines = new List<Line>();
[SerializeField] [ListForSerie(typeof(Pie))] private List<Pie> m_SeriePies = new List<Pie>();
[SerializeField] [ListForSerie(typeof(Radar))] private List<Radar> m_SerieRadars = new List<Radar>();
[SerializeField] [ListForSerie(typeof(Ring))] private List<Ring> m_SerieRings = new List<Ring>();
[SerializeField] [ListForSerie(typeof(Scatter))] private List<Scatter> m_SerieScatters = new List<Scatter>();
[SerializeField] [ListForSerie(typeof(Parallel))] private List<Parallel> m_SerieParallels = new List<Parallel>();
[SerializeField] [ListForSerie(typeof(SimplifiedLine))] private List<SimplifiedLine> m_SerieSimplifiedLines = new List<SimplifiedLine>();
[SerializeField] [ListForSerie(typeof(SimplifiedBar))] private List<SimplifiedBar> m_SerieSimplifiedBars = new List<SimplifiedBar>();
[SerializeField] [ListForSerie(typeof(SimplifiedCandlestick))] private List<SimplifiedCandlestick> m_SerieSimplifiedCandlesticks = new List<SimplifiedCandlestick>();
[SerializeField][ListForSerie(typeof(Bar))] private List<Bar> m_SerieBars = new List<Bar>();
[SerializeField][ListForSerie(typeof(Candlestick))] private List<Candlestick> m_SerieCandlesticks = new List<Candlestick>();
[SerializeField][ListForSerie(typeof(EffectScatter))] private List<EffectScatter> m_SerieEffectScatters = new List<EffectScatter>();
[SerializeField][ListForSerie(typeof(Heatmap))] private List<Heatmap> m_SerieHeatmaps = new List<Heatmap>();
[SerializeField][ListForSerie(typeof(Line))] private List<Line> m_SerieLines = new List<Line>();
[SerializeField][ListForSerie(typeof(Pie))] private List<Pie> m_SeriePies = new List<Pie>();
[SerializeField][ListForSerie(typeof(Radar))] private List<Radar> m_SerieRadars = new List<Radar>();
[SerializeField][ListForSerie(typeof(Ring))] private List<Ring> m_SerieRings = new List<Ring>();
[SerializeField][ListForSerie(typeof(Scatter))] private List<Scatter> m_SerieScatters = new List<Scatter>();
[SerializeField][ListForSerie(typeof(Parallel))] private List<Parallel> m_SerieParallels = new List<Parallel>();
[SerializeField][ListForSerie(typeof(SimplifiedLine))] private List<SimplifiedLine> m_SerieSimplifiedLines = new List<SimplifiedLine>();
[SerializeField][ListForSerie(typeof(SimplifiedBar))] private List<SimplifiedBar> m_SerieSimplifiedBars = new List<SimplifiedBar>();
[SerializeField][ListForSerie(typeof(SimplifiedCandlestick))] private List<SimplifiedCandlestick> m_SerieSimplifiedCandlesticks = new List<SimplifiedCandlestick>();
#pragma warning restore 0414
protected List<Serie> m_Series = new List<Serie>();
protected List<MainComponent> m_Components = new List<MainComponent>();
@@ -67,7 +67,6 @@ namespace XCharts.Runtime
public List<Serie> series { get { return m_Series; } }
protected float m_ChartWidth;
protected float m_ChartHeight;
protected float m_ChartX;
@@ -101,14 +100,11 @@ namespace XCharts.Runtime
internal int m_BasePainterVertCount;
internal int m_TopPainterVertCount;
private ThemeType m_CheckTheme = 0;
protected List<MainComponentHandler> m_ComponentHandlers = new List<MainComponentHandler>();
protected List<SerieHandler> m_SerieHandlers = new List<SerieHandler>();
protected virtual void DefaultChart()
{
}
protected virtual void DefaultChart() { }
protected override void InitComponent()
{
@@ -333,7 +329,7 @@ namespace XCharts.Runtime
m_PainterList.Add(painter);
}
m_PainterTop = ChartHelper.AddPainterObject("painter_t", transform, m_GraphMinAnchor,
m_GraphMaxAnchor, m_GraphPivot, sizeDelta, chartHideFlags, 2 + settings.maxPainter);
m_GraphMaxAnchor, m_GraphPivot, sizeDelta, chartHideFlags, 2 + settings.maxPainter);
m_PainterTop.type = Painter.Type.Top;
m_PainterTop.onPopulateMesh = OnDrawPainterTop;
m_PainterTop.SetActive(true, m_DebugInfo.showAllChartObject);
@@ -406,6 +402,11 @@ namespace XCharts.Runtime
RefreshChart();
}
internal virtual void OnSerieDataUpdate(int serieIndex)
{
foreach (var handler in m_ComponentHandlers) handler.OnSerieDataUpdate(serieIndex);
}
internal virtual void OnCoordinateChanged()
{
foreach (var component in m_Components)
@@ -424,9 +425,7 @@ namespace XCharts.Runtime
background.SetAllDirty();
}
protected virtual void OnThemeChanged()
{
}
protected virtual void OnThemeChanged() { }
public virtual void OnDataZoomRangeChanged(DataZoom dataZoom)
{
@@ -587,9 +586,7 @@ namespace XCharts.Runtime
m_TopPainterVertCount = vh.currentVertCount;
}
protected virtual void DrawPainterSerie(VertexHelper vh, Serie serie)
{
}
protected virtual void DrawPainterSerie(VertexHelper vh, Serie serie) { }
protected virtual void DrawPainterTop(VertexHelper vh)
{
@@ -698,4 +695,4 @@ namespace XCharts.Runtime
InitSerieHandlers();
}
}
}
}

View File

@@ -1,6 +1,5 @@

using UnityEngine;
using System;
using UnityEngine;
using UnityEngine.EventSystems;
namespace XCharts.Runtime
@@ -155,16 +154,16 @@ namespace XCharts.Runtime
{
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
var relative = Display.RelativeMouseAt(screenPoint);
if(relative != Vector3.zero)
if (relative != Vector3.zero)
screenPoint = relative;
#endif
var cam = canvas.renderMode == RenderMode.ScreenSpaceOverlay ? null : canvas.worldCamera;
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
screenPoint, cam, out chartPoint))
screenPoint, cam, out chartPoint))
{
return false;
}
return true;
}
}
}
}

View File

@@ -1,8 +1,7 @@

using UnityEngine;
using UnityEngine.UI;
using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace XCharts.Runtime
{
@@ -10,315 +9,310 @@ namespace XCharts.Runtime
public partial class BaseGraph : MaskableGraphic, IPointerDownHandler, IPointerUpHandler,
IPointerEnterHandler, IPointerExitHandler, IBeginDragHandler, IPointerClickHandler,
IDragHandler, IEndDragHandler, IScrollHandler
{
[SerializeField] protected bool m_EnableTextMeshPro = false;
[SerializeField] protected DebugInfo m_DebugInfo = new DebugInfo();
protected Painter m_Painter;
protected int m_SiblingIndex;
protected float m_GraphWidth;
protected float m_GraphHeight;
protected float m_GraphX;
protected float m_GraphY;
protected Vector3 m_GraphPosition = Vector3.zero;
protected Vector2 m_GraphMinAnchor;
protected Vector2 m_GraphMaxAnchor;
protected Vector2 m_GraphPivot;
protected Vector2 m_GraphSizeDelta;
protected Vector2 m_GraphAnchoredPosition;
protected Rect m_GraphRect = new Rect(0, 0, 0, 0);
protected bool m_RefreshChart = false;
protected bool m_ForceOpenRaycastTarget;
protected bool m_IsControlledByLayout = false;
protected bool m_PainerDirty = false;
protected bool m_IsOnValidate = false;
protected Vector3 m_LastLocalPosition;
protected Action<PointerEventData, BaseGraph> m_OnPointerClick;
protected Action<PointerEventData, BaseGraph> m_OnPointerDown;
protected Action<PointerEventData, BaseGraph> m_OnPointerUp;
protected Action<PointerEventData, BaseGraph> m_OnPointerEnter;
protected Action<PointerEventData, BaseGraph> m_OnPointerExit;
protected Action<PointerEventData, BaseGraph> m_OnBeginDrag;
protected Action<PointerEventData, BaseGraph> m_OnDrag;
protected Action<PointerEventData, BaseGraph> m_OnEndDrag;
protected Action<PointerEventData, BaseGraph> m_OnScroll;
protected Vector2 graphAnchorMax { get { return m_GraphMinAnchor; } }
protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } }
protected Vector2 graphPivot { get { return m_GraphPivot; } }
public HideFlags chartHideFlags { get { return m_DebugInfo.showAllChartObject ? HideFlags.None : HideFlags.HideInHierarchy; } }
public DebugInfo debug { get { return m_DebugInfo; } }
private ScrollRect m_ScrollRect;
public Painter painter { get { return m_Painter; } }
protected virtual void InitComponent()
{
InitPainter();
}
protected override void Awake()
{
CheckTextMeshPro();
m_SiblingIndex = 0;
m_LastLocalPosition = transform.localPosition;
UpdateSize();
InitComponent();
CheckIsInScrollRect();
}
[SerializeField] protected bool m_EnableTextMeshPro = false;
[SerializeField] protected DebugInfo m_DebugInfo = new DebugInfo();
protected override void Start()
{
m_RefreshChart = true;
}
protected Painter m_Painter;
protected int m_SiblingIndex;
protected virtual void Update()
{
CheckSize();
if (m_IsOnValidate)
protected float m_GraphWidth;
protected float m_GraphHeight;
protected float m_GraphX;
protected float m_GraphY;
protected Vector3 m_GraphPosition = Vector3.zero;
protected Vector2 m_GraphMinAnchor;
protected Vector2 m_GraphMaxAnchor;
protected Vector2 m_GraphPivot;
protected Vector2 m_GraphSizeDelta;
protected Vector2 m_GraphAnchoredPosition;
protected Rect m_GraphRect = new Rect(0, 0, 0, 0);
protected bool m_RefreshChart = false;
protected bool m_ForceOpenRaycastTarget;
protected bool m_IsControlledByLayout = false;
protected bool m_PainerDirty = false;
protected bool m_IsOnValidate = false;
protected Vector3 m_LastLocalPosition;
protected Action<PointerEventData, BaseGraph> m_OnPointerClick;
protected Action<PointerEventData, BaseGraph> m_OnPointerDown;
protected Action<PointerEventData, BaseGraph> m_OnPointerUp;
protected Action<PointerEventData, BaseGraph> m_OnPointerEnter;
protected Action<PointerEventData, BaseGraph> m_OnPointerExit;
protected Action<PointerEventData, BaseGraph> m_OnBeginDrag;
protected Action<PointerEventData, BaseGraph> m_OnDrag;
protected Action<PointerEventData, BaseGraph> m_OnEndDrag;
protected Action<PointerEventData, BaseGraph> m_OnScroll;
protected Vector2 graphAnchorMax { get { return m_GraphMinAnchor; } }
protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } }
protected Vector2 graphPivot { get { return m_GraphPivot; } }
public HideFlags chartHideFlags { get { return m_DebugInfo.showAllChartObject ? HideFlags.None : HideFlags.HideInHierarchy; } }
public DebugInfo debug { get { return m_DebugInfo; } }
private ScrollRect m_ScrollRect;
public Painter painter { get { return m_Painter; } }
protected virtual void InitComponent()
{
InitPainter();
}
protected override void Awake()
{
m_IsOnValidate = false;
m_RefreshChart = true;
CheckTextMeshPro();
m_SiblingIndex = 0;
m_LastLocalPosition = transform.localPosition;
UpdateSize();
InitComponent();
CheckIsInScrollRect();
}
else
{
CheckComponent();
}
CheckPointerPos();
CheckRefreshChart();
CheckRefreshPainter();
}
protected virtual void SetAllComponentDirty()
{
protected override void Start()
{
m_RefreshChart = true;
}
protected virtual void Update()
{
CheckSize();
if (m_IsOnValidate)
{
m_IsOnValidate = false;
m_RefreshChart = true;
CheckTextMeshPro();
InitComponent();
}
else
{
CheckComponent();
}
CheckPointerPos();
CheckRefreshChart();
CheckRefreshPainter();
}
protected virtual void SetAllComponentDirty()
{
#if UNITY_EDITOR
if (!Application.isPlaying)
if (!Application.isPlaying)
{
m_IsOnValidate = true;
}
#endif
m_PainerDirty = true;
}
protected virtual void CheckComponent()
{
if (m_PainerDirty)
{
InitPainter();
m_PainerDirty = false;
}
}
private void CheckTextMeshPro()
{
#if dUI_TextMeshPro
var enableTextMeshPro = true;
#else
var enableTextMeshPro = false;
#endif
if (m_EnableTextMeshPro != enableTextMeshPro)
{
m_EnableTextMeshPro = enableTextMeshPro;
RebuildChartObject();
}
}
#if UNITY_EDITOR
protected override void Reset()
{ }
protected override void OnValidate()
{
m_IsOnValidate = true;
}
#endif
m_PainerDirty = true;
}
protected virtual void CheckComponent()
{
if (m_PainerDirty)
protected override void OnDestroy()
{
InitPainter();
m_PainerDirty = false;
for (int i = transform.childCount - 1; i >= 0; i--)
{
DestroyImmediate(transform.GetChild(i).gameObject);
}
}
}
private void CheckTextMeshPro()
{
#if dUI_TextMeshPro
var enableTextMeshPro = true;
#else
var enableTextMeshPro = false;
#endif
if (m_EnableTextMeshPro != enableTextMeshPro)
protected override void OnPopulateMesh(VertexHelper vh)
{
m_EnableTextMeshPro = enableTextMeshPro;
RebuildChartObject();
vh.Clear();
}
}
#if UNITY_EDITOR
protected override void Reset()
{
}
protected override void OnValidate()
{
m_IsOnValidate = true;
}
#endif
protected override void OnDestroy()
{
for (int i = transform.childCount - 1; i >= 0; i--)
protected virtual void InitPainter()
{
DestroyImmediate(transform.GetChild(i).gameObject);
}
}
protected override void OnPopulateMesh(VertexHelper vh)
{
vh.Clear();
}
protected virtual void InitPainter()
{
m_Painter = ChartHelper.AddPainterObject("painter_b", transform, m_GraphMinAnchor,
m_Painter = ChartHelper.AddPainterObject("painter_b", transform, m_GraphMinAnchor,
m_GraphMaxAnchor, m_GraphPivot, new Vector2(m_GraphWidth, m_GraphHeight), chartHideFlags, 1);
m_Painter.type = Painter.Type.Base;
m_Painter.onPopulateMesh = OnDrawPainterBase;
m_Painter.transform.SetSiblingIndex(0);
}
private void CheckSize()
{
var currWidth = rectTransform.rect.width;
var currHeight = rectTransform.rect.height;
if (m_GraphWidth == 0 && m_GraphHeight == 0 && (currWidth != 0 || currHeight != 0))
{
Awake();
m_Painter.type = Painter.Type.Base;
m_Painter.onPopulateMesh = OnDrawPainterBase;
m_Painter.transform.SetSiblingIndex(0);
}
if (m_GraphWidth != currWidth
|| m_GraphHeight != currHeight
|| m_GraphMinAnchor != rectTransform.anchorMin
|| m_GraphMaxAnchor != rectTransform.anchorMax
|| m_GraphAnchoredPosition != rectTransform.anchoredPosition)
private void CheckSize()
{
UpdateSize();
var currWidth = rectTransform.rect.width;
var currHeight = rectTransform.rect.height;
if (m_GraphWidth == 0 && m_GraphHeight == 0 && (currWidth != 0 || currHeight != 0))
{
Awake();
}
if (m_GraphWidth != currWidth ||
m_GraphHeight != currHeight ||
m_GraphMinAnchor != rectTransform.anchorMin ||
m_GraphMaxAnchor != rectTransform.anchorMax ||
m_GraphAnchoredPosition != rectTransform.anchoredPosition)
{
UpdateSize();
}
if (!ChartHelper.IsValueEqualsVector3(m_LastLocalPosition, transform.localPosition))
{
m_LastLocalPosition = transform.localPosition;
OnLocalPositionChanged();
}
}
if (!ChartHelper.IsValueEqualsVector3(m_LastLocalPosition, transform.localPosition))
protected void UpdateSize()
{
m_LastLocalPosition = transform.localPosition;
OnLocalPositionChanged();
m_GraphWidth = rectTransform.rect.width;
m_GraphHeight = rectTransform.rect.height;
m_GraphMaxAnchor = rectTransform.anchorMax;
m_GraphMinAnchor = rectTransform.anchorMin;
m_GraphSizeDelta = rectTransform.sizeDelta;
m_GraphAnchoredPosition = rectTransform.anchoredPosition;
rectTransform.pivot = LayerHelper.ResetChartPositionAndPivot(m_GraphMinAnchor, m_GraphMaxAnchor,
m_GraphWidth, m_GraphHeight, ref m_GraphX, ref m_GraphY);
m_GraphPivot = rectTransform.pivot;
m_GraphRect.x = m_GraphX;
m_GraphRect.y = m_GraphY;
m_GraphRect.width = m_GraphWidth;
m_GraphRect.height = m_GraphHeight;
m_GraphPosition.x = m_GraphX;
m_GraphPosition.y = m_GraphY;
OnSizeChanged();
}
private void CheckPointerPos()
{
if (!isPointerInChart) return;
if (canvas == null) return;
Vector2 local;
if (!ScreenPointToChartPoint(Input.mousePosition, out local))
{
pointerPos = Vector2.zero;
}
else
{
pointerPos = local;
}
}
protected virtual void CheckIsInScrollRect()
{
m_ScrollRect = GetComponentInParent<ScrollRect>();
}
protected virtual void CheckRefreshChart()
{
if (m_RefreshChart)
{
m_Painter.Refresh();
m_RefreshChart = false;
}
}
protected virtual void CheckRefreshPainter()
{
m_Painter.CheckRefresh();
}
internal virtual void RefreshPainter(Painter painter)
{
if (painter == null) return;
painter.Refresh();
}
protected virtual void OnSizeChanged()
{
m_RefreshChart = true;
}
protected virtual void OnLocalPositionChanged()
{ }
protected virtual void OnDrawPainterBase(VertexHelper vh, Painter painter)
{
DrawPainterBase(vh);
}
protected virtual void DrawPainterBase(VertexHelper vh)
{ }
public virtual void OnPointerClick(PointerEventData eventData)
{
if (m_OnPointerClick != null) m_OnPointerClick(eventData, this);
}
public virtual void OnPointerDown(PointerEventData eventData)
{
if (m_OnPointerDown != null) m_OnPointerDown(eventData, this);
}
public virtual void OnPointerUp(PointerEventData eventData)
{
if (m_OnPointerUp != null) m_OnPointerUp(eventData, this);
}
public virtual void OnPointerEnter(PointerEventData eventData)
{
isPointerInChart = true;
if (m_OnPointerEnter != null) m_OnPointerEnter(eventData, this);
}
public virtual void OnPointerExit(PointerEventData eventData)
{
isPointerInChart = false;
if (m_OnPointerExit != null) m_OnPointerExit(eventData, this);
}
public virtual void OnBeginDrag(PointerEventData eventData)
{
if (m_ScrollRect != null) m_ScrollRect.OnBeginDrag(eventData);
if (m_OnBeginDrag != null) m_OnBeginDrag(eventData, this);
}
public virtual void OnEndDrag(PointerEventData eventData)
{
if (m_ScrollRect != null) m_ScrollRect.OnEndDrag(eventData);
if (m_OnEndDrag != null) m_OnEndDrag(eventData, this);
}
public virtual void OnDrag(PointerEventData eventData)
{
if (m_ScrollRect != null) m_ScrollRect.OnDrag(eventData);
if (m_OnDrag != null) m_OnDrag(eventData, this);
}
public virtual void OnScroll(PointerEventData eventData)
{
if (m_ScrollRect != null) m_ScrollRect.OnScroll(eventData);
if (m_OnScroll != null) m_OnScroll(eventData, this);
}
}
protected void UpdateSize()
{
m_GraphWidth = rectTransform.rect.width;
m_GraphHeight = rectTransform.rect.height;
m_GraphMaxAnchor = rectTransform.anchorMax;
m_GraphMinAnchor = rectTransform.anchorMin;
m_GraphSizeDelta = rectTransform.sizeDelta;
m_GraphAnchoredPosition = rectTransform.anchoredPosition;
rectTransform.pivot = LayerHelper.ResetChartPositionAndPivot(m_GraphMinAnchor, m_GraphMaxAnchor,
m_GraphWidth, m_GraphHeight, ref m_GraphX, ref m_GraphY);
m_GraphPivot = rectTransform.pivot;
m_GraphRect.x = m_GraphX;
m_GraphRect.y = m_GraphY;
m_GraphRect.width = m_GraphWidth;
m_GraphRect.height = m_GraphHeight;
m_GraphPosition.x = m_GraphX;
m_GraphPosition.y = m_GraphY;
OnSizeChanged();
}
private void CheckPointerPos()
{
if (!isPointerInChart) return;
if (canvas == null) return;
Vector2 local;
if (!ScreenPointToChartPoint(Input.mousePosition, out local))
{
pointerPos = Vector2.zero;
}
else
{
pointerPos = local;
}
}
protected virtual void CheckIsInScrollRect()
{
m_ScrollRect = GetComponentInParent<ScrollRect>();
}
protected virtual void CheckRefreshChart()
{
if (m_RefreshChart)
{
m_Painter.Refresh();
m_RefreshChart = false;
}
}
protected virtual void CheckRefreshPainter()
{
m_Painter.CheckRefresh();
}
internal virtual void RefreshPainter(Painter painter)
{
if (painter == null) return;
painter.Refresh();
}
protected virtual void OnSizeChanged()
{
m_RefreshChart = true;
}
protected virtual void OnLocalPositionChanged()
{
}
protected virtual void OnDrawPainterBase(VertexHelper vh, Painter painter)
{
DrawPainterBase(vh);
}
protected virtual void DrawPainterBase(VertexHelper vh)
{
}
public virtual void OnPointerClick(PointerEventData eventData)
{
if (m_OnPointerClick != null) m_OnPointerClick(eventData, this);
}
public virtual void OnPointerDown(PointerEventData eventData)
{
if (m_OnPointerDown != null) m_OnPointerDown(eventData, this);
}
public virtual void OnPointerUp(PointerEventData eventData)
{
if (m_OnPointerUp != null) m_OnPointerUp(eventData, this);
}
public virtual void OnPointerEnter(PointerEventData eventData)
{
isPointerInChart = true;
if (m_OnPointerEnter != null) m_OnPointerEnter(eventData, this);
}
public virtual void OnPointerExit(PointerEventData eventData)
{
isPointerInChart = false;
if (m_OnPointerExit != null) m_OnPointerExit(eventData, this);
}
public virtual void OnBeginDrag(PointerEventData eventData)
{
if (m_ScrollRect != null) m_ScrollRect.OnBeginDrag(eventData);
if (m_OnBeginDrag != null) m_OnBeginDrag(eventData, this);
}
public virtual void OnEndDrag(PointerEventData eventData)
{
if (m_ScrollRect != null) m_ScrollRect.OnEndDrag(eventData);
if (m_OnEndDrag != null) m_OnEndDrag(eventData, this);
}
public virtual void OnDrag(PointerEventData eventData)
{
if (m_ScrollRect != null) m_ScrollRect.OnDrag(eventData);
if (m_OnDrag != null) m_OnDrag(eventData, this);
}
public virtual void OnScroll(PointerEventData eventData)
{
if (m_ScrollRect != null) m_ScrollRect.OnScroll(eventData);
if (m_OnScroll != null) m_OnScroll(eventData, this);
}
}
}
}

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
@@ -12,6 +11,7 @@ namespace XCharts.Runtime
public virtual bool vertsDirty { get { return m_VertsDirty; } }
public virtual bool componentDirty { get { return m_ComponentDirty; } }
public virtual bool useDataNameForColor { get { return false; } }
public virtual bool titleJustForSerie { get { return false; } }
public virtual bool useSortData { get { return false; } }
public bool anyDirty { get { return vertsDirty || componentDirty; } }
public Painter painter { get { return m_Painter; } set { m_Painter = value; } }
@@ -26,7 +26,6 @@ namespace XCharts.Runtime
public SerieHandler handler { get; set; }
public virtual void SetVerticesDirty()
{
m_VertsDirty = true;
@@ -48,8 +47,7 @@ namespace XCharts.Runtime
}
public virtual void ClearData()
{
}
{ }
public virtual void ClearDirty()
{
@@ -70,12 +68,10 @@ namespace XCharts.Runtime
}
public virtual void OnDataUpdate()
{
}
{ }
public virtual void OnBeforeSerialize()
{
}
{ }
public virtual void OnAfterDeserialize()
{

View File

@@ -1,4 +1,3 @@
using System;
using UnityEngine;
@@ -8,10 +7,11 @@ namespace XCharts.Runtime
public class ChildComponent
{
public virtual int index { get; set; }
[NonSerialized] protected bool m_VertsDirty;
[NonSerialized] protected bool m_ComponentDirty;
[NonSerialized] protected Painter m_Painter;
/// <summary>
/// 图表重绘标记。
/// </summary>

View File

@@ -1,5 +1,3 @@
using System;
namespace XCharts.Runtime
@@ -11,6 +9,5 @@ namespace XCharts.Runtime
/// </summary>
[Serializable]
public abstract class CoordSystem : MainComponent
{
}
{ }
}

View File

@@ -1,4 +1,3 @@
using System;
using System.Text;
using UnityEngine;
@@ -53,13 +52,9 @@ namespace XCharts.Runtime
m_ComponentDirty = false;
}
public virtual void Reset()
{
}
public virtual void Reset() { }
public virtual void ClearData()
{
}
public virtual void ClearData() { }
public virtual void ClearDirty()
{
@@ -73,9 +68,7 @@ namespace XCharts.Runtime
SetComponentDirty();
}
public virtual void SetDefaultValue()
{
}
public virtual void SetDefaultValue() { }
public virtual void OnRemove()
{
@@ -104,6 +97,7 @@ namespace XCharts.Runtime
public virtual void Update() { }
public virtual void DrawBase(VertexHelper vh) { }
public virtual void DrawTop(VertexHelper vh) { }
public virtual void OnSerieDataUpdate(int serieIndex) { }
public virtual void OnPointerClick(PointerEventData eventData) { }
public virtual void OnPointerDown(PointerEventData eventData) { }
public virtual void OnPointerUp(PointerEventData eventData) { }
@@ -117,13 +111,13 @@ namespace XCharts.Runtime
}
public abstract class MainComponentHandler<T> : MainComponentHandler
where T : MainComponent
where T : MainComponent
{
public T component { get; internal set; }
internal override void SetComponent(MainComponent component)
{
this.component = (T)component;
this.component = (T) component;
}
}
}

View File

@@ -1,4 +1,3 @@
namespace XCharts.Runtime
{
public class MainComponentContext

View File

@@ -1,5 +1,3 @@
using System.Collections.Generic;
using UnityEngine.UI;

View File

@@ -1,5 +1,3 @@
namespace XCharts.Runtime
{
/// <summary>

View File

@@ -1,4 +1,3 @@
using System.Text;
using UnityEngine;
using UnityEngine.EventSystems;

View File

@@ -1,4 +1,3 @@

namespace XCharts.Runtime
{
/// <summary>
@@ -8,5 +7,4 @@ namespace XCharts.Runtime
{
void OnChanged();
}
}
}

View File

@@ -1,4 +1,3 @@
namespace XCharts.Runtime
{
public interface ISerieContainer

View File

@@ -1,4 +1,3 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
@@ -6,6 +5,5 @@ using UnityEngine.UI;
namespace XCharts.Runtime
{
public interface ISerieDataComponent
{
}
{ }
}

View File

@@ -1,4 +1,3 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

View File

@@ -1,4 +1,3 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
@@ -6,6 +5,5 @@ using UnityEngine.UI;
namespace XCharts.Runtime
{
public interface ISimplifiedSerie
{
}
{ }
}

View File

@@ -1,4 +1,3 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

View File

@@ -1,4 +1,3 @@
using UnityEngine;
using UnityEngine.UI;
@@ -337,4 +336,4 @@ namespace XCharts.Runtime
}
}
}
}
}

View File

@@ -1,4 +1,3 @@
using UnityEngine;
namespace XCharts.Runtime

View File

@@ -1,4 +1,3 @@
using UnityEngine;
using UnityEngine.UI;
#if dUI_TextMeshPro
@@ -47,8 +46,7 @@ namespace XCharts.Runtime
}
public ChartText()
{
}
{ }
public ChartText(GameObject textParent)
{
@@ -72,7 +70,7 @@ namespace XCharts.Runtime
#if dUI_TextMeshPro
if (m_TMPText != null) m_TMPText.fontSize = fontSize;
#else
if (m_Text != null) m_Text.fontSize = (int)fontSize;
if (m_Text != null) m_Text.fontSize = (int) fontSize;
#endif
}
@@ -81,7 +79,7 @@ namespace XCharts.Runtime
if (text == null) text = string.Empty;
else text = text.Replace("\\n", "\n");
#if dUI_TextMeshPro
if(m_TMPText != null) m_TMPText.text = text;
if (m_TMPText != null) m_TMPText.text = text;
#else
if (m_Text != null) m_Text.text = text;
#endif
@@ -169,15 +167,33 @@ namespace XCharts.Runtime
if (m_TMPText == null) return;
switch (alignment)
{
case TextAnchor.LowerCenter: m_TMPText.alignment = TextAlignmentOptions.Bottom; break;
case TextAnchor.LowerLeft: m_TMPText.alignment = TextAlignmentOptions.BottomLeft; break;
case TextAnchor.LowerRight: m_TMPText.alignment = TextAlignmentOptions.BottomRight; break;
case TextAnchor.MiddleCenter: m_TMPText.alignment = TextAlignmentOptions.Center; break;
case TextAnchor.MiddleLeft: m_TMPText.alignment = TextAlignmentOptions.Left; break;
case TextAnchor.MiddleRight: m_TMPText.alignment = TextAlignmentOptions.Right; break;
case TextAnchor.UpperCenter: m_TMPText.alignment = TextAlignmentOptions.Top; break;
case TextAnchor.UpperLeft: m_TMPText.alignment = TextAlignmentOptions.TopLeft; break;
case TextAnchor.UpperRight: m_TMPText.alignment = TextAlignmentOptions.TopRight; break;
case TextAnchor.LowerCenter:
m_TMPText.alignment = TextAlignmentOptions.Bottom;
break;
case TextAnchor.LowerLeft:
m_TMPText.alignment = TextAlignmentOptions.BottomLeft;
break;
case TextAnchor.LowerRight:
m_TMPText.alignment = TextAlignmentOptions.BottomRight;
break;
case TextAnchor.MiddleCenter:
m_TMPText.alignment = TextAlignmentOptions.Center;
break;
case TextAnchor.MiddleLeft:
m_TMPText.alignment = TextAlignmentOptions.Left;
break;
case TextAnchor.MiddleRight:
m_TMPText.alignment = TextAlignmentOptions.Right;
break;
case TextAnchor.UpperCenter:
m_TMPText.alignment = TextAlignmentOptions.Top;
break;
case TextAnchor.UpperLeft:
m_TMPText.alignment = TextAlignmentOptions.TopLeft;
break;
case TextAnchor.UpperRight:
m_TMPText.alignment = TextAlignmentOptions.TopRight;
break;
default:
m_TMPText.alignment = TextAlignmentOptions.Center;
m_TextAlignment = TextAnchor.MiddleCenter;
@@ -199,10 +215,18 @@ namespace XCharts.Runtime
if (m_TMPText == null) return;
switch (fontStyle)
{
case FontStyle.Normal: m_TMPText.fontStyle = FontStyles.Normal; break;
case FontStyle.Bold: m_TMPText.fontStyle = FontStyles.Bold; break;
case FontStyle.BoldAndItalic: m_TMPText.fontStyle = FontStyles.Bold | FontStyles.Italic; break;
case FontStyle.Italic: m_TMPText.fontStyle = FontStyles.Italic; break;
case FontStyle.Normal:
m_TMPText.fontStyle = FontStyles.Normal;
break;
case FontStyle.Bold:
m_TMPText.fontStyle = FontStyles.Bold;
break;
case FontStyle.BoldAndItalic:
m_TMPText.fontStyle = FontStyles.Bold | FontStyles.Italic;
break;
case FontStyle.Italic:
m_TMPText.fontStyle = FontStyles.Italic;
break;
}
#else
if (m_Text != null) m_Text.fontStyle = fontStyle;

View File

@@ -120,7 +120,6 @@ namespace XCharts.Runtime
else return Color.clear;
}
public void SetIconColor(Color color)
{
if (m_Icon)

View File

@@ -1,7 +1,6 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using System;
namespace XCharts.Runtime
{

View File

@@ -1,6 +1,4 @@
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Runtime
{
@@ -34,4 +32,4 @@ namespace XCharts.Runtime
s_ListPool.ClearAll();
}
}
}
}

View File

@@ -1,4 +1,3 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
@@ -55,4 +54,4 @@ namespace XCharts.Runtime
m_Stack.Clear();
}
}
}
}

View File

@@ -1,4 +1,3 @@
using UnityEngine;
namespace XCharts.Runtime
@@ -7,9 +6,7 @@ namespace XCharts.Runtime
{
private static readonly ObjectPool<SerieData> s_ListPool = new ObjectPool<SerieData>(null, OnClear);
static void OnGet(SerieData serieData)
{
}
static void OnGet(SerieData serieData) { }
static void OnClear(SerieData serieData)
{
@@ -26,4 +23,4 @@ namespace XCharts.Runtime
s_ListPool.Release(toRelease);
}
}
}
}

View File

@@ -1,4 +1,3 @@
using System.Collections.Generic;
using UnityEngine;
@@ -67,9 +66,9 @@ namespace XCharts.Runtime
float iconWidth, float iconHeight, ThemeStyle theme)
{
var label = ChartHelper.AddChartLabel(name, parent, labelStyle, theme.common,
"", color, TextAnchor.MiddleCenter);
"", color, TextAnchor.MiddleCenter);
label.SetActive(labelStyle.show);
return label.gameObject;
}
}
}
}

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -13,7 +12,7 @@ namespace XCharts.Runtime
private const string NUMERIC_FORMATTER_X = "X";
private const string NUMERIC_FORMATTER_x = "x";
private static readonly string s_DefaultAxis = "axis_";
private static CultureInfo ci = new CultureInfo("en-us");// "en-us", "zh-cn", "ar-iq", "de-de"
private static CultureInfo ci = new CultureInfo("en-us"); // "en-us", "zh-cn", "ar-iq", "de-de"
private static Dictionary<Color, string> s_ColorToStr = new Dictionary<Color, string>(100);
private static Dictionary<int, string> s_SerieLabelName = new Dictionary<int, string>(1000);
private static Dictionary<Color, string> s_ColorDotStr = new Dictionary<Color, string>(100);
@@ -21,7 +20,6 @@ namespace XCharts.Runtime
private static Dictionary<int, string> s_AxisLabelName = new Dictionary<int, string>();
private static Dictionary<Type, string> s_TypeName = new Dictionary<Type, string>();
private static Dictionary<double, Dictionary<string, string>> s_NumberToStr = new Dictionary<double, Dictionary<string, string>>();
private static Dictionary<int, Dictionary<string, string>> s_PrecisionToStr = new Dictionary<int, Dictionary<string, string>>();
@@ -55,18 +53,18 @@ namespace XCharts.Runtime
{
if (string.IsNullOrEmpty(formatter))
{
if (value - (int)value == 0)
s_NumberToStr[value][formatter] = ((int)value).ToString();
if (value - (int) value == 0)
s_NumberToStr[value][formatter] = ((int) value).ToString();
else
s_NumberToStr[value][formatter] = value.ToString();
}
else if (formatter.StartsWith(NUMERIC_FORMATTER_D)
|| formatter.StartsWith(NUMERIC_FORMATTER_d)
|| formatter.StartsWith(NUMERIC_FORMATTER_X)
|| formatter.StartsWith(NUMERIC_FORMATTER_x)
)
else if (formatter.StartsWith(NUMERIC_FORMATTER_D) ||
formatter.StartsWith(NUMERIC_FORMATTER_d) ||
formatter.StartsWith(NUMERIC_FORMATTER_X) ||
formatter.StartsWith(NUMERIC_FORMATTER_x)
)
{
s_NumberToStr[value][formatter] = ((int)value).ToString(formatter, ci);
s_NumberToStr[value][formatter] = ((int) value).ToString(formatter, ci);
}
else
{

View File

@@ -1,4 +1,3 @@
using UnityEngine;
namespace XCharts.Runtime

View File

@@ -1,5 +1,3 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -97,13 +95,13 @@ namespace XCharts.Runtime
var arrowOffset = 0;
var arrowDent = arrowWidth / 3.3f;
UGL.DrawArrow(vh, startPos, pos, arrowWidth, arrowHeight,
arrowOffset, arrowDent, color);
arrowOffset, arrowDent, color);
break;
}
}
public static void DrawLineStyle(VertexHelper vh, LineStyle lineStyle, Vector3 startPos, Vector3 endPos,
Color32 defaultColor, float themeWidth, LineStyle.Type themeType)
Color32 defaultColor, float themeWidth, LineStyle.Type themeType)
{
var type = lineStyle.GetType(themeType);
var width = lineStyle.GetWidth(themeWidth);

View File

@@ -1,7 +1,6 @@

using System.Text;
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.EventSystems;
@@ -365,8 +364,8 @@ namespace XCharts.Runtime
label.UpdateIcon(labelStyle.icon);
if (labelStyle.background.show)
{
label.color = (!labelStyle.background.autoColor || autoColor == Color.clear)
? labelStyle.background.color : autoColor;
label.color = (!labelStyle.background.autoColor || autoColor == Color.clear) ?
labelStyle.background.color : autoColor;
label.sprite = labelStyle.background.sprite;
label.type = labelStyle.background.type;
}
@@ -442,7 +441,7 @@ namespace XCharts.Runtime
ThemeStyle theme, TextAnchor alignment)
{
var label = ChartHelper.AddChartLabel(name, parent, tooltip.indicatorLabelStyle, theme.tooltip,
"", Color.clear, alignment);
"", Color.clear, alignment);
label.SetActive(tooltip.show && tooltip.indicatorLabelStyle.show);
return label;
}
@@ -451,7 +450,7 @@ namespace XCharts.Runtime
{
Vector3 dir = (ep - sp).normalized;
float dist = Vector3.Distance(sp, ep);
int segment = (int)(dist / k);
int segment = (int) (dist / k);
posList.Clear();
posList.Add(sp);
for (int i = 1; i < segment; i++)
@@ -606,7 +605,7 @@ namespace XCharts.Runtime
{
Color color;
ColorUtility.TryParseHtmlString(hexColorStr, out color);
return (Color32)color;
return (Color32) color;
}
public static double GetMaxDivisibleValue(double max, int ceilRate)
@@ -615,15 +614,15 @@ namespace XCharts.Runtime
if (max > -1 && max < 1)
{
int count = 1;
int intvalue = (int)(max * Mathf.Pow(10, count));
int intvalue = (int) (max * Mathf.Pow(10, count));
while (intvalue == 0 && count < 12)
{
count++;
intvalue = (int)(max * Mathf.Pow(10, count));
intvalue = (int) (max * Mathf.Pow(10, count));
}
var pow = Mathf.Pow(10, count);
if (max > 0) return (int)((max * pow + 1)) / pow;
else return (int)((max * pow - 1)) / pow;
if (max > 0) return (int) ((max * pow + 1)) / pow;
else return (int) ((max * pow - 1)) / pow;
}
if (ceilRate == 0)
{
@@ -646,7 +645,7 @@ namespace XCharts.Runtime
else
{
var mod = max % ceilRate;
int rate = (int)(max / ceilRate);
int rate = (int) (max / ceilRate);
return mod == 0 ? max : (max < 0 ? rate : rate + 1) * ceilRate;
}
}
@@ -657,15 +656,15 @@ namespace XCharts.Runtime
if (min > -1 && min < 1)
{
int count = 1;
int intvalue = (int)(min * Mathf.Pow(10, count));
int intvalue = (int) (min * Mathf.Pow(10, count));
while (intvalue == 0 && count < 12)
{
count++;
intvalue = (int)(min * Mathf.Pow(10, count));
intvalue = (int) (min * Mathf.Pow(10, count));
}
var pow = Mathf.Pow(10, count);
if (min > 0) return (int)((min * pow + 1)) / pow;
else return (int)((min * pow - 1)) / pow;
if (min > 0) return (int) ((min * pow + 1)) / pow;
else return (int) ((min * pow - 1)) / pow;
}
if (ceilRate == 0)
{
@@ -687,7 +686,7 @@ namespace XCharts.Runtime
else
{
var mod = min % ceilRate;
int rate = (int)(min / ceilRate);
int rate = (int) (min / ceilRate);
return mod == 0 ? min : (min < 0 ? rate - 1 : rate) * ceilRate;
}
}
@@ -701,31 +700,31 @@ namespace XCharts.Runtime
{
if (isLogBaseE)
{
max = Mathf.Exp(splitNumber);
max = Math.Exp(splitNumber);
}
else
{
max = Mathf.Pow(logBase, splitNumber);
max = Math.Pow(logBase, splitNumber);
}
splitNumber++;
}
return max;
}
public static float GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)
public static double GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)
{
splitNumber = 0;
if (value > 1) return 1;
float min = 1;
double min = 1;
while (min > value)
{
if (isLogBaseE)
{
min = Mathf.Exp(-splitNumber);
min = Math.Exp(-splitNumber);
}
else
{
min = Mathf.Pow(logBase, -splitNumber);
min = Math.Pow(logBase, -splitNumber);
}
splitNumber++;
}
@@ -736,11 +735,11 @@ namespace XCharts.Runtime
{
if (value > 1 || value < -1) return 0;
int count = 1;
int intvalue = (int)(value * Mathf.Pow(10, count));
int intvalue = (int) (value * Mathf.Pow(10, count));
while (intvalue == 0 && count < 38)
{
count++;
intvalue = (int)(value * Mathf.Pow(10, count));
intvalue = (int) (value * Mathf.Pow(10, count));
}
if (count == 38 && (value == 0 || value == 1)) return 1;
else return count;
@@ -836,16 +835,16 @@ namespace XCharts.Runtime
{
if (color.a != 0 && opacity != 1)
{
color.a = (byte)(color.a * opacity);
color.a = (byte) (color.a * opacity);
}
}
public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)
{
var newColor = color;
newColor.r = (byte)(color.r * rate);
newColor.g = (byte)(color.g * rate);
newColor.b = (byte)(color.b * rate);
newColor.r = (byte) (color.r * rate);
newColor.g = (byte) (color.g * rate);
newColor.b = (byte) (color.b * rate);
return newColor;
}

View File

@@ -1,5 +1,3 @@
using System.Collections.Generic;
namespace XCharts.Runtime
@@ -18,7 +16,7 @@ namespace XCharts.Runtime
}
return null;
}
public static RadiusAxis GetRadiusAxis(List<MainComponent> components, int polarIndex)
{
foreach (var component in components)

View File

@@ -1,4 +1,3 @@
using System.Collections.Generic;
using UnityEngine;

View File

@@ -1,4 +1,3 @@
using UnityEngine;
namespace XCharts.Runtime
@@ -213,14 +212,14 @@ namespace XCharts.Runtime
public static bool IsFixedWidthHeight(RectTransform rt)
{
return IsLeftTop(rt.anchorMin, rt.anchorMax) ||
IsLeftCenter(rt.anchorMin, rt.anchorMax) ||
IsLeftBottom(rt.anchorMin, rt.anchorMax) ||
IsCenterTop(rt.anchorMin, rt.anchorMax) ||
IsCenterCenter(rt.anchorMin, rt.anchorMax) ||
IsCenterBottom(rt.anchorMin, rt.anchorMax) ||
IsRightTop(rt.anchorMin, rt.anchorMax) ||
IsRightCenter(rt.anchorMin, rt.anchorMax) ||
IsRightBottom(rt.anchorMin, rt.anchorMax);
IsLeftCenter(rt.anchorMin, rt.anchorMax) ||
IsLeftBottom(rt.anchorMin, rt.anchorMax) ||
IsCenterTop(rt.anchorMin, rt.anchorMax) ||
IsCenterCenter(rt.anchorMin, rt.anchorMax) ||
IsCenterBottom(rt.anchorMin, rt.anchorMax) ||
IsRightTop(rt.anchorMin, rt.anchorMax) ||
IsRightCenter(rt.anchorMin, rt.anchorMax) ||
IsRightBottom(rt.anchorMin, rt.anchorMax);
}
}

View File

@@ -1,7 +1,6 @@
using System.Text;
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.EventSystems;

View File

@@ -2,9 +2,8 @@
using System;
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEngine;
namespace XCharts.Runtime
{
@@ -16,8 +15,7 @@ namespace XCharts.Runtime
public XCResourcesImporter() { }
public void OnDestroy()
{
}
{ }
public void OnGUI()
{
@@ -137,4 +135,4 @@ namespace XCharts.Runtime
}
}
#endif
#endif

View File

@@ -1,8 +1,7 @@
using UnityEngine;
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
@@ -27,42 +26,42 @@ namespace XCharts.Runtime
#if dUI_TextMeshPro
[SerializeField] private TMP_FontAsset m_TMPFont = null;
#endif
[SerializeField] [Range(1, 200)] private int m_FontSizeLv1 = 28;
[SerializeField] [Range(1, 200)] private int m_FontSizeLv2 = 24;
[SerializeField] [Range(1, 200)] private int m_FontSizeLv3 = 20;
[SerializeField] [Range(1, 200)] private int m_FontSizeLv4 = 18;
[SerializeField][Range(1, 200)] private int m_FontSizeLv1 = 28;
[SerializeField][Range(1, 200)] private int m_FontSizeLv2 = 24;
[SerializeField][Range(1, 200)] private int m_FontSizeLv3 = 20;
[SerializeField][Range(1, 200)] private int m_FontSizeLv4 = 18;
[SerializeField] private LineStyle.Type m_AxisLineType = LineStyle.Type.Solid;
[SerializeField] [Range(0, 20)] private float m_AxisLineWidth = 0.8f;
[SerializeField][Range(0, 20)] private float m_AxisLineWidth = 0.8f;
[SerializeField] private LineStyle.Type m_AxisSplitLineType = LineStyle.Type.Solid;
[SerializeField] [Range(0, 20)] private float m_AxisSplitLineWidth = 0.8f;
[SerializeField] [Range(0, 20)] private float m_AxisTickWidth = 0.8f;
[SerializeField] [Range(0, 20)] private float m_AxisTickLength = 5f;
[SerializeField] [Range(0, 200)] private float m_GaugeAxisLineWidth = 15f;
[SerializeField] [Range(0, 20)] private float m_GaugeAxisSplitLineWidth = 0.8f;
[SerializeField] [Range(0, 20)] private float m_GaugeAxisSplitLineLength = 15f;
[SerializeField] [Range(0, 20)] private float m_GaugeAxisTickWidth = 0.8f;
[SerializeField] [Range(0, 20)] private float m_GaugeAxisTickLength = 5f;
[SerializeField] [Range(0, 20)] private float m_TootipLineWidth = 0.8f;
[SerializeField] [Range(0, 20)] private float m_DataZoomBorderWidth = 0.5f;
[SerializeField] [Range(0, 20)] private float m_DataZoomDataLineWidth = 0.5f;
[SerializeField] [Range(0, 20)] private float m_VisualMapBorderWidth = 0f;
[SerializeField][Range(0, 20)] private float m_AxisSplitLineWidth = 0.8f;
[SerializeField][Range(0, 20)] private float m_AxisTickWidth = 0.8f;
[SerializeField][Range(0, 20)] private float m_AxisTickLength = 5f;
[SerializeField][Range(0, 200)] private float m_GaugeAxisLineWidth = 15f;
[SerializeField][Range(0, 20)] private float m_GaugeAxisSplitLineWidth = 0.8f;
[SerializeField][Range(0, 20)] private float m_GaugeAxisSplitLineLength = 15f;
[SerializeField][Range(0, 20)] private float m_GaugeAxisTickWidth = 0.8f;
[SerializeField][Range(0, 20)] private float m_GaugeAxisTickLength = 5f;
[SerializeField][Range(0, 20)] private float m_TootipLineWidth = 0.8f;
[SerializeField][Range(0, 20)] private float m_DataZoomBorderWidth = 0.5f;
[SerializeField][Range(0, 20)] private float m_DataZoomDataLineWidth = 0.5f;
[SerializeField][Range(0, 20)] private float m_VisualMapBorderWidth = 0f;
[SerializeField] [Range(0, 20)] private float m_SerieLineWidth = 1.8f;
[SerializeField] [Range(0, 200)] private float m_SerieLineSymbolSize = 5f;
[SerializeField] [Range(0, 200)] private float m_SerieScatterSymbolSize = 20f;
[SerializeField] [Range(0, 200)] private float m_SerieSelectedRate = 1.3f;
[SerializeField] [Range(0, 10)] private float m_SerieCandlestickBorderWidth = 1f;
[SerializeField][Range(0, 20)] private float m_SerieLineWidth = 1.8f;
[SerializeField][Range(0, 200)] private float m_SerieLineSymbolSize = 5f;
[SerializeField][Range(0, 200)] private float m_SerieScatterSymbolSize = 20f;
[SerializeField][Range(0, 200)] private float m_SerieSelectedRate = 1.3f;
[SerializeField][Range(0, 10)] private float m_SerieCandlestickBorderWidth = 1f;
[SerializeField] private bool m_EditorShowAllListData = false;
[SerializeField] [Range(1, 20)] protected int m_MaxPainter = 10;
[SerializeField] [Range(1, 10)] protected float m_LineSmoothStyle = 3f;
[SerializeField] [Range(1f, 20)] protected float m_LineSmoothness = 2f;
[SerializeField] [Range(1f, 20)] protected float m_LineSegmentDistance = 3f;
[SerializeField] [Range(1, 10)] protected float m_CicleSmoothness = 2f;
[SerializeField] [Range(10, 50)] protected float m_VisualMapTriangeLen = 20f;
[SerializeField] [Range(1, 20)] protected float m_PieTooltipExtraRadius = 8f;
[SerializeField] [Range(1, 20)] protected float m_PieSelectedOffset = 8f;
[SerializeField][Range(1, 20)] protected int m_MaxPainter = 10;
[SerializeField][Range(1, 10)] protected float m_LineSmoothStyle = 3f;
[SerializeField][Range(1f, 20)] protected float m_LineSmoothness = 2f;
[SerializeField][Range(1f, 20)] protected float m_LineSegmentDistance = 3f;
[SerializeField][Range(1, 10)] protected float m_CicleSmoothness = 2f;
[SerializeField][Range(10, 50)] protected float m_VisualMapTriangeLen = 20f;
[SerializeField][Range(1, 20)] protected float m_PieTooltipExtraRadius = 8f;
[SerializeField][Range(1, 20)] protected float m_PieSelectedOffset = 8f;
[SerializeField] protected List<Theme> m_CustomThemes = new List<Theme>();
public static Lang lang { get { return Instance.m_Lang; } }

View File

@@ -1,5 +1,3 @@
using System.Collections.Generic;
using System.IO;
using UnityEngine;

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.SceneManagement;
using System.IO;
#if UNITY_EDITOR
using UnityEditor;
#endif
@@ -20,8 +20,8 @@ namespace XCharts.Runtime
[ExecuteInEditMode]
public static class XChartsMgr
{
public static readonly string version = "3.0.0-preview9";
public static readonly int versionDate = 20220506;
public static readonly string version = "3.0.0";
public static readonly int versionDate = 20220522;
public static string fullVersion { get { return version + "-" + versionDate; } }
internal static List<BaseChart> chartList = new List<BaseChart>();