2021-11-23 13:20:07 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
2022-02-19 22:37:57 +08:00
|
|
|
namespace XCharts.Runtime
|
2021-11-23 13:20:07 +08:00
|
|
|
{
|
2024-01-13 22:37:13 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// Scatter chart is mainly used to show the relationship between two data dimensions.
|
|
|
|
|
/// || 散点图主要用于展现两个数据维度之间的关系。
|
|
|
|
|
/// </summary>
|
2021-11-23 13:20:07 +08:00
|
|
|
[AddComponentMenu("XCharts/ScatterChart", 17)]
|
|
|
|
|
[ExecuteInEditMode]
|
|
|
|
|
[RequireComponent(typeof(RectTransform))]
|
|
|
|
|
[DisallowMultipleComponent]
|
2023-06-04 21:52:23 +08:00
|
|
|
[HelpURL("https://xcharts-team.github.io/docs/configuration")]
|
2021-11-23 13:20:07 +08:00
|
|
|
public class ScatterChart : BaseChart
|
|
|
|
|
{
|
2022-03-20 18:52:50 +08:00
|
|
|
protected override void DefaultChart()
|
2021-11-23 13:20:07 +08:00
|
|
|
{
|
2023-09-01 08:01:27 +08:00
|
|
|
EnsureChartComponent<GridCoord>();
|
2021-11-23 13:20:07 +08:00
|
|
|
|
2023-02-12 21:22:53 +08:00
|
|
|
var xAxis = EnsureChartComponent<XAxis>();
|
2022-03-20 18:52:50 +08:00
|
|
|
xAxis.type = Axis.AxisType.Value;
|
2021-11-23 13:20:07 +08:00
|
|
|
xAxis.boundaryGap = false;
|
|
|
|
|
|
2023-02-12 21:22:53 +08:00
|
|
|
var yAxis = EnsureChartComponent<YAxis>();
|
2022-03-20 18:52:50 +08:00
|
|
|
yAxis.type = Axis.AxisType.Value;
|
2021-11-23 13:20:07 +08:00
|
|
|
yAxis.boundaryGap = false;
|
|
|
|
|
|
|
|
|
|
RemoveData();
|
|
|
|
|
Scatter.AddDefaultSerie(this, GenerateDefaultSerieName());
|
|
|
|
|
}
|
2024-01-13 22:37:13 +08:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// default bubble chart.
|
|
|
|
|
/// || 默认气泡图。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void DefaultBubbleChart()
|
|
|
|
|
{
|
|
|
|
|
CheckChartInit();
|
|
|
|
|
var serie = GetSerie(0);
|
|
|
|
|
serie.itemStyle.borderWidth = 2f;
|
|
|
|
|
serie.itemStyle.borderColor = theme.GetColor(0);
|
|
|
|
|
serie.itemStyle.opacity = 0.35f;
|
|
|
|
|
serie.symbol.sizeType = SymbolSizeType.FromData;
|
|
|
|
|
serie.symbol.dataScale = 0.3f;
|
|
|
|
|
serie.symbol.maxSize = 30f;
|
|
|
|
|
}
|
2021-11-23 13:20:07 +08:00
|
|
|
}
|
2022-05-22 22:17:38 +08:00
|
|
|
}
|