mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
隐藏Hierarchy试图下自动生成的子节点
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
# 更新日志
|
||||
|
||||
* (2020.05.18) 隐藏`Hierarchy`试图下自动生成的子节点
|
||||
* (2020.05.18) 增加`chartName`属性可指定图表的别称,可通过`XChartMgr.Instance.GetChart(chartName)`获取图表
|
||||
* (2020.05.16) 增加部分鼠标事件回调
|
||||
* (2020.05.15) 优化自带例子,`Demo`改名为`Example`
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace XCharts
|
||||
protected static readonly string s_LegendObjectName = "legend";
|
||||
protected static readonly string s_SerieLabelObjectName = "label";
|
||||
protected static readonly string s_SerieTitleObjectName = "serie";
|
||||
protected static HideFlags s_HideFlags = HideFlags.HideAndDontSave;
|
||||
|
||||
[SerializeField] protected string m_ChartName;
|
||||
[SerializeField] protected float m_ChartWidth;
|
||||
@@ -244,6 +245,7 @@ namespace XCharts
|
||||
var titleObject = ChartHelper.AddObject(s_TitleObjectName, transform, anchorMin, anchorMax,
|
||||
pivot, new Vector2(chartWidth, chartHeight));
|
||||
titleObject.transform.localPosition = titlePosition;
|
||||
titleObject.hideFlags = s_HideFlags;
|
||||
ChartHelper.HideAllObject(titleObject);
|
||||
|
||||
var textFont = TitleHelper.GetTextFont(title, themeInfo);
|
||||
@@ -282,6 +284,7 @@ namespace XCharts
|
||||
var legendObject = ChartHelper.AddObject(s_LegendObjectName, transform, anchorMin, anchorMax,
|
||||
pivot, new Vector2(chartWidth, chartHeight));
|
||||
legendObject.transform.localPosition = GetLegendPosition();
|
||||
legendObject.hideFlags = s_HideFlags;
|
||||
SeriesHelper.UpdateSerieNameList(m_Series, ref m_LegendRealShowName);
|
||||
List<string> datas;
|
||||
if (m_Legend.show && m_Legend.data.Count > 0)
|
||||
@@ -376,6 +379,7 @@ namespace XCharts
|
||||
{
|
||||
m_SerieLabelRoot = ChartHelper.AddObject(s_SerieLabelObjectName, transform, m_ChartMinAnchor,
|
||||
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
|
||||
m_SerieLabelRoot.hideFlags = s_HideFlags;
|
||||
SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
|
||||
int count = 0;
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
@@ -427,6 +431,7 @@ namespace XCharts
|
||||
{
|
||||
var titleObject = ChartHelper.AddObject(s_SerieTitleObjectName, transform, m_ChartMinAnchor,
|
||||
m_ChartMaxAnchor, m_ChartPivot, new Vector2(chartWidth, chartHeight));
|
||||
titleObject.hideFlags = s_HideFlags;
|
||||
ChartHelper.HideAllObject(titleObject);
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
@@ -460,6 +465,7 @@ namespace XCharts
|
||||
var tooltipObject = ChartHelper.AddObject("tooltip", transform, m_ChartMinAnchor,
|
||||
m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta);
|
||||
tooltipObject.transform.localPosition = Vector3.zero;
|
||||
tooltipObject.hideFlags = s_HideFlags;
|
||||
DestroyImmediate(tooltipObject.GetComponent<Image>());
|
||||
var parent = tooltipObject.transform;
|
||||
var textStyle = m_Tooltip.textStyle;
|
||||
|
||||
@@ -515,6 +515,7 @@ namespace XCharts
|
||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||
axisObj.transform.localPosition = Vector3.zero;
|
||||
axisObj.SetActive(yAxis.show && yAxis.axisLabel.show);
|
||||
axisObj.hideFlags = s_HideFlags;
|
||||
ChartHelper.HideAllObject(axisObj);
|
||||
var labelColor = ChartHelper.IsClearColor(yAxis.axisLabel.color) ?
|
||||
(Color)m_ThemeInfo.axisTextColor :
|
||||
@@ -620,6 +621,7 @@ namespace XCharts
|
||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||
axisObj.transform.localPosition = Vector3.zero;
|
||||
axisObj.SetActive(xAxis.show && xAxis.axisLabel.show);
|
||||
axisObj.hideFlags = s_HideFlags;
|
||||
ChartHelper.HideAllObject(axisObj);
|
||||
var labelColor = ChartHelper.IsClearColor(xAxis.axisLabel.color) ?
|
||||
(Color)m_ThemeInfo.axisTextColor :
|
||||
@@ -701,6 +703,7 @@ namespace XCharts
|
||||
var dataZoomObject = ChartHelper.AddObject(s_DefaultDataZoom, transform, chartAnchorMin,
|
||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||
dataZoomObject.transform.localPosition = Vector3.zero;
|
||||
dataZoomObject.hideFlags = s_HideFlags;
|
||||
ChartHelper.HideAllObject(dataZoomObject);
|
||||
var startLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "start",
|
||||
dataZoomObject.transform, m_ThemeInfo.font, m_ThemeInfo.dataZoomTextColor, TextAnchor.MiddleRight,
|
||||
@@ -980,7 +983,6 @@ namespace XCharts
|
||||
var lineX = m_CoordinateX + (yAxis.axisLine.onZero ? m_XAxises[yAxisIndex].runtimeZeroXOffset : 0);
|
||||
if (yAxis.IsValue() && yAxisIndex > 0) lineX += m_CoordinateWidth;
|
||||
var inverse = yAxis.IsValue() && yAxis.inverse;
|
||||
var offset = AxisHelper.GetAxisLineSymbolOffset(yAxis);
|
||||
if (inverse)
|
||||
{
|
||||
var startPos = new Vector3(lineX, m_CoordinateY + m_CoordinateHeight);
|
||||
@@ -1081,7 +1083,6 @@ namespace XCharts
|
||||
var lineY = m_CoordinateY + (xAxis.axisLine.onZero ? m_YAxises[xAxisIndex].runtimeZeroYOffset : 0);
|
||||
if (xAxis.IsValue() && xAxisIndex > 0) lineY += m_CoordinateHeight;
|
||||
var inverse = xAxis.IsValue() && xAxis.inverse;
|
||||
var offset = AxisHelper.GetAxisLineSymbolOffset(xAxis);
|
||||
if (inverse)
|
||||
{
|
||||
var startPos = new Vector3(m_CoordinateX + m_CoordinateWidth, lineY);
|
||||
|
||||
Reference in New Issue
Block a user