XCharts 2.0

This commit is contained in:
monitor1394
2021-01-11 08:54:28 +08:00
parent ed8d0687f7
commit 489095865d
304 changed files with 14799 additions and 12503 deletions

View File

@@ -1,9 +1,9 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
using System;

View File

@@ -1,14 +1,15 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
using System.Collections.Generic;
using System;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace XCharts
{
@@ -37,24 +38,26 @@ namespace XCharts
}
}
/// <summary>
/// The theme info.
/// The theme.
/// </summary>
public ThemeInfo themeInfo { get { return m_ThemeInfo; } set { m_ThemeInfo = value; } }
public ChartTheme theme { get { return m_Theme; } set { m_Theme = value; } }
/// <summary>
/// The title setting of chart.
/// 标题组件
/// </summary>
public Title title { get { return m_Title; } }
public Title title { get { return m_Titles.Count > 0 ? m_Titles[0] : null; } }
public List<Title> titles { get { return m_Titles; } }
/// <summary>
/// The legend setting of chart.
/// 图例组件
/// </summary>
public Legend legend { get { return m_Legend; } }
public Legend legend { get { return m_Legends.Count > 0 ? m_Legends[0] : null; } }
public List<Legend> legends { get { return m_Legends; } }
/// <summary>
/// The tooltip setting of chart.
/// 提示框组件
/// </summary>
public Tooltip tooltip { get { return m_Tooltip; } }
public Tooltip tooltip { get { return m_Tooltips.Count > 0 ? m_Tooltips[0] : null; } }
/// <summary>
/// The series setting of chart.
/// 系列列表
@@ -85,6 +88,10 @@ namespace XCharts
/// 图表的高
/// </summary>
public float chartHeight { get { return m_ChartHeight; } }
public Vector2 chartMinAnchor { get { return m_ChartMinAnchor; } }
public Vector2 chartMaxAnchor { get { return m_ChartMaxAnchor; } }
public Vector2 chartPivot { get { return m_ChartPivot; } }
public Vector2 chartSizeDelta { get { return m_ChartSizeDelta; } }
/// <summary>
/// The position of chart.
/// 图表的左下角起始坐标。
@@ -96,6 +103,11 @@ namespace XCharts
/// 自定义绘制回调。
/// </summary>
public Action<VertexHelper> onCustomDraw { set { m_OnCustomDrawCallback = value; } }
/// <summary>
/// the callback function of click pie area.
/// 点击饼图区域回调。参数PointerEventDataSerieIndexSerieDataIndex
/// </summary>
public Action<PointerEventData, int, int> onPointerClickPie { set { m_OnPointerClickPie = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerClickPie; } }
/// <summary>
/// Redraw chart in next frame.
@@ -104,6 +116,7 @@ namespace XCharts
public void RefreshChart()
{
m_RefreshChart = true;
if (m_Painter) m_Painter.Refresh();
}
/// <summary>
@@ -114,8 +127,8 @@ namespace XCharts
public virtual void ClearData()
{
m_Series.ClearData();
m_Legend.ClearData();
m_Tooltip.ClearValue();
foreach (var legend in m_Legends) legend.ClearData();
tooltip.ClearValue();
m_CheckAnimation = false;
m_ReinitLabel = true;
RefreshChart();
@@ -128,9 +141,10 @@ namespace XCharts
/// </summary>
public virtual void RemoveData()
{
m_Legend.ClearData();
foreach (var legend in m_Legends) legend.ClearData();
foreach (var radar in m_Radars) radar.indicatorList.Clear();
m_Series.RemoveAll();
m_Tooltip.ClearValue();
tooltip.ClearValue();
m_CheckAnimation = false;
m_ReinitLabel = true;
m_SerieLabelRoot = null;
@@ -145,7 +159,7 @@ namespace XCharts
public virtual void RemoveData(string serieName)
{
m_Series.Remove(serieName);
m_Legend.RemoveData(serieName);
foreach (var legend in m_Legends) legend.RemoveData(serieName);
m_SerieLabelRoot = null;
RefreshChart();
}
@@ -182,7 +196,7 @@ namespace XCharts
{
RefreshLabel();
}
RefreshChart();
RefreshPainter(serie);
}
return serieData;
}
@@ -205,7 +219,7 @@ namespace XCharts
{
RefreshLabel();
}
RefreshChart();
RefreshPainter(serie);
}
return serieData;
}
@@ -228,7 +242,7 @@ namespace XCharts
{
RefreshLabel();
}
RefreshChart();
RefreshPainter(serie);
}
return serieData;
}
@@ -251,7 +265,7 @@ namespace XCharts
{
RefreshLabel();
}
RefreshChart();
RefreshPainter(serie);
}
return serieData;
}
@@ -275,7 +289,7 @@ namespace XCharts
{
RefreshLabel();
}
RefreshChart();
RefreshPainter(serie);
}
return serieData;
}
@@ -299,7 +313,7 @@ namespace XCharts
{
RefreshLabel();
}
RefreshChart();
RefreshPainter(serie);
}
return serieData;
}
@@ -315,7 +329,7 @@ namespace XCharts
{
if (m_Series.UpdateData(serieName, dataIndex, value))
{
RefreshChart();
RefreshPainter(m_Series.GetSerie(serieName));
return true;
}
return false;
@@ -332,7 +346,7 @@ namespace XCharts
{
if (m_Series.UpdateData(serieIndex, dataIndex, value))
{
RefreshChart();
RefreshPainter(m_Series.GetSerie(serieIndex));
return true;
}
return false;
@@ -348,7 +362,7 @@ namespace XCharts
{
if (m_Series.UpdateData(serieName, dataIndex, multidimensionalData))
{
RefreshChart();
RefreshPainter(m_Series.GetSerie(serieName));
return true;
}
return false;
@@ -364,7 +378,7 @@ namespace XCharts
{
if (m_Series.UpdateData(serieIndex, dataIndex, multidimensionalData))
{
RefreshChart();
RefreshPainter(m_Series.GetSerie(serieIndex));
return true;
}
return false;
@@ -381,7 +395,7 @@ namespace XCharts
{
if (m_Series.UpdateData(serieName, dataIndex, dimension, value))
{
RefreshChart();
RefreshPainter(m_Series.GetSerie(serieName));
return true;
}
return false;
@@ -398,7 +412,7 @@ namespace XCharts
{
if (m_Series.UpdateData(serieIndex, dataIndex, dimension, value))
{
RefreshChart();
RefreshPainter(m_Series.GetSerie(serieIndex));
return true;
}
return false;
@@ -459,15 +473,18 @@ namespace XCharts
}
}
protected virtual void UpdateLegendColor(string legendName, bool active)
internal virtual void UpdateLegendColor(string legendName, bool active)
{
var legendIndex = m_LegendRealShowName.IndexOf(legendName);
if (legendIndex >= 0)
{
var iconColor = LegendHelper.GetIconColor(legend, legendIndex, m_ThemeInfo, m_Series, legendName, active);
var contentColor = LegendHelper.GetContentColor(legend, m_ThemeInfo, active);
m_Legend.UpdateButtonColor(legendName, iconColor);
m_Legend.UpdateContentColor(legendName, contentColor);
foreach (var legend in m_Legends)
{
var iconColor = LegendHelper.GetIconColor(legend, legendIndex, m_Theme, m_Series, legendName, active);
var contentColor = LegendHelper.GetContentColor(legend, m_Theme, active);
legend.UpdateButtonColor(legendName, iconColor);
legend.UpdateContentColor(legendName, contentColor);
}
}
}
@@ -541,25 +558,28 @@ namespace XCharts
/// <summary>
/// Update chart theme.
/// 切换图表主题。
/// 切换内置主题。
/// </summary>
/// <param name="theme">theme</param>
public void UpdateTheme(Theme theme)
public bool UpdateTheme(Theme theme)
{
m_ThemeInfo.theme = theme;
OnThemeChanged();
RefreshChart();
if (theme == Theme.Custom)
{
Debug.LogError("UpdateTheme: not support switch to Custom theme.");
return false;
}
m_Theme.theme = theme;
return true;
}
/// <summary>
/// Update chart theme info.
/// 切换图表主题。
/// </summary>
/// <param name="themeInfo">themeInfo</param>
public void UpdateThemeInfo(ThemeInfo themeInfo)
/// <param name="theme">theme</param>
public void UpdateTheme(ChartTheme theme)
{
m_ThemeInfo = themeInfo;
UpdateTheme(m_ThemeInfo.theme);
m_Theme.CopyTheme(theme);
}
/// <summary>
@@ -572,8 +592,6 @@ namespace XCharts
m_Series.AnimationEnable(flag);
}
/// <summary>
/// fadeIn animation.
/// 开始渐入动画。
@@ -667,46 +685,14 @@ namespace XCharts
}
}
/// <summary>
/// 是否可以开启背景组件。背景组件在chart受上层布局控制时无法开启。
/// </summary>
/// <returns></returns>
public bool CanShowBackgroundComponent()
public Vector3 GetTitlePosition(Title title)
{
return !m_IsControlledByLayout && m_Background.runtimeActive;
return chartPosition + title.location.GetPosition(chartWidth, chartHeight);
}
/// <summary>
/// 开启背景组件。背景组件在chart受上层布局控制时不适用。
/// </summary>
/// <param name="flag"></param>
public void EnableBackground(bool flag)
public bool ContainsSerie(SerieType serieType)
{
if (flag && !CanShowBackgroundComponent())
{
var msg = "The background component cannot be activated because chart is controlled by LayoutGroup,"
+ " or its parent have more than one child.";
Debug.LogError(msg);
return;
}
m_Background.show = flag;
return SeriesHelper.ContainsSerie(m_Series, serieType);
}
public Vector3 GetTitlePosition()
{
return chartPosition + m_Title.location.GetPosition(chartWidth, chartHeight);
}
[Obsolete("Use BaseChart.RefreshLabel() instead.", true)]
public void ReinitChartLabel() { }
[Obsolete("Use BaseChart.AnimationFadeIn() instead.", true)]
public void AnimationStart() { }
[Obsolete("Use BaseChart.AnimationFadeOut() instead.", true)]
public void MissAnimationStart() { }
[Obsolete("Use onCustomDraw instead.", false)]
public Action<VertexHelper> customDrawCallback { set { m_OnCustomDrawCallback = value; } }
}
}

View File

@@ -1,9 +1,9 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
using System;
@@ -17,6 +17,12 @@ namespace XCharts
/// </summary>
public partial class BaseGraph
{
/// <summary>
/// The background component.
/// 背景组件。
/// </summary>
/// <value></value>
public Background background { get { return m_Background; } }
/// <summary>
/// The x of graph.
/// 图形的X
@@ -125,6 +131,11 @@ namespace XCharts
m_RefreshChart = true;
}
public void RefreshAllComponent()
{
SetAllComponentDirty();
}
/// <summary>
/// 检测警告信息。
/// </summary>
@@ -141,6 +152,7 @@ namespace XCharts
public void RemoveChartObject()
{
ChartHelper.DestroyAllChildren(transform);
//SetAllComponentDirty();
}
}
}

View File

@@ -1,11 +1,10 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System;
using System.Collections.Generic;
using UnityEngine;
@@ -18,68 +17,48 @@ namespace XCharts
/// </summary>
public partial class CoordinateChart
{
/// <summary>
/// The lower left position x of coordinate system.
/// 坐标系的左下角坐标X。
/// </summary>
public float coordinateX { get { return m_CoordinateX; } }
/// <summary>
/// The lower left position y of coordinate system.
/// 坐标系的左下角坐标Y。
/// </summary>
public float coordinateY { get { return m_CoordinateY; } }
/// <summary>
/// the width of coordinate system。
/// 坐标系的宽。
/// </summary>
public float coordinateWidth { get { return m_CoordinateWidth; } }
/// <summary>
/// the height of coordinate system。
/// 坐标系的高。
/// </summary>
public float coordinateHeight { get { return m_CoordinateHeight; } }
/// <summary>
/// grid component.
/// 网格组件。
/// </summary>
public Grid grid { get { return m_Grid; } }
public Grid grid { get { return m_Grids.Count > 0 ? m_Grids[0] : null; } }
public List<Grid> grids { get { return m_Grids; } }
/// <summary>
/// the x axisesxAxises[0] is the first x axis, xAxises[1] is the second x axis.
/// the x AxesxAxes[0] is the first x axis, xAxes[1] is the second x axis.
/// 两个x轴。
/// </summary>
public List<XAxis> xAxises { get { return m_XAxises; } }
public List<XAxis> xAxes { get { return m_XAxes; } }
/// <summary>
/// the y axises, yAxises[0] is the first y axis, yAxises[1] is the second y axis.
/// the y Axes, yAxes[0] is the first y axis, yAxes[1] is the second y axis.
/// 两个y轴。
/// </summary>
public List<YAxis> yAxises { get { return m_YAxises; } }
public List<YAxis> yAxes { get { return m_YAxes; } }
/// <summary>
/// dataZoom component.
/// 区域缩放组件。
/// </summary>
public DataZoom dataZoom { get { return m_DataZoom; } }
public DataZoom dataZoom { get { return m_DataZooms.Count > 0 ? m_DataZooms[0] : null; } }
/// <summary>
/// visualMap component.
/// 视觉映射组件。
/// </summary>
public VisualMap visualMap { get { return m_VisualMap; } }
public VisualMap visualMap { get { return m_VisualMaps.Count > 0 ? m_VisualMaps[0] : null; } }
/// <summary>
/// X轴
/// </summary>
public XAxis xAxis0 { get { return m_XAxises[0]; } }
public XAxis xAxis0 { get { return m_XAxes.Count > 0 ? m_XAxes[0] : null; } }
/// <summary>
/// X轴
/// </summary>
public XAxis xAxis1 { get { return m_XAxises[1]; } }
public XAxis xAxis1 { get { return m_XAxes.Count > 1 ? m_XAxes[1] : null; } }
/// <summary>
/// Y轴
/// </summary>
public YAxis yAxis0 { get { return m_YAxises[0]; } }
public YAxis yAxis0 { get { return m_YAxes.Count > 0 ? m_YAxes[0] : null; } }
/// <summary>
/// Y轴
/// </summary>
public YAxis yAxis1 { get { return m_YAxises[1]; } }
public YAxis yAxis1 { get { return m_YAxes.Count > 1 ? m_YAxes[1] : null; } }
/// <summary>
@@ -105,13 +84,13 @@ namespace XCharts
}
/// <summary>
/// Remove all data of axises.
/// Remove all data of Axes.
/// 清除所有x轴和y轴的类目数据。
/// </summary>
public void ClearAxisData()
{
foreach (var item in m_XAxises) item.data.Clear();
foreach (var item in m_YAxises) item.data.Clear();
foreach (var item in m_XAxes) item.data.Clear();
foreach (var item in m_YAxes) item.data.Clear();
}
/// <summary>
@@ -122,7 +101,7 @@ namespace XCharts
/// <param name="xAxisIndex">which xAxis should category add to</param>
public void AddXAxisData(string category, int xAxisIndex = 0)
{
m_XAxises[xAxisIndex].AddData(category);
m_XAxes[xAxisIndex].AddData(category);
}
/// <summary>
@@ -133,7 +112,7 @@ namespace XCharts
/// <param name="yAxisIndex">which yAxis should category add to</param>
public void AddYAxisData(string category, int yAxisIndex = 0)
{
m_YAxises[yAxisIndex].AddData(category);
m_YAxes[yAxisIndex].AddData(category);
}
/// <summary>
@@ -142,11 +121,11 @@ namespace XCharts
/// </summary>
public bool IsValue()
{
foreach (var axis in m_XAxises)
foreach (var axis in m_XAxes)
{
if (axis.show && !axis.IsValue() && !axis.IsLog()) return false;
}
foreach (var axis in m_YAxises)
foreach (var axis in m_YAxes)
{
if (axis.show && !axis.IsValue() && !axis.IsLog()) return false;
}
@@ -158,11 +137,11 @@ namespace XCharts
/// </summary>
public bool IsCategory()
{
foreach (var axis in m_XAxises)
foreach (var axis in m_XAxes)
{
if (axis.show && !axis.IsCategory()) return false;
}
foreach (var axis in m_YAxises)
foreach (var axis in m_YAxes)
{
if (axis.show && !axis.IsCategory()) return false;
}
@@ -172,26 +151,46 @@ namespace XCharts
/// <summary>
/// 坐标是否在坐标轴内。
/// </summary>
public bool IsInCooridate(Vector2 local)
public bool IsInGrid(Grid grid, Vector2 local)
{
return IsInCooridate(local.x, local.y);
return IsInGrid(grid, local.x, local.y);
}
public bool IsInCooridate(Vector3 local)
public bool IsInGrid(Grid grid, Vector3 local)
{
return IsInCooridate(local.x, local.y);
return IsInGrid(grid, local.x, local.y);
}
public bool IsInCooridate(float x, float y)
public bool IsInGrid(Grid grid, float x, float y)
{
if (x < m_CoordinateX - 1 || x > m_CoordinateX + m_CoordinateWidth + 1 ||
y < m_CoordinateY - 1 || y > m_CoordinateY + m_CoordinateHeight + 1)
if (x < grid.runtimeX - 1 || x > grid.runtimeX + grid.runtimeWidth + 1 ||
y < grid.runtimeY - 1 || y > grid.runtimeY + grid.runtimeHeight + 1)
{
return false;
}
return true;
}
public bool IsInAnyGrid(Vector2 local)
{
foreach (var grid in m_Grids)
{
if (IsInGrid(grid, local)) return true;
}
return false;
}
public Grid GetGrid(Vector2 local)
{
for (int i = 0; i < m_Grids.Count; i++)
{
var grid = m_Grids[i];
grid.index = i;
if (IsInGrid(grid, local)) return grid;
}
return null;
}
/// <summary>
/// 在下一帧刷新DataZoom
/// </summary>
@@ -208,16 +207,16 @@ namespace XCharts
CheckMinMaxValue();
}
public Vector3 ClampInCoordinate(Vector3 pos)
public Vector3 ClampInGrid(Grid grid, Vector3 pos)
{
if (IsInCooridate(pos)) return pos;
if (IsInGrid(grid, pos)) return pos;
else
{
// var pos = new Vector3(pos.x, pos.y);
if (pos.x < m_CoordinateX) pos.x = m_CoordinateX;
if (pos.x > m_CoordinateX + m_CoordinateWidth) pos.x = m_CoordinateX + m_CoordinateWidth;
if (pos.y < m_CoordinateY) pos.y = m_CoordinateY;
if (pos.y > m_CoordinateY + m_CoordinateHeight) pos.y = m_CoordinateY + m_CoordinateHeight;
if (pos.x < grid.runtimeX) pos.x = grid.runtimeX;
if (pos.x > grid.runtimeX + grid.runtimeWidth) pos.x = grid.runtimeX + grid.runtimeWidth;
if (pos.y < grid.runtimeY) pos.y = grid.runtimeY;
if (pos.y > grid.runtimeY + grid.runtimeHeight) pos.y = grid.runtimeY + grid.runtimeHeight;
return pos;
}
}
@@ -230,10 +229,10 @@ namespace XCharts
{
if (index >= 0 && index <= 1)
{
var xAxis = m_XAxises[index];
var yAxis = m_YAxises[index];
var tempX = m_XAxises[index].Clone();
xAxis.Copy(m_YAxises[index]);
var xAxis = m_XAxes[index];
var yAxis = m_YAxes[index];
var tempX = m_XAxes[index].Clone();
xAxis.Copy(m_YAxes[index]);
yAxis.Copy(tempX);
xAxis.runtimeZeroXOffset = 0;
xAxis.runtimeZeroYOffset = 0;
@@ -252,10 +251,14 @@ namespace XCharts
/// </summary>
public void UpdateCoordinate()
{
m_CoordinateX = m_ChartX + m_Grid.left;
m_CoordinateY = m_ChartY + m_Grid.bottom;
m_CoordinateWidth = m_ChartWidth - m_Grid.left - m_Grid.right;
m_CoordinateHeight = m_ChartHeight - m_Grid.top - m_Grid.bottom;
foreach (var grid in m_Grids)
{
grid.UpdateRuntimeData(m_ChartX, m_ChartY, m_ChartWidth, m_ChartHeight);
}
foreach (var dataZoom in m_DataZooms)
{
dataZoom.UpdateRuntimeData(m_ChartX, m_ChartY, m_ChartWidth, m_ChartHeight);
}
}
/// <summary>
@@ -264,8 +267,26 @@ namespace XCharts
public void SetMaxCache(int maxCache)
{
foreach (var serie in m_Series.list) serie.maxCache = maxCache;
foreach (var axis in m_XAxises) axis.maxCache = maxCache;
foreach (var axis in m_YAxises) axis.maxCache = maxCache;
foreach (var axis in m_XAxes) axis.maxCache = maxCache;
foreach (var axis in m_YAxes) axis.maxCache = maxCache;
}
public Grid GetGrid(int index)
{
if (index >= 0 && index < m_Grids.Count) return m_Grids[index];
else return null;
}
public XAxis GetXAxis(int index)
{
if (index >= 0 && index < m_XAxes.Count) return m_XAxes[index];
else return null;
}
public YAxis GetYAxis(int index)
{
if (index >= 0 && index < m_YAxes.Count) return m_YAxes[index];
else return null;
}
}
}

View File

@@ -1,17 +1,18 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts
{
public partial class LiquidChart
public partial class BaseChart
{
public Vessel vessel { get { return m_Vessels.Count > 0 ? m_Vessels[0] : null; } }
/// <summary>
/// 容器组件列表。
/// </summary>

View File

@@ -1,22 +0,0 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEngine;
using System;
using UnityEngine.EventSystems;
namespace XCharts
{
public partial class PieChart
{
/// <summary>
/// the callback function of click pie area.
/// 点击饼图区域回调。参数PointerEventDataSerieIndexSerieDataIndex
/// </summary>
public Action<PointerEventData, int, int> onPointerClickPie { set { m_OnPointerClickPie = value; m_ForceOpenRaycastTarget = true; } }
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 85c7f8858dca444f88830d61b9af3700
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,12 +1,9 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using System.Collections.Generic;
using UnityEngine;
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
namespace XCharts
{
@@ -15,16 +12,16 @@ namespace XCharts
/// <summary>
/// 极坐标。
/// </summary>
public Polar polar { get { return m_Polar; } }
public Polar polar { get { return m_Polars.Count > 0 ? m_Polars[0] : null; } }
/// <summary>
/// Angle axis of Polar Coordinate.
/// 极坐标系的角度轴。
/// </summary>
public AngleAxis angleAxis { get { return m_AngleAxis; } }
public AngleAxis angleAxis { get { return m_AngleAxes.Count > 0 ? m_AngleAxes[0] : null; } }
/// <summary>
/// Radial axis of polar coordinate.
/// 极坐标系的径向轴。
/// </summary>
public RadiusAxis radiusAxis { get { return m_RadiusAxis; } }
public RadiusAxis radiusAxis { get { return m_RadiusAxes.Count > 0 ? m_RadiusAxes[0] : null; } }
}
}

View File

@@ -1,34 +1,23 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts
{
public partial class RadarChart
public partial class BaseChart
{
public Radar radar { get { return m_Radars.Count > 0 ? m_Radars[0] : null; } }
/// <summary>
/// 雷达坐标系组件列表。
/// </summary>
public List<Radar> radars { get { return m_Radars; } }
/// <summary>
/// 移除所有数据,包含雷达坐标系指示器数据。
/// </summary>
public override void RemoveData()
{
base.RemoveData();
foreach (var radar in m_Radars)
{
radar.indicatorList.Clear();
}
}
/// <summary>
/// 移除所有雷达坐标系组件。
/// </summary>
@@ -57,7 +46,7 @@ namespace XCharts
/// <param name="showSplitArea">是否显示分割区域</param>
/// <returns></returns>
public Radar AddRadar(Radar.Shape shape, Vector2 center, float radius, int splitNumber = 5,
float lineWidth = 0.6f, bool showIndicator = true, bool showSplitArea = true)
float lineWidth = 0f, bool showIndicator = true, bool showSplitArea = true)
{
var radar = new Radar();
radar.shape = shape;

View File

@@ -1,12 +1,9 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using System.Collections.Generic;
using UnityEngine;
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
namespace XCharts
{