mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-29 12:48:47 +00:00
3.0
This commit is contained in:
@@ -35,7 +35,6 @@ namespace XCharts.Runtime
|
|||||||
animationType = serieType.GetAttribute<DefaultAnimationAttribute>().type;
|
animationType = serieType.GetAttribute<DefaultAnimationAttribute>().type;
|
||||||
}
|
}
|
||||||
UpdateAnimationType(serie.animation, animationType);
|
UpdateAnimationType(serie.animation, animationType);
|
||||||
serie.animation.context.isAllItemAnimationEnd = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType)
|
public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType)
|
||||||
|
|||||||
@@ -767,7 +767,6 @@ namespace XCharts
|
|||||||
var current = orient == Orient.Horizonal
|
var current = orient == Orient.Horizonal
|
||||||
? startX
|
? startX
|
||||||
: startY;
|
: startY;
|
||||||
|
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, axis.IsTime() ? i : i + 1, dataZoom);
|
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, axis.IsTime() ? i : i + 1, dataZoom);
|
||||||
@@ -803,17 +802,17 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (orient == Orient.Horizonal)
|
if (orient == Orient.Horizonal)
|
||||||
{
|
{
|
||||||
if (relativedAxis == null || MathUtil.Approximately(current, relativedAxis.context.x))
|
if (relativedAxis == null || !MathUtil.Approximately(current, relativedAxis.context.x))
|
||||||
ChartDrawer.DrawLineStyle(vh,
|
ChartDrawer.DrawLineStyle(vh,
|
||||||
lineType,
|
lineType,
|
||||||
lineWidth,
|
lineWidth,
|
||||||
new Vector3(current, startY),
|
new Vector3(current, startY),
|
||||||
new Vector3(current, startY + splitLength),
|
new Vector3(current, startY + splitLength),
|
||||||
lineColor);
|
lineColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (relativedAxis == null || MathUtil.Approximately(current, relativedAxis.context.y))
|
if (relativedAxis == null || !MathUtil.Approximately(current, relativedAxis.context.y))
|
||||||
ChartDrawer.DrawLineStyle(vh,
|
ChartDrawer.DrawLineStyle(vh,
|
||||||
lineType,
|
lineType,
|
||||||
lineWidth,
|
lineWidth,
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace XCharts.Runtime
|
|||||||
public void InsertSerie(Serie serie, int index = -1, bool addToHead = false)
|
public void InsertSerie(Serie serie, int index = -1, bool addToHead = false)
|
||||||
{
|
{
|
||||||
serie.AnimationRestart();
|
serie.AnimationRestart();
|
||||||
|
AnimationStyleHelper.UpdateSerieAnimation(serie);
|
||||||
if (addToHead) m_Series.Insert(0, serie);
|
if (addToHead) m_Series.Insert(0, serie);
|
||||||
else if (index >= 0) m_Series.Insert(index, serie);
|
else if (index >= 0) m_Series.Insert(index, serie);
|
||||||
else m_Series.Add(serie);
|
else m_Series.Add(serie);
|
||||||
@@ -180,7 +181,7 @@ namespace XCharts.Runtime
|
|||||||
var index = m_Series.IndexOf(oldSerie);
|
var index = m_Series.IndexOf(oldSerie);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return false;
|
return false;
|
||||||
|
AnimationStyleHelper.UpdateSerieAnimation(newSerie);
|
||||||
oldSerie.OnRemove();
|
oldSerie.OnRemove();
|
||||||
m_Series.RemoveAt(index);
|
m_Series.RemoveAt(index);
|
||||||
m_Series.Insert(index, newSerie);
|
m_Series.Insert(index, newSerie);
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
m_Theme.sharedTheme = XCThemeMgr.GetTheme(ThemeType.Default);
|
m_Theme.sharedTheme = XCThemeMgr.GetTheme(ThemeType.Default);
|
||||||
}
|
}
|
||||||
if (m_CheckTheme != m_Theme.themeType)
|
if (m_Theme.sharedTheme != null && m_CheckTheme != m_Theme.themeType)
|
||||||
{
|
{
|
||||||
m_CheckTheme = m_Theme.themeType;
|
m_CheckTheme = m_Theme.themeType;
|
||||||
m_Theme.sharedTheme.CopyTheme(m_CheckTheme);
|
m_Theme.sharedTheme.CopyTheme(m_CheckTheme);
|
||||||
@@ -536,7 +536,8 @@ namespace XCharts.Runtime
|
|||||||
serie.context.colorIndex = GetLegendRealShowNameIndex(serie.legendName);
|
serie.context.colorIndex = GetLegendRealShowNameIndex(serie.legendName);
|
||||||
serie.context.dataPoints.Clear();
|
serie.context.dataPoints.Clear();
|
||||||
serie.context.dataIgnores.Clear();
|
serie.context.dataIgnores.Clear();
|
||||||
AnimationStyleHelper.UpdateSerieAnimation(serie);
|
serie.animation.context.isAllItemAnimationEnd = true;
|
||||||
|
|
||||||
if (m_OnDrawSerieBefore != null)
|
if (m_OnDrawSerieBefore != null)
|
||||||
{
|
{
|
||||||
m_OnDrawSerieBefore.Invoke(vh, serie);
|
m_OnDrawSerieBefore.Invoke(vh, serie);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace XUGL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth)
|
public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth, bool closepath = false)
|
||||||
{
|
{
|
||||||
for (int i = points.Count - 1; i >= 1; i--)
|
for (int i = points.Count - 1; i >= 1; i--)
|
||||||
{
|
{
|
||||||
@@ -146,6 +146,10 @@ namespace XUGL
|
|||||||
var ibp = Vector3.zero;
|
var ibp = Vector3.zero;
|
||||||
var ctp = Vector3.zero;
|
var ctp = Vector3.zero;
|
||||||
var cbp = Vector3.zero;
|
var cbp = Vector3.zero;
|
||||||
|
if (closepath && !UGLHelper.IsValueEqualsVector3(points[points.Count - 1], points[0]))
|
||||||
|
{
|
||||||
|
points.Add(points[0]);
|
||||||
|
}
|
||||||
for (int i = 1; i < points.Count - 1; i++)
|
for (int i = 1; i < points.Count - 1; i++)
|
||||||
{
|
{
|
||||||
bool bitp = true, bibp = true;
|
bool bitp = true, bibp = true;
|
||||||
@@ -1806,5 +1810,71 @@ namespace XUGL
|
|||||||
{
|
{
|
||||||
SVG.DrawPath(vh, path);
|
SVG.DrawPath(vh, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness = 1)
|
||||||
|
{
|
||||||
|
DrawEllipse(vh, center, w, h, color, smoothness, 0, s_ClearColor32, 0, 360);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness,
|
||||||
|
float borderWidth, Color32 borderColor,
|
||||||
|
float startAngle, float endAngle)
|
||||||
|
{
|
||||||
|
startAngle = (startAngle + 360) % 360;
|
||||||
|
endAngle = (endAngle + 360) % 360;
|
||||||
|
if (endAngle < startAngle)
|
||||||
|
endAngle += 360;
|
||||||
|
if (endAngle <= startAngle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var angle = startAngle;
|
||||||
|
var lp = Vector2.zero;
|
||||||
|
var fill = color.a != 0;
|
||||||
|
var border = borderWidth != 0 && borderColor.a != 0;
|
||||||
|
if (!fill && !border)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var startTriangleIndex = vh.currentVertCount;
|
||||||
|
if (fill)
|
||||||
|
{
|
||||||
|
vh.AddVert(center, color, Vector2.zero);
|
||||||
|
}
|
||||||
|
if (smoothness < 0.5f)
|
||||||
|
smoothness = 0.5f;
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
while (angle <= endAngle)
|
||||||
|
{
|
||||||
|
var rad = angle * Mathf.Deg2Rad;
|
||||||
|
var x = center.x + w * Mathf.Cos(rad);
|
||||||
|
var y = center.y + h * Mathf.Sin(rad);
|
||||||
|
var p1 = new Vector3(x, y);
|
||||||
|
vh.AddVert(p1, color, Vector2.zero);
|
||||||
|
if (border)
|
||||||
|
{
|
||||||
|
var dire = (p1 - center).normalized;
|
||||||
|
var diff = dire * borderWidth;
|
||||||
|
var p2 = p1 + diff;
|
||||||
|
vh.AddVert(p1, borderColor, Vector2.zero);
|
||||||
|
vh.AddVert(p2, borderColor, Vector2.zero);
|
||||||
|
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
var index = startTriangleIndex + i * 3 + 2;
|
||||||
|
vh.AddTriangle(index - 3, index + 1, index - 2);
|
||||||
|
vh.AddTriangle(index - 3, index, index + 1);
|
||||||
|
if (fill)
|
||||||
|
vh.AddTriangle(startTriangleIndex, index - 1, index - 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (i > 0 && fill)
|
||||||
|
{
|
||||||
|
var index = startTriangleIndex + i;
|
||||||
|
vh.AddTriangle(startTriangleIndex, index + 1, index);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
angle += smoothness;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user