2019-10-22 04:09:04 +08:00
|
|
|
|
/******************************************/
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/* Copyright (c) 2018 monitor1394 */
|
|
|
|
|
|
/* https://github.com/monitor1394 */
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/******************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-15 06:52:40 +08:00
|
|
|
|
namespace XCharts.Examples
|
2019-10-22 04:09:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
[DisallowMultipleComponent]
|
|
|
|
|
|
[ExecuteInEditMode]
|
2020-05-15 06:52:40 +08:00
|
|
|
|
public class Example12_CustomDrawing : MonoBehaviour
|
2019-10-22 04:09:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
LineChart chart;
|
|
|
|
|
|
void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
chart = gameObject.GetComponent<LineChart>();
|
|
|
|
|
|
if (chart == null) return;
|
|
|
|
|
|
|
2020-05-16 20:33:01 +08:00
|
|
|
|
chart.onCustomDraw = delegate (VertexHelper vh)
|
2019-10-22 04:09:04 +08:00
|
|
|
|
{
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|