mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 08:50:10 +00:00
优化性能,降低GC
This commit is contained in:
@@ -57,7 +57,7 @@ namespace XCharts
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private void DrawYBarSerie(VertexHelper vh, int serieIndex, int stackCount,
|
private void DrawYBarSerie(VertexHelper vh, int serieIndex, int stackCount,
|
||||||
Serie serie, Color color, ref Dictionary<int, float> seriesHig)
|
Serie serie, Color color, ref List<float> seriesHig)
|
||||||
{
|
{
|
||||||
if (!IsActive(serie.name)) return;
|
if (!IsActive(serie.name)) return;
|
||||||
var xAxis = m_XAxises[serie.axisIndex];
|
var xAxis = m_XAxises[serie.axisIndex];
|
||||||
@@ -71,11 +71,18 @@ namespace XCharts
|
|||||||
int maxCount = maxShowDataNumber > 0 ?
|
int maxCount = maxShowDataNumber > 0 ?
|
||||||
(maxShowDataNumber > serie.yData.Count ? serie.yData.Count : maxShowDataNumber)
|
(maxShowDataNumber > serie.yData.Count ? serie.yData.Count : maxShowDataNumber)
|
||||||
: serie.yData.Count;
|
: serie.yData.Count;
|
||||||
|
if (seriesHig.Count < minShowDataNumber)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < minShowDataNumber; i++)
|
||||||
|
{
|
||||||
|
seriesHig.Add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = minShowDataNumber; i < maxCount; i++)
|
for (int i = minShowDataNumber; i < maxCount; i++)
|
||||||
{
|
{
|
||||||
if (!seriesHig.ContainsKey(i))
|
if (i >= seriesHig.Count)
|
||||||
{
|
{
|
||||||
seriesHig[i] = 0;
|
seriesHig.Add(0);
|
||||||
}
|
}
|
||||||
float value = serie.yData[i];
|
float value = serie.yData[i];
|
||||||
float pX = seriesHig[i] + coordinateX + xAxis.zeroXOffset + m_Coordinate.tickness;
|
float pX = seriesHig[i] + coordinateX + xAxis.zeroXOffset + m_Coordinate.tickness;
|
||||||
@@ -98,7 +105,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void DrawXBarSerie(VertexHelper vh, int serieIndex, int stackCount,
|
private void DrawXBarSerie(VertexHelper vh, int serieIndex, int stackCount,
|
||||||
Serie serie, Color color, ref Dictionary<int, float> seriesHig)
|
Serie serie, Color color, ref List<float> seriesHig)
|
||||||
{
|
{
|
||||||
if (!IsActive(serie.name)) return;
|
if (!IsActive(serie.name)) return;
|
||||||
List<float> showData = serie.GetYDataList(m_DataZoom);
|
List<float> showData = serie.GetYDataList(m_DataZoom);
|
||||||
@@ -113,11 +120,18 @@ namespace XCharts
|
|||||||
int maxCount = maxShowDataNumber > 0 ?
|
int maxCount = maxShowDataNumber > 0 ?
|
||||||
(maxShowDataNumber > showData.Count ? showData.Count : maxShowDataNumber)
|
(maxShowDataNumber > showData.Count ? showData.Count : maxShowDataNumber)
|
||||||
: showData.Count;
|
: showData.Count;
|
||||||
|
if (seriesHig.Count < minShowDataNumber)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < minShowDataNumber; i++)
|
||||||
|
{
|
||||||
|
seriesHig.Add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = minShowDataNumber; i < maxCount; i++)
|
for (int i = minShowDataNumber; i < maxCount; i++)
|
||||||
{
|
{
|
||||||
if (!seriesHig.ContainsKey(i))
|
if (i >= seriesHig.Count)
|
||||||
{
|
{
|
||||||
seriesHig[i] = 0;
|
seriesHig.Add(0);
|
||||||
}
|
}
|
||||||
float value = showData[i];
|
float value = showData[i];
|
||||||
float pX = coordinateX + i * scaleWid;
|
float pX = coordinateX + i * scaleWid;
|
||||||
@@ -140,60 +154,43 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashSet<string> serieNameSet = new HashSet<string>();
|
||||||
|
private Dictionary<int, List<Serie>> stackSeries = new Dictionary<int, List<Serie>>();
|
||||||
|
private List<float> seriesCurrHig = new List<float>();
|
||||||
protected override void DrawChart(VertexHelper vh)
|
protected override void DrawChart(VertexHelper vh)
|
||||||
{
|
{
|
||||||
base.DrawChart(vh);
|
base.DrawChart(vh);
|
||||||
if (m_YAxises[0].type == Axis.AxisType.Category)
|
bool yCategory = m_YAxises[0].IsCategory() || m_YAxises[1].IsCategory();
|
||||||
|
m_Series.GetStackSeries(ref stackSeries);
|
||||||
|
int seriesCount = stackSeries.Count;
|
||||||
|
int serieNameCount = -1;
|
||||||
|
serieNameSet.Clear();
|
||||||
|
for (int j = 0; j < seriesCount; j++)
|
||||||
{
|
{
|
||||||
var stackSeries = m_Series.GetStackSeries();
|
var seriesHig = new Dictionary<int, float>();
|
||||||
int seriesCount = stackSeries.Count;
|
var serieList = stackSeries[j];
|
||||||
HashSet<string> serieNameSet = new HashSet<string>();
|
seriesCurrHig.Clear();
|
||||||
int serieNameCount = -1;
|
if (seriesCurrHig.Capacity != serieList[0].dataCount)
|
||||||
for (int j = 0; j < seriesCount; j++)
|
|
||||||
{
|
{
|
||||||
var seriesHig = new Dictionary<int, float>();
|
seriesCurrHig.Capacity = serieList[0].dataCount;
|
||||||
var serieList = stackSeries[j];
|
}
|
||||||
for (int n = 0; n < serieList.Count; n++)
|
for (int n = 0; n < serieList.Count; n++)
|
||||||
|
{
|
||||||
|
Serie serie = serieList[n];
|
||||||
|
if (string.IsNullOrEmpty(serie.name)) serieNameCount++;
|
||||||
|
else if (!serieNameSet.Contains(serie.name))
|
||||||
{
|
{
|
||||||
Serie serie = serieList[n];
|
serieNameSet.Add(serie.name);
|
||||||
if (string.IsNullOrEmpty(serie.name)) serieNameCount++;
|
serieNameCount++;
|
||||||
else if (!serieNameSet.Contains(serie.name))
|
}
|
||||||
{
|
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
||||||
serieNameSet.Add(serie.name);
|
if (yCategory) DrawYBarSerie(vh, j, seriesCount, serie, color, ref seriesCurrHig);
|
||||||
serieNameCount++;
|
else DrawXBarSerie(vh, j, seriesCount, serie, color, ref seriesCurrHig);
|
||||||
}
|
|
||||||
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
|
||||||
DrawYBarSerie(vh, j, seriesCount, serie, color, ref seriesHig);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DrawYTooltipIndicator(vh);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var stackSeries = m_Series.GetStackSeries();
|
|
||||||
int seriesCount = stackSeries.Count;
|
|
||||||
HashSet<string> serieNameSet = new HashSet<string>();
|
|
||||||
int serieNameCount = -1;
|
|
||||||
for (int j = 0; j < seriesCount; j++)
|
|
||||||
{
|
|
||||||
var seriesHig = new Dictionary<int, float>();
|
|
||||||
var serieList = stackSeries[j];
|
|
||||||
for (int n = 0; n < serieList.Count; n++)
|
|
||||||
{
|
|
||||||
Serie serie = serieList[n];
|
|
||||||
if (string.IsNullOrEmpty(serie.name)) serieNameCount++;
|
|
||||||
else if (!serieNameSet.Contains(serie.name))
|
|
||||||
{
|
|
||||||
serieNameSet.Add(serie.name);
|
|
||||||
serieNameCount++;
|
|
||||||
}
|
|
||||||
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
|
||||||
DrawXBarSerie(vh, j, seriesCount, serie, color, ref seriesHig);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DrawXTooltipIndicator(vh);
|
|
||||||
}
|
}
|
||||||
|
if (yCategory) DrawYTooltipIndicator(vh);
|
||||||
|
else DrawXTooltipIndicator(vh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,15 +202,21 @@ namespace XCharts
|
|||||||
return coordinateWidth / (m_BoundaryGap ? dataCount : dataCount - 1);
|
return coordinateWidth / (m_BoundaryGap ? dataCount : dataCount - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dictionary<float, string> _cacheValue2str = new Dictionary<float, string>();
|
||||||
public string GetLabelName(int index, float minValue, float maxValue, DataZoom dataZoom)
|
public string GetLabelName(int index, float minValue, float maxValue, DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
if (m_Type == AxisType.Value)
|
if (m_Type == AxisType.Value)
|
||||||
{
|
{
|
||||||
float value = (minValue + (maxValue - minValue) * index / (GetSplitNumber(dataZoom) - 1));
|
float value = (minValue + (maxValue - minValue) * index / (GetSplitNumber(dataZoom) - 1));
|
||||||
if (value - (int)value == 0)
|
if (_cacheValue2str.ContainsKey(value)) return _cacheValue2str[value];
|
||||||
return (value).ToString();
|
|
||||||
else
|
else
|
||||||
return (value).ToString("f1");
|
{
|
||||||
|
if (value - (int)value == 0)
|
||||||
|
_cacheValue2str[value] = (value).ToString();
|
||||||
|
else
|
||||||
|
_cacheValue2str[value] = (value).ToString("f1");
|
||||||
|
return _cacheValue2str[value];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var showData = GetDataList(dataZoom);
|
var showData = GetDataList(dataZoom);
|
||||||
int dataCount = showData.Count;
|
int dataCount = showData.Count;
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ namespace XCharts
|
|||||||
var xdata = serie.xData[n];
|
var xdata = serie.xData[n];
|
||||||
var ydata = serie.yData[n];
|
var ydata = serie.yData[n];
|
||||||
var serieData = serie.GetSerieData(n);
|
var serieData = serie.GetSerieData(n);
|
||||||
var symbolSize = serie.symbol.GetSize(serieData == null?null:serieData.data);
|
var symbolSize = serie.symbol.GetSize(serieData == null ? null : serieData.data);
|
||||||
if (Mathf.Abs(xValue - xdata) / xRate < symbolSize
|
if (Mathf.Abs(xValue - xdata) / xRate < symbolSize
|
||||||
&& Mathf.Abs(yValue - ydata) / yRate < symbolSize)
|
&& Mathf.Abs(yValue - ydata) / yRate < symbolSize)
|
||||||
{
|
{
|
||||||
@@ -241,6 +241,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private StringBuilder sb = new StringBuilder(100);
|
||||||
protected override void RefreshTooltip()
|
protected override void RefreshTooltip()
|
||||||
{
|
{
|
||||||
base.RefreshTooltip();
|
base.RefreshTooltip();
|
||||||
@@ -268,7 +269,8 @@ namespace XCharts
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
sb.Length = 0;
|
||||||
|
|
||||||
if (!isCartesian)
|
if (!isCartesian)
|
||||||
{
|
{
|
||||||
sb.Append(tempAxis.GetData(index, m_DataZoom));
|
sb.Append(tempAxis.GetData(index, m_DataZoom));
|
||||||
@@ -279,23 +281,23 @@ namespace XCharts
|
|||||||
if (serie.show)
|
if (serie.show)
|
||||||
{
|
{
|
||||||
string key = serie.name;
|
string key = serie.name;
|
||||||
//if (string.IsNullOrEmpty(key)) key = m_Legend.GetData(i);
|
|
||||||
if (!string.IsNullOrEmpty(key)) key += " : ";
|
|
||||||
float xValue, yValue;
|
float xValue, yValue;
|
||||||
serie.GetXYData(index, m_DataZoom, out xValue, out yValue);
|
serie.GetXYData(index, m_DataZoom, out xValue, out yValue);
|
||||||
if (isCartesian)
|
if (isCartesian)
|
||||||
{
|
{
|
||||||
if (serie.selected)
|
if (serie.selected)
|
||||||
{
|
{
|
||||||
sb.AppendFormat("{0}[{1}, {2}]\n", key, xValue, yValue);
|
sb.Append(key).Append(!string.IsNullOrEmpty(key) ? " : " : "");
|
||||||
|
sb.Append("[").Append(ChartCached.FloatToStr(xValue)).Append(",")
|
||||||
|
.Append(ChartCached.FloatToStr(yValue)).Append("]\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string strColor = ColorUtility.ToHtmlStringRGBA(m_ThemeInfo.GetColor(i));
|
sb.Append("\n")
|
||||||
sb.Append("\n");
|
.Append("<color=").Append(m_ThemeInfo.GetColorStr(i)).Append(">● </color>")
|
||||||
sb.AppendFormat("<color=#{0}>● </color>", strColor);
|
.Append(key).Append(!string.IsNullOrEmpty(key) ? " : " : "")
|
||||||
sb.AppendFormat("{0}{1}", key, yValue);
|
.Append(ChartCached.FloatToStr(yValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -327,6 +329,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var showTooltipLabel = axis.show && m_Tooltip.type == Tooltip.Type.Corss;
|
var showTooltipLabel = axis.show && m_Tooltip.type == Tooltip.Type.Corss;
|
||||||
axis.SetTooltipLabelActive(showTooltipLabel);
|
axis.SetTooltipLabelActive(showTooltipLabel);
|
||||||
|
if (!showTooltipLabel) return;
|
||||||
string labelText = "";
|
string labelText = "";
|
||||||
Vector2 labelPos = Vector2.zero;
|
Vector2 labelPos = Vector2.zero;
|
||||||
if (axis is XAxis)
|
if (axis is XAxis)
|
||||||
@@ -335,7 +338,7 @@ namespace XCharts
|
|||||||
var diff = axisIndex > 0 ? -axis.axisLabel.fontSize - axis.axisLabel.margin - 3.5f : axis.axisLabel.margin / 2 + 1;
|
var diff = axisIndex > 0 ? -axis.axisLabel.fontSize - axis.axisLabel.margin - 3.5f : axis.axisLabel.margin / 2 + 1;
|
||||||
if (axis.IsValue())
|
if (axis.IsValue())
|
||||||
{
|
{
|
||||||
labelText = m_Tooltip.xValues[axisIndex].ToString("f2");
|
labelText = ChartCached.FloatToStr(m_Tooltip.xValues[axisIndex], 2);
|
||||||
labelPos = new Vector2(m_Tooltip.pointerPos.x, posY - diff);
|
labelPos = new Vector2(m_Tooltip.pointerPos.x, posY - diff);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -353,7 +356,7 @@ namespace XCharts
|
|||||||
var diff = axisIndex > 0 ? -axis.axisLabel.margin + 3 : axis.axisLabel.margin - 3;
|
var diff = axisIndex > 0 ? -axis.axisLabel.margin + 3 : axis.axisLabel.margin - 3;
|
||||||
if (axis.IsValue())
|
if (axis.IsValue())
|
||||||
{
|
{
|
||||||
labelText = m_Tooltip.yValues[axisIndex].ToString("f2");
|
labelText = ChartCached.FloatToStr(m_Tooltip.yValues[axisIndex], 2);
|
||||||
labelPos = new Vector2(posX - diff, m_Tooltip.pointerPos.y);
|
labelPos = new Vector2(posX - diff, m_Tooltip.pointerPos.y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -297,16 +297,18 @@ namespace XCharts
|
|||||||
GetMinMaxValue(dataZoom, axisIndex, true, out minVaule, out maxValue);
|
GetMinMaxValue(dataZoom, axisIndex, true, out minVaule, out maxValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dictionary<int, List<Serie>> _stackSeriesForMinMax = new Dictionary<int, List<Serie>>();
|
||||||
|
private Dictionary<int, float> _serieTotalValueForMinMax = new Dictionary<int, float>();
|
||||||
public void GetMinMaxValue(DataZoom dataZoom, int axisIndex, bool yValue, out int minVaule, out int maxValue)
|
public void GetMinMaxValue(DataZoom dataZoom, int axisIndex, bool yValue, out int minVaule, out int maxValue)
|
||||||
{
|
{
|
||||||
float min = int.MaxValue;
|
float min = int.MaxValue;
|
||||||
float max = int.MinValue;
|
float max = int.MinValue;
|
||||||
if (IsStack())
|
if (IsStack())
|
||||||
{
|
{
|
||||||
var stackSeries = GetStackSeries();
|
GetStackSeries(ref _stackSeriesForMinMax);
|
||||||
foreach (var ss in stackSeries)
|
foreach (var ss in _stackSeriesForMinMax)
|
||||||
{
|
{
|
||||||
var seriesTotalValue = new Dictionary<int, float>();
|
_serieTotalValueForMinMax.Clear();
|
||||||
for (int i = 0; i < ss.Value.Count; i++)
|
for (int i = 0; i < ss.Value.Count; i++)
|
||||||
{
|
{
|
||||||
var serie = ss.Value[i];
|
var serie = ss.Value[i];
|
||||||
@@ -314,14 +316,14 @@ namespace XCharts
|
|||||||
var showData = yValue ? serie.GetYDataList(dataZoom) : serie.GetXDataList(dataZoom);
|
var showData = yValue ? serie.GetYDataList(dataZoom) : serie.GetXDataList(dataZoom);
|
||||||
for (int j = 0; j < showData.Count; j++)
|
for (int j = 0; j < showData.Count; j++)
|
||||||
{
|
{
|
||||||
if (!seriesTotalValue.ContainsKey(j))
|
if (!_serieTotalValueForMinMax.ContainsKey(j))
|
||||||
seriesTotalValue[j] = 0;
|
_serieTotalValueForMinMax[j] = 0;
|
||||||
seriesTotalValue[j] = seriesTotalValue[j] + showData[j];
|
_serieTotalValueForMinMax[j] = _serieTotalValueForMinMax[j] + showData[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float tmax = int.MinValue;
|
float tmax = int.MinValue;
|
||||||
float tmin = int.MaxValue;
|
float tmin = int.MaxValue;
|
||||||
foreach (var tt in seriesTotalValue)
|
foreach (var tt in _serieTotalValueForMinMax)
|
||||||
{
|
{
|
||||||
if (tt.Value > tmax) tmax = tt.Value;
|
if (tt.Value > tmax) tmax = tt.Value;
|
||||||
if (tt.Value < tmin) tmin = tt.Value;
|
if (tt.Value < tmin) tmin = tt.Value;
|
||||||
@@ -400,16 +402,17 @@ namespace XCharts
|
|||||||
return ChartHelper.GetMinDivisibleValue(min);
|
return ChartHelper.GetMinDivisibleValue(min);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashSet<string> _setForStack = new HashSet<string>();
|
||||||
public bool IsStack()
|
public bool IsStack()
|
||||||
{
|
{
|
||||||
HashSet<string> sets = new HashSet<string>();
|
_setForStack.Clear();
|
||||||
foreach (var serie in m_Series)
|
foreach (var serie in m_Series)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(serie.stack)) continue;
|
if (string.IsNullOrEmpty(serie.stack)) continue;
|
||||||
if (sets.Contains(serie.stack)) return true;
|
if (_setForStack.Contains(serie.stack)) return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sets.Add(serie.stack);
|
_setForStack.Add(serie.stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -449,6 +452,52 @@ namespace XCharts
|
|||||||
return stackSeries;
|
return stackSeries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dictionary<string, int> sets = new Dictionary<string, int>();
|
||||||
|
public void GetStackSeries(ref Dictionary<int, List<Serie>> stackSeries)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
sets.Clear();
|
||||||
|
if (stackSeries == null)
|
||||||
|
{
|
||||||
|
stackSeries = new Dictionary<int, List<Serie>>(m_Series.Count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var kv in stackSeries)
|
||||||
|
{
|
||||||
|
kv.Value.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
|
{
|
||||||
|
var serie = m_Series[i];
|
||||||
|
serie.index = i;
|
||||||
|
if (string.IsNullOrEmpty(serie.stack))
|
||||||
|
{
|
||||||
|
if (!stackSeries.ContainsKey(count))
|
||||||
|
stackSeries[count] = new List<Serie>(m_Series.Count);
|
||||||
|
stackSeries[count].Add(serie);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!sets.ContainsKey(serie.stack))
|
||||||
|
{
|
||||||
|
sets.Add(serie.stack, count);
|
||||||
|
if (!stackSeries.ContainsKey(count))
|
||||||
|
stackSeries[count] = new List<Serie>(m_Series.Count);
|
||||||
|
stackSeries[count].Add(serie);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int stackIndex = sets[serie.stack];
|
||||||
|
stackSeries[stackIndex].Add(serie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<string> GetSerieNameList()
|
public List<string> GetSerieNameList()
|
||||||
{
|
{
|
||||||
var list = new List<string>();
|
var list = new List<string>();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
@@ -62,6 +63,22 @@ namespace XCharts
|
|||||||
return m_ColorPalette[index];
|
return m_ColorPalette[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dictionary<int, string> _colorDic = new Dictionary<int, string>();
|
||||||
|
public string GetColorStr(int index)
|
||||||
|
{
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
index = index % m_ColorPalette.Length;
|
||||||
|
if (_colorDic.ContainsKey(index)) return _colorDic[index];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_colorDic[index] = ColorUtility.ToHtmlStringRGBA(GetColor(index));
|
||||||
|
return _colorDic[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Copy(ThemeInfo theme)
|
public void Copy(ThemeInfo theme)
|
||||||
{
|
{
|
||||||
m_Font = theme.m_Font;
|
m_Font = theme.m_Font;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Xml;
|
using System.Collections.Generic;
|
||||||
|
using System.Xml;
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@@ -173,11 +174,13 @@ namespace XCharts
|
|||||||
lastDataIndex[1] = dataIndex[1];
|
lastDataIndex[1] = dataIndex[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSelected(){
|
public bool IsSelected()
|
||||||
|
{
|
||||||
return dataIndex[0] >= 0 || dataIndex[1] >= 0;
|
return dataIndex[0] >= 0 || dataIndex[1] >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSelectedDataIndex(int index){
|
public bool IsSelectedDataIndex(int index)
|
||||||
|
{
|
||||||
return dataIndex[0] == index || dataIndex[1] == index;
|
return dataIndex[0] == index || dataIndex[1] == index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,29 +37,37 @@ namespace XCharts
|
|||||||
if (m_YAxises[0].type == Axis.AxisType.Category
|
if (m_YAxises[0].type == Axis.AxisType.Category
|
||||||
|| m_YAxises[1].type == Axis.AxisType.Category)
|
|| m_YAxises[1].type == Axis.AxisType.Category)
|
||||||
{
|
{
|
||||||
DrawYCategory(vh);
|
DrawLineChart(vh,true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawXCategory(vh);
|
DrawLineChart(vh,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawXCategory(VertexHelper vh)
|
private Dictionary<int, List<Serie>> stackSeries = new Dictionary<int, List<Serie>>();
|
||||||
|
private List<float> seriesCurrHig = new List<float>();
|
||||||
|
private HashSet<string> serieNameSet = new HashSet<string>();
|
||||||
|
private List<Vector3> points = new List<Vector3>();
|
||||||
|
private List<int> pointSerieIndex = new List<int>();
|
||||||
|
private void DrawLineChart(VertexHelper vh, bool yCategory)
|
||||||
{
|
{
|
||||||
var stackSeries = m_Series.GetStackSeries();
|
m_Series.GetStackSeries(ref stackSeries);
|
||||||
int seriesCount = stackSeries.Count;
|
int seriesCount = stackSeries.Count;
|
||||||
|
|
||||||
int serieCount = 0;
|
int serieCount = 0;
|
||||||
List<Vector3> points = new List<Vector3>();
|
|
||||||
List<int> pointSerieIndex = new List<int>();
|
|
||||||
int dataCount = 0;
|
int dataCount = 0;
|
||||||
HashSet<string> serieNameSet = new HashSet<string>();
|
serieNameSet.Clear();
|
||||||
|
points.Clear();
|
||||||
|
pointSerieIndex.Clear();
|
||||||
int serieNameCount = -1;
|
int serieNameCount = -1;
|
||||||
for (int j = 0; j < seriesCount; j++)
|
for (int j = 0; j < seriesCount; j++)
|
||||||
{
|
{
|
||||||
var seriesCurrHig = new Dictionary<int, float>();
|
|
||||||
var serieList = stackSeries[j];
|
var serieList = stackSeries[j];
|
||||||
|
seriesCurrHig.Clear();
|
||||||
|
if (seriesCurrHig.Capacity != serieList[0].dataCount)
|
||||||
|
{
|
||||||
|
seriesCurrHig.Capacity = serieList[0].dataCount;
|
||||||
|
}
|
||||||
for (int n = 0; n < serieList.Count; n++)
|
for (int n = 0; n < serieList.Count; n++)
|
||||||
{
|
{
|
||||||
Serie serie = serieList[n];
|
Serie serie = serieList[n];
|
||||||
@@ -70,50 +78,20 @@ namespace XCharts
|
|||||||
serieNameCount++;
|
serieNameCount++;
|
||||||
}
|
}
|
||||||
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
||||||
DrawXLineSerie(vh, serieCount, color, serie, ref dataCount, ref points, ref pointSerieIndex, ref seriesCurrHig);
|
if (yCategory)
|
||||||
|
DrawYLineSerie(vh, serieCount, color, serie, ref dataCount, ref points, ref pointSerieIndex, ref seriesCurrHig);
|
||||||
|
else
|
||||||
|
DrawXLineSerie(vh, serieCount, color, serie, ref dataCount, ref points, ref pointSerieIndex, ref seriesCurrHig);
|
||||||
if (serie.show)
|
if (serie.show)
|
||||||
{
|
{
|
||||||
serieCount++;
|
serieCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DrawLinePoint(vh, dataCount, points, pointSerieIndex);
|
DrawLinePoint(vh, dataCount, points, pointSerieIndex);
|
||||||
}
|
|
||||||
DrawXTooltipIndicator(vh);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawYCategory(VertexHelper vh)
|
|
||||||
{
|
|
||||||
var stackSeries = m_Series.GetStackSeries();
|
|
||||||
int seriesCount = stackSeries.Count;
|
|
||||||
int serieCount = 0;
|
|
||||||
List<Vector3> points = new List<Vector3>();
|
|
||||||
List<int> pointSerieIndex = new List<int>();
|
|
||||||
int dataCount = 0;
|
|
||||||
HashSet<string> serieNameSet = new HashSet<string>();
|
|
||||||
int serieNameCount = -1;
|
|
||||||
for (int j = 0; j < seriesCount; j++)
|
|
||||||
{
|
|
||||||
var seriesHig = new Dictionary<int, float>();
|
|
||||||
var serieList = stackSeries[j];
|
|
||||||
for (int n = 0; n < serieList.Count; n++)
|
|
||||||
{
|
|
||||||
Serie serie = serieList[n];
|
|
||||||
if (string.IsNullOrEmpty(serie.name)) serieNameCount++;
|
|
||||||
else if (!serieNameSet.Contains(serie.name))
|
|
||||||
{
|
|
||||||
serieNameSet.Add(serie.name);
|
|
||||||
serieNameCount++;
|
|
||||||
}
|
|
||||||
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
|
||||||
DrawYLineSerie(vh, serieCount, color, serie, ref dataCount, ref points, ref pointSerieIndex, ref seriesHig);
|
|
||||||
if (serie.show)
|
|
||||||
{
|
|
||||||
serieCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DrawLinePoint(vh, dataCount, points, pointSerieIndex);
|
|
||||||
}
|
}
|
||||||
DrawYTooltipIndicator(vh);
|
if (yCategory) DrawYTooltipIndicator(vh);
|
||||||
|
else DrawXTooltipIndicator(vh);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawLinePoint(VertexHelper vh, int dataCount, List<Vector3> points, List<int> pointSerieIndex)
|
private void DrawLinePoint(VertexHelper vh, int dataCount, List<Vector3> points, List<int> pointSerieIndex)
|
||||||
@@ -143,13 +121,17 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Vector3> lastPoints = new List<Vector3>();
|
||||||
|
List<Vector3> lastSmoothPoints = new List<Vector3>();
|
||||||
|
List<Vector3> smoothPoints = new List<Vector3>();
|
||||||
|
List<Vector3> smoothSegmentPoints = new List<Vector3>();
|
||||||
private void DrawXLineSerie(VertexHelper vh, int serieIndex, Color color, Serie serie, ref int dataCount,
|
private void DrawXLineSerie(VertexHelper vh, int serieIndex, Color color, Serie serie, ref int dataCount,
|
||||||
ref List<Vector3> points, ref List<int> pointSerieIndexs, ref Dictionary<int, float> seriesHig)
|
ref List<Vector3> points, ref List<int> pointSerieIndexs, ref List<float> seriesHig)
|
||||||
{
|
{
|
||||||
if (!IsActive(serie.index)) return;
|
if (!IsActive(serie.index)) return;
|
||||||
List<Vector3> lastPoints = new List<Vector3>();
|
lastPoints.Clear();
|
||||||
List<Vector3> lastSmoothPoints = new List<Vector3>();
|
lastSmoothPoints.Clear();
|
||||||
List<Vector3> smoothPoints = new List<Vector3>();
|
smoothPoints.Clear();
|
||||||
List<float> yData = serie.GetYDataList(m_DataZoom);
|
List<float> yData = serie.GetYDataList(m_DataZoom);
|
||||||
List<float> xData = serie.GetXDataList(m_DataZoom);
|
List<float> xData = serie.GetXDataList(m_DataZoom);
|
||||||
|
|
||||||
@@ -183,11 +165,18 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int smoothPointCount = 1;
|
int smoothPointCount = 1;
|
||||||
|
if (seriesHig.Count < minShowDataNumber)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < minShowDataNumber; i++)
|
||||||
|
{
|
||||||
|
seriesHig.Add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = minShowDataNumber; i < maxCount; i++)
|
for (int i = minShowDataNumber; i < maxCount; i++)
|
||||||
{
|
{
|
||||||
if (!seriesHig.ContainsKey(i))
|
if (i >= seriesHig.Count)
|
||||||
{
|
{
|
||||||
seriesHig[i] = 0;
|
seriesHig.Add(0);
|
||||||
}
|
}
|
||||||
float yValue = yData[i];
|
float yValue = yData[i];
|
||||||
float yDataHig;
|
float yDataHig;
|
||||||
@@ -261,15 +250,14 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else if (m_Line.smooth)
|
else if (m_Line.smooth)
|
||||||
{
|
{
|
||||||
Vector3[] list;
|
if (xAxis.IsValue()) ChartHelper.GetBezierListVertical(ref smoothSegmentPoints,lp, np, m_Line.smoothStyle);
|
||||||
if (xAxis.IsValue()) list = ChartHelper.GetBezierListVertical(lp, np, m_Line.smoothStyle);
|
else ChartHelper.GetBezierList(ref smoothSegmentPoints,lp, np, m_Line.smoothStyle);
|
||||||
else list = ChartHelper.GetBezierList(lp, np, m_Line.smoothStyle);
|
|
||||||
Vector3 start, to;
|
Vector3 start, to;
|
||||||
start = list[0];
|
start = smoothSegmentPoints[0];
|
||||||
for (int k = 1; k < list.Length; k++)
|
for (int k = 1; k < smoothSegmentPoints.Count; k++)
|
||||||
{
|
{
|
||||||
smoothPoints.Add(list[k]);
|
smoothPoints.Add(smoothSegmentPoints[k]);
|
||||||
to = list[k];
|
to = smoothSegmentPoints[k];
|
||||||
ChartHelper.DrawLine(vh, start, to, m_Line.tickness, color);
|
ChartHelper.DrawLine(vh, start, to, m_Line.tickness, color);
|
||||||
|
|
||||||
if (m_Line.area)
|
if (m_Line.area)
|
||||||
@@ -340,12 +328,12 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void DrawYLineSerie(VertexHelper vh, int serieIndex, Color color, Serie serie, ref int dataCount,
|
private void DrawYLineSerie(VertexHelper vh, int serieIndex, Color color, Serie serie, ref int dataCount,
|
||||||
ref List<Vector3> points, ref List<int> pointSerieIndexs, ref Dictionary<int, float> seriesHig)
|
ref List<Vector3> points, ref List<int> pointSerieIndexs, ref List<float> seriesHig)
|
||||||
{
|
{
|
||||||
if (!IsActive(serie.index)) return;
|
if (!IsActive(serie.index)) return;
|
||||||
List<Vector3> lastPoints = new List<Vector3>();
|
lastPoints.Clear();
|
||||||
List<Vector3> lastSmoothPoints = new List<Vector3>();
|
lastSmoothPoints.Clear();
|
||||||
List<Vector3> smoothPoints = new List<Vector3>();
|
smoothPoints.Clear();
|
||||||
|
|
||||||
Vector3 lp = Vector3.zero;
|
Vector3 lp = Vector3.zero;
|
||||||
Vector3 np = Vector3.zero;
|
Vector3 np = Vector3.zero;
|
||||||
@@ -376,12 +364,19 @@ namespace XCharts
|
|||||||
smoothPoints.Clear();
|
smoothPoints.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int smoothPointCount = 1;
|
int smoothPointCount = 1;
|
||||||
|
if (seriesHig.Count < minShowDataNumber)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < minShowDataNumber; i++)
|
||||||
|
{
|
||||||
|
seriesHig.Add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = minShowDataNumber; i < maxCount; i++)
|
for (int i = minShowDataNumber; i < maxCount; i++)
|
||||||
{
|
{
|
||||||
if (!seriesHig.ContainsKey(i))
|
if (i >= seriesHig.Count)
|
||||||
{
|
{
|
||||||
seriesHig[i] = 0;
|
seriesHig.Add(0);
|
||||||
}
|
}
|
||||||
float value = serie.yData[i];
|
float value = serie.yData[i];
|
||||||
float pY = startY + i * scaleWid;
|
float pY = startY + i * scaleWid;
|
||||||
@@ -441,13 +436,13 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else if (m_Line.smooth)
|
else if (m_Line.smooth)
|
||||||
{
|
{
|
||||||
var list = ChartHelper.GetBezierListVertical(lp, np, m_Line.smoothStyle);
|
ChartHelper.GetBezierListVertical(ref smoothSegmentPoints,lp, np, m_Line.smoothStyle);
|
||||||
Vector3 start, to;
|
Vector3 start, to;
|
||||||
start = list[0];
|
start = smoothSegmentPoints[0];
|
||||||
for (int k = 1; k < list.Length; k++)
|
for (int k = 1; k < smoothSegmentPoints.Count; k++)
|
||||||
{
|
{
|
||||||
smoothPoints.Add(list[k]);
|
smoothPoints.Add(smoothSegmentPoints[k]);
|
||||||
to = list[k];
|
to = smoothSegmentPoints[k];
|
||||||
ChartHelper.DrawLine(vh, start, to, m_Line.tickness, color);
|
ChartHelper.DrawLine(vh, start, to, m_Line.tickness, color);
|
||||||
|
|
||||||
if (m_Line.area)
|
if (m_Line.area)
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
HashSet<string> serieNameSet = new HashSet<string>();
|
||||||
protected override void DrawChart(VertexHelper vh)
|
protected override void DrawChart(VertexHelper vh)
|
||||||
{
|
{
|
||||||
base.DrawChart(vh);
|
base.DrawChart(vh);
|
||||||
@@ -89,7 +90,7 @@ namespace XCharts
|
|||||||
float dataTotal = GetDataTotal();
|
float dataTotal = GetDataTotal();
|
||||||
float dataMax = GetDataMax();
|
float dataMax = GetDataMax();
|
||||||
m_AngleList.Clear();
|
m_AngleList.Clear();
|
||||||
HashSet<string> serieNameSet = new HashSet<string>();
|
serieNameSet.Clear();
|
||||||
int serieNameCount = -1;
|
int serieNameCount = -1;
|
||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ namespace XCharts
|
|||||||
InitIndicator();
|
InitIndicator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashSet<string> serieNameSet = new HashSet<string>();
|
||||||
private void DrawData(VertexHelper vh)
|
private void DrawData(VertexHelper vh)
|
||||||
{
|
{
|
||||||
int indicatorNum = m_Radar.indicatorList.Count;
|
int indicatorNum = m_Radar.indicatorList.Count;
|
||||||
@@ -170,7 +171,7 @@ namespace XCharts
|
|||||||
Vector3 firstPoint = Vector3.zero;
|
Vector3 firstPoint = Vector3.zero;
|
||||||
dataPosList.Clear();
|
dataPosList.Clear();
|
||||||
dataPosList.Capacity = m_Series.Count;
|
dataPosList.Capacity = m_Series.Count;
|
||||||
HashSet<string> serieNameSet = new HashSet<string>();
|
serieNameSet.Clear();
|
||||||
int serieNameCount = -1;
|
int serieNameCount = -1;
|
||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
31
Scripts/UI/Utility/ChartCached.cs
Normal file
31
Scripts/UI/Utility/ChartCached.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace XCharts
|
||||||
|
{
|
||||||
|
public static class ChartCached
|
||||||
|
{
|
||||||
|
private static Dictionary<float, string> s_ValueToF1Str = new Dictionary<float, string>(1000);
|
||||||
|
private static Dictionary<float, string> s_ValueToF2Str = new Dictionary<float, string>(1000);
|
||||||
|
private static Dictionary<float, string> s_ValueToStr = new Dictionary<float, string>(1000);
|
||||||
|
|
||||||
|
public static string FloatToStr(float value, int f = 0)
|
||||||
|
{
|
||||||
|
Dictionary<float, string> valueDic;
|
||||||
|
if (f == 1) valueDic = s_ValueToF1Str;
|
||||||
|
else if (f == 2) valueDic = s_ValueToF2Str;
|
||||||
|
else valueDic = s_ValueToStr;
|
||||||
|
if (valueDic.ContainsKey(value))
|
||||||
|
{
|
||||||
|
return valueDic[value];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (f == 1) valueDic[value] = value.ToString("f1");
|
||||||
|
else if (f == 2) valueDic[value] = value.ToString("f2");
|
||||||
|
else valueDic[value] = value.ToString();
|
||||||
|
return valueDic[value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Scripts/UI/Utility/ChartCached.cs.meta
Normal file
11
Scripts/UI/Utility/ChartCached.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ea8a302478efd4de2a300f503267d966
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -325,8 +325,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void GetBezierList(ref List<Vector3> posList,Vector3 sp, Vector3 ep, float k = 2.0f)
|
||||||
public static Vector3[] GetBezierList(Vector3 sp, Vector3 ep, float k = 2.0f)
|
|
||||||
{
|
{
|
||||||
Vector3 dir = (ep - sp).normalized;
|
Vector3 dir = (ep - sp).normalized;
|
||||||
float dist = Vector3.Distance(sp, ep);
|
float dist = Vector3.Distance(sp, ep);
|
||||||
@@ -335,10 +334,10 @@ namespace XCharts
|
|||||||
cp1.y = sp.y;
|
cp1.y = sp.y;
|
||||||
cp2.y = ep.y;
|
cp2.y = ep.y;
|
||||||
int segment = (int)(dist / 0.3f);
|
int segment = (int)(dist / 0.3f);
|
||||||
return GetBezierList2(sp, ep, segment, cp1, cp2);
|
GetBezierList2(ref posList,sp, ep, segment, cp1, cp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3[] GetBezierListVertical(Vector3 sp, Vector3 ep, float k = 2.0f)
|
public static void GetBezierListVertical(ref List<Vector3> posList,Vector3 sp, Vector3 ep, float k = 2.0f)
|
||||||
{
|
{
|
||||||
Vector3 dir = (ep - sp).normalized;
|
Vector3 dir = (ep - sp).normalized;
|
||||||
float dist = Vector3.Distance(sp, ep);
|
float dist = Vector3.Distance(sp, ep);
|
||||||
@@ -347,7 +346,7 @@ namespace XCharts
|
|||||||
cp1.y = sp.y;
|
cp1.y = sp.y;
|
||||||
cp2.y = ep.y;
|
cp2.y = ep.y;
|
||||||
int segment = (int)(dist / 0.3f);
|
int segment = (int)(dist / 0.3f);
|
||||||
return GetBezierList2(sp, ep, segment, cp2, cp1);
|
GetBezierList2(ref posList,sp, ep, segment, cp2, cp1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)
|
public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)
|
||||||
@@ -361,16 +360,18 @@ namespace XCharts
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3[] GetBezierList2(Vector3 sp, Vector3 ep, int segment, Vector3 cp,
|
public static void GetBezierList2(ref List<Vector3> posList,Vector3 sp, Vector3 ep, int segment, Vector3 cp,
|
||||||
Vector3 cp2)
|
Vector3 cp2)
|
||||||
{
|
{
|
||||||
Vector3[] list = new Vector3[segment + 1];
|
posList.Clear();
|
||||||
|
if(posList.Capacity < segment + 1){
|
||||||
|
posList.Capacity = segment +1;
|
||||||
|
}
|
||||||
for (int i = 0; i < segment; i++)
|
for (int i = 0; i < segment; i++)
|
||||||
{
|
{
|
||||||
list[i] = (GetBezier2(i / (float)segment, sp, cp, cp2, ep));
|
posList.Add((GetBezier2(i / (float)segment, sp, cp, cp2, ep))) ;
|
||||||
}
|
}
|
||||||
list[segment] = ep;
|
posList.Add(ep);
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 GetBezier(float t, Vector3 sp, Vector3 cp, Vector3 ep)
|
public static Vector3 GetBezier(float t, Vector3 sp, Vector3 cp, Vector3 ep)
|
||||||
|
|||||||
Reference in New Issue
Block a user