mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 00:20:18 +00:00
增加更新Axis数据和图标的接口
This commit is contained in:
@@ -84,8 +84,12 @@
|
||||
* `CoordinateChart.ClearAxisData()`:清除所有x轴和y轴的类目数据。
|
||||
* `CoordinateChart.AddXAxisData(string category, int xAxisIndex = 0)`:添加一个类目数据到指定的 `X` 轴。
|
||||
* `CoordinateChart.AddYAxisData(string category, int yAxisIndex = 0)`:添加一个类目数据到指定的 `Y` 轴。
|
||||
* `CoordinateChart.AddXAxisIcon(Sprite icon, int xAxisIndex = 0)`:添加一个类目数据到指定的 `X` 轴。
|
||||
* `CoordinateChart.AddYAxisIcon(Sprite icon, int yAxisIndex = 0)`:添加一个类目数据到指定的 `Y` 轴。。
|
||||
* `CoordinateChart.AddXAxisIcon(Sprite icon, int xAxisIndex = 0)`:添加一个图标到指定的 `X` 轴。
|
||||
* `CoordinateChart.AddYAxisIcon(Sprite icon, int yAxisIndex = 0)`:添加一个图标到指定的 `Y` 轴。
|
||||
* `CoordinateChart.UpdateXAxisData(int index, string category, int xAxisIndex = 0)`:更新 `X` 轴的类目数据。
|
||||
* `CoordinateChart.UpdateYAxisData(int index, string category, int yAxisIndex = 0)`:更新 `Y` 轴的类目数据。
|
||||
* `CoordinateChart.UpdateXAxisIcon(int index, Sprite icon, int xAxisIndex = 0)`:更新 `X` 轴的图标。
|
||||
* `CoordinateChart.UpdateYAxisIcon(int index, Sprite icon, int yAxisIndex = 0)`:更新 `Y` 轴的图标。
|
||||
|
||||
* `CoordinateChart.IsValue()`:是否是纯数值坐标。
|
||||
* `CoordinateChart.RefreshDataZoom()`:在下一帧刷新DataZoom组件。
|
||||
|
||||
@@ -107,6 +107,22 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update category data.
|
||||
/// 更新X轴类目数据。
|
||||
/// </summary>
|
||||
/// <param name="index">the index of category data</param>
|
||||
/// <param name="category"></param>
|
||||
/// <param name="xAxisIndex">which xAxis index to update to</param>
|
||||
public void UpdateXAxisData(int index, string category, int xAxisIndex = 0)
|
||||
{
|
||||
var xAxis = GetXAxis(xAxisIndex);
|
||||
if (xAxis != null)
|
||||
{
|
||||
xAxis.UpdateData(index, category);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an icon to xAxis.
|
||||
/// 添加一个图标到指定的x轴。
|
||||
@@ -122,6 +138,22 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update xAxis icon.
|
||||
/// 更新X轴图标。
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="icon"></param>
|
||||
/// <param name="xAxisIndex"></param>
|
||||
public void UdpateXAxisIcon(int index, Sprite icon, int xAxisIndex = 0)
|
||||
{
|
||||
var xAxis = GetXAxis(xAxisIndex);
|
||||
if (xAxis != null)
|
||||
{
|
||||
xAxis.UpdateIcon(index, icon);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a category data to yAxis.
|
||||
/// 添加一个类目数据到指定的y轴。
|
||||
@@ -137,6 +169,22 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update category data.
|
||||
/// 更新Y轴类目数据。
|
||||
/// </summary>
|
||||
/// <param name="index">the index of category data</param>
|
||||
/// <param name="category"></param>
|
||||
/// <param name="yAxisIndex">which yAxis index to update to</param>
|
||||
public void UpdateYAxisData(int index, string category, int yAxisIndex = 0)
|
||||
{
|
||||
var yAxis = GetYAxis(yAxisIndex);
|
||||
if (yAxis != null)
|
||||
{
|
||||
yAxis.UpdateData(index, category);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an icon to yAxis.
|
||||
/// 添加一个图标到指定的y轴。
|
||||
@@ -152,6 +200,21 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新Y轴图标。
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="icon"></param>
|
||||
/// <param name="yAxisIndex"></param>
|
||||
public void UpdateYAxisIcon(int index, Sprite icon, int yAxisIndex = 0)
|
||||
{
|
||||
var yAxis = GetYAxis(yAxisIndex);
|
||||
if (yAxis != null)
|
||||
{
|
||||
yAxis.UpdateIcon(index, icon);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reutrn true when all the show axis is `Value` type.
|
||||
/// 纯数值坐标轴(数值轴或对数轴)。
|
||||
|
||||
@@ -586,6 +586,24 @@ namespace XCharts
|
||||
SetAllDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新类目数据
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="category"></param>
|
||||
public void UpdateData(int index, string category)
|
||||
{
|
||||
if (index >= 0 && index < m_Data.Count)
|
||||
{
|
||||
m_Data[index] = category;
|
||||
SetComponentDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加图标
|
||||
/// </summary>
|
||||
/// <param name="icon"></param>
|
||||
public void AddIcon(Sprite icon)
|
||||
{
|
||||
if (maxCache > 0)
|
||||
@@ -600,6 +618,20 @@ namespace XCharts
|
||||
SetAllDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新图标
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="icon"></param>
|
||||
public void UpdateIcon(int index, Sprite icon)
|
||||
{
|
||||
if (index >= 0 && index < m_Icons.Count)
|
||||
{
|
||||
m_Icons[index] = icon;
|
||||
SetComponentDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定索引的类目数据
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user