mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
3.0 - optimize vert
This commit is contained in:
@@ -4,7 +4,7 @@ using UnityEngine;
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
//[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(BaseChart))]
|
||||
public class Example_LargeData : MonoBehaviour
|
||||
{
|
||||
@@ -25,21 +25,25 @@ namespace XCharts.Example
|
||||
chart.GetChartComponent<Title>().text = maxCacheDataNumber + "数据";
|
||||
}
|
||||
|
||||
private double lastValue = 0d;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (initCount < maxCacheDataNumber)
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
initCount++;
|
||||
if (initCount > maxCacheDataNumber) break;
|
||||
chart.GetChartComponent<Title>().text = initCount + "数据";
|
||||
|
||||
timeNow = timeNow.AddSeconds(1);
|
||||
float xvalue = Mathf.PI / 180 * initCount;
|
||||
float yvalue = Mathf.Sin(xvalue);
|
||||
|
||||
chart.AddData(0, 15 + yvalue * 2);
|
||||
timeNow = timeNow.AddSeconds(1);
|
||||
if (lastValue < 20)
|
||||
lastValue += UnityEngine.Random.Range(0, 5);
|
||||
else
|
||||
lastValue += UnityEngine.Random.Range(-5f, 5f);
|
||||
chart.AddData(0, lastValue);
|
||||
|
||||
chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace XCharts
|
||||
ref ntp, ref nbp,
|
||||
ref itp, ref ibp,
|
||||
ref clp, ref crp,
|
||||
ref bitp, ref bibp);
|
||||
ref bitp, ref bibp, i);
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
@@ -283,8 +283,16 @@ namespace XCharts
|
||||
|
||||
if (bitp == bibp)
|
||||
{
|
||||
AddLineVertToVertexHelper(vh, itp, ibp, lineColor, isVisualMapGradient, isLineStyleGradient,
|
||||
if (bitp)
|
||||
AddLineVertToVertexHelper(vh, itp, ibp, lineColor, isVisualMapGradient, isLineStyleGradient,
|
||||
visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
|
||||
else
|
||||
{
|
||||
AddLineVertToVertexHelper(vh, ltp, clp, lineColor, isVisualMapGradient, isLineStyleGradient,
|
||||
visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
|
||||
AddLineVertToVertexHelper(vh, ltp, crp, lineColor, isVisualMapGradient, isLineStyleGradient,
|
||||
visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XUGL;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
|
||||
@@ -1360,7 +1360,7 @@ namespace XUGL
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTriangle(vh, realCenter, p2, p3, toColor, color, color);
|
||||
AddVertToVertexHelper(vh, p3, realCenter, color, toColor, i > 0);
|
||||
}
|
||||
p2 = p3;
|
||||
|
||||
@@ -1628,19 +1628,28 @@ namespace XUGL
|
||||
center.y + outsideRadius * Mathf.Cos(currAngle));
|
||||
p4 = new Vector3(center.x + insideRadius * Mathf.Sin(currAngle),
|
||||
center.y + insideRadius * Mathf.Cos(currAngle));
|
||||
if (!UGLHelper.IsClearColor(emptyColor)) DrawTriangle(vh, center, p1, p4, emptyColor);
|
||||
if (isGradient)
|
||||
{
|
||||
var tcolor = Color32.Lerp(color, toColor, i * 1.0f / segments);
|
||||
DrawQuadrilateral(vh, p2, p3, p4, p1, tcolor, tcolor);
|
||||
AddVertToVertexHelper(vh, p3, p4, tcolor, tcolor, i > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawQuadrilateral(vh, p2, p3, p4, p1, color, color);
|
||||
AddVertToVertexHelper(vh, p3, p4, color, color, i > 0);
|
||||
}
|
||||
p1 = p4;
|
||||
p2 = p3;
|
||||
}
|
||||
if (!UGLHelper.IsClearColor(emptyColor))
|
||||
{
|
||||
for (int i = 0; i <= segments; i++)
|
||||
{
|
||||
float currAngle = realStartInAngle + i * segmentAngle;
|
||||
p4 = new Vector3(center.x + insideRadius * Mathf.Sin(currAngle),
|
||||
center.y + insideRadius * Mathf.Cos(currAngle));
|
||||
AddVertToVertexHelper(vh, center, p4, emptyColor, emptyColor, i > 0);
|
||||
}
|
||||
}
|
||||
if (needBorder || needSpace || roundCap)
|
||||
{
|
||||
if (clockwise)
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace XUGL
|
||||
ref Vector3 ntp, ref Vector3 nbp,
|
||||
ref Vector3 itp, ref Vector3 ibp,
|
||||
ref Vector3 clp, ref Vector3 crp,
|
||||
ref bool bitp, ref bool bibp
|
||||
ref bool bitp, ref bool bibp, int debugIndex = 0
|
||||
)
|
||||
{
|
||||
var dir1 = (cp - lp).normalized;
|
||||
@@ -319,6 +319,12 @@ namespace XUGL
|
||||
crp = cp + dir2v * width;
|
||||
bibp = false;
|
||||
}
|
||||
if (bitp == false && bibp == false && cp == np)
|
||||
{
|
||||
ltp = cp - dir1v * width;
|
||||
clp = cp + dir1v * width;
|
||||
crp = cp + dir1v * width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user