3.0 - unitypackage

This commit is contained in:
monitor1394
2022-01-05 21:40:48 +08:00
parent c160867765
commit 228a4b2840
846 changed files with 105 additions and 467693 deletions

View File

@@ -0,0 +1,48 @@

using UnityEngine;
using UnityEngine.UI;
using XUGL;
namespace XCharts.Example
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example12_CustomDrawing : MonoBehaviour
{
LineChart chart;
void Awake()
{
chart = gameObject.GetComponent<LineChart>();
if (chart == null) return;
chart.onCustomDraw = delegate (VertexHelper vh)
{
};
// or
chart.onCustomDrawBeforeSerie = delegate (VertexHelper vh, Serie serie)
{
};
// or
chart.onCustomDrawAfterSerie = delegate (VertexHelper vh, Serie serie)
{
if (serie.index != 0) return;
var dataPoints = serie.context.dataPoints;
if (dataPoints.Count > 0)
{
var pos = dataPoints[3];
var grid = chart.GetChartComponent<GridCoord>();
var zeroPos = new Vector3(grid.context.x, grid.context.y);
var startPos = new Vector3(pos.x, zeroPos.y);
var endPos = new Vector3(pos.x, zeroPos.y + grid.context.height);
UGL.DrawLine(vh, startPos, endPos, chart.theme.serie.lineWidth, Color.blue);
UGL.DrawCricle(vh, pos, 5, Color.blue);
}
};
// or
chart.onCustomDrawTop = delegate (VertexHelper vh)
{
};
}
}
}