优化内置的示例代码,Demo改名为Example

This commit is contained in:
monitor1394
2020-05-15 06:52:40 +08:00
parent 0b8c7a1b2c
commit e371e079f2
50 changed files with 175 additions and 174 deletions

View File

@@ -0,0 +1,39 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEngine;
using UnityEngine.UI;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example12_CustomDrawing : MonoBehaviour
{
LineChart chart;
void Awake()
{
chart = gameObject.GetComponent<LineChart>();
if (chart == null) return;
chart.customDrawCallback = delegate (VertexHelper vh)
{
var dataPoints = chart.series.list[0].dataPoints;
if (dataPoints.Count > 0)
{
var pos = dataPoints[3];
var zeroPos = new Vector3(chart.coordinateX, chart.coordinateY);
var startPos = new Vector3(pos.x, zeroPos.y);
var endPos = new Vector3(pos.x, zeroPos.y + chart.coordinateHeight);
ChartDrawer.DrawLine(vh, startPos, endPos, 1, Color.blue);
ChartDrawer.DrawCricle(vh, pos, 5, Color.blue);
}
};
}
}
}