using System.Collections.Generic;
namespace XCharts
{
///
/// The basic class of rectangular coordinate chart,such as LineChart,BarChart and ScatterChart.
/// 直角坐标系类型图表的基类,如折线图LineChart,柱状图BarChart,散点图ScatterChart都属于这类型的图表。
/// 不可用直接将CoordinateChart绑定到GameObject上。
///
public partial class CoordinateChart
{
///
/// The lower left position x of coordinate system.
/// 坐标系的左下角坐标X。
///
public float coordinateX { get { return m_Grid.left; } }
///
/// The lower left position y of coordinate system.
/// 坐标系的左下角坐标Y。
///
public float coordinateY { get { return m_Grid.bottom; } }
///
/// the width of coordinate system。
/// 坐标系的宽。
///
public float coordinateWid { get { return chartWidth - m_Grid.left - m_Grid.right; } }
///
/// the height of coordinate system。
/// 坐标系的高。
///
public float coordinateHig { get { return chartHeight - m_Grid.top - m_Grid.bottom; } }
///
/// grid component.
/// 网格组件。
///
public Grid grid { get { return m_Grid; } }
///
/// the x axises,xAxises[0] is the first x axis, xAxises[1] is the second x axis.
/// 两个x轴。
///
public List xAxises { get { return m_XAxises; } }
///
/// the y axises, yAxises[0] is the first y axis, yAxises[1] is the second y axis.
/// 两个y轴。
///
public List yAxises { get { return m_YAxises; } }
///
/// dataZoom component.
/// 区域缩放组件。
///
///
public DataZoom dataZoom { get { return m_DataZoom; } }
///
/// Remove all data from series,legend and axis.
/// It just emptying all of serie's data without emptying the list of series.
/// 清空所有图例,系列和坐标轴类目数据。系列中指示清空系列中的数据,会保留系列列表。
///
public override void ClearData()
{
base.ClearData();
ClearAxisData();
}
///
/// Remove all data from series,legend and axis.
/// The series list is also cleared.
/// 清空所有图例,系列和坐标轴类目数据。系列的列表也会被清空。
///
public override void RemoveData()
{
base.RemoveData();
ClearAxisData();
}
///
/// Remove all data of axises.
/// 清除所有x轴和y轴的类目数据。
///
public void ClearAxisData()
{
foreach (var item in m_XAxises) item.data.Clear();
foreach (var item in m_YAxises) item.data.Clear();
}
///
/// Add a category data to xAxis.
/// 添加一个类目数据到指定的x轴。
///
/// the category data
/// which xAxis should category add to
public void AddXAxisData(string category, int xAxisIndex = 0)
{
m_XAxises[xAxisIndex].AddData(category, m_MaxCacheDataNumber);
m_XAxisChanged = true;
}
///
/// Add a category data to yAxis.
/// 添加一个类目数据到指定的y轴。
///
/// the category data
/// which yAxis should category add to
public void AddYAxisData(string category, int yAxisIndex = 0)
{
m_YAxises[yAxisIndex].AddData(category, m_MaxCacheDataNumber);
m_YAxisChanged = true;
}
///
/// reutrn true when all the show axis is `Value` type.
/// 纯数值坐标。
///
///
public bool IsValue()
{
foreach (var axis in m_XAxises)
{
if (axis.show && !axis.IsValue()) return false;
}
foreach (var axis in m_YAxises)
{
if (axis.show && !axis.IsValue()) return false;
}
return true;
}
}
}