Files
XCharts/Examples/Runtime/Example50_Scatter.cs

36 lines
871 B
C#
Raw Normal View History

2021-12-24 13:33:09 +08:00

using System;
using System.Collections.Generic;
using UnityEngine;
2022-02-19 22:37:57 +08:00
using XCharts.Runtime;
2021-12-24 13:33:09 +08:00
namespace XCharts.Example
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example50_Scatter : MonoBehaviour
{
private ScatterChart chart;
void Awake()
{
chart = gameObject.GetComponent<ScatterChart>();
if (chart == null) return;
2021-11-23 13:20:07 +08:00
foreach (var serie in chart.series)
{
serie.symbol.sizeCallback = SymbolSize;
serie.symbol.selectedSizeCallback = SymbolSelectedSize;
}
}
float SymbolSize(List<double> data)
{
return (float)(Math.Sqrt(data[2]) / 6e2);
}
float SymbolSelectedSize(List<double> data)
{
return (float)(Math.Sqrt(data[2]) / 5e2);
}
}
}