mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
3.0
This commit is contained in:
35
Examples/Example50_Scatter.cs
Normal file
35
Examples/Example50_Scatter.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
public class Example50_Scatter : MonoBehaviour
|
||||
{
|
||||
private ScatterChart chart;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponent<ScatterChart>();
|
||||
if (chart == null) return;
|
||||
foreach (var serie in chart.series)
|
||||
{
|
||||
serie.symbol.sizeFunction = SymbolSize;
|
||||
serie.symbol.selectedSizeFunction = 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user