mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 22:10:11 +00:00
增加Covert XY Axis互换XY轴配置
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
* (2020.04.18) 增加`Covert XY Axis`互换XY轴配置
|
||||||
* (2020.04.17) 增加`Axis`可通过`inverse`参数设置坐标轴反转
|
* (2020.04.17) 增加`Axis`可通过`inverse`参数设置坐标轴反转
|
||||||
* (2020.04.16) 修复`Check warning`在`Unity2019.3`上的显示问题
|
* (2020.04.16) 修复`Check warning`在`Unity2019.3`上的显示问题
|
||||||
* (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题
|
* (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题
|
||||||
|
|||||||
@@ -91,13 +91,12 @@ namespace XCharts
|
|||||||
|
|
||||||
protected virtual void OnEndInspectorGUI()
|
protected virtual void OnEndInspectorGUI()
|
||||||
{
|
{
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.Space();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CheckWarning()
|
private void CheckWarning()
|
||||||
{
|
{
|
||||||
EditorGUILayout.Space();
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
if (m_CheckWarning)
|
if (m_CheckWarning)
|
||||||
{
|
{
|
||||||
EditorGUILayout.BeginHorizontal();
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
/******************************************/
|
/******************************************/
|
||||||
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -52,5 +53,19 @@ namespace XCharts
|
|||||||
EditorGUILayout.PropertyField(axis);
|
EditorGUILayout.PropertyField(axis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnEndInspectorGUI()
|
||||||
|
{
|
||||||
|
base.OnEndInspectorGUI();
|
||||||
|
CovertXYAxis();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CovertXYAxis()
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("Covert XY Axis"))
|
||||||
|
{
|
||||||
|
(m_Target as CoordinateChart).CovertXYAxis(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,6 +212,20 @@ namespace XCharts
|
|||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转换X轴和Y轴的配置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">坐标轴索引,0或1</param>
|
||||||
|
public void CovertXYAxis(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index <= 1)
|
||||||
|
{
|
||||||
|
var tempX = m_XAxises[index].Clone();
|
||||||
|
m_XAxises[index].Copy(m_YAxises[index]);
|
||||||
|
m_YAxises[index].Copy(tempX);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -358,6 +358,55 @@ namespace XCharts
|
|||||||
private bool m_RuntimeMinValueFirstChanged = true;
|
private bool m_RuntimeMinValueFirstChanged = true;
|
||||||
private bool m_RuntimeMaxValueFirstChanged = true;
|
private bool m_RuntimeMaxValueFirstChanged = true;
|
||||||
|
|
||||||
|
public Axis Clone()
|
||||||
|
{
|
||||||
|
var axis = new Axis();
|
||||||
|
axis.show = show;
|
||||||
|
axis.type = type;
|
||||||
|
axis.minMaxType = minMaxType;
|
||||||
|
axis.min = min;
|
||||||
|
axis.max = max;
|
||||||
|
axis.splitNumber = splitNumber;
|
||||||
|
axis.interval = interval;
|
||||||
|
axis.boundaryGap = boundaryGap;
|
||||||
|
axis.maxCache = maxCache;
|
||||||
|
axis.logBase = logBase;
|
||||||
|
axis.logBaseE = logBaseE;
|
||||||
|
axis.ceilRate = ceilRate;
|
||||||
|
axis.axisLine = axisLine.Clone();
|
||||||
|
axis.axisName = axisName.Clone();
|
||||||
|
axis.axisTick = axisTick.Clone();
|
||||||
|
axis.axisLabel = axisLabel.Clone();
|
||||||
|
axis.splitLine = splitLine.Clone();
|
||||||
|
axis.splitArea = splitArea.Clone();
|
||||||
|
axis.data = new List<string>();
|
||||||
|
ChartHelper.CopyList(axis.data, data);
|
||||||
|
return axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Copy(Axis axis)
|
||||||
|
{
|
||||||
|
show = axis.show;
|
||||||
|
type = axis.type;
|
||||||
|
minMaxType = axis.minMaxType;
|
||||||
|
min = axis.min;
|
||||||
|
max = axis.max;
|
||||||
|
splitNumber = axis.splitNumber;
|
||||||
|
interval = axis.interval;
|
||||||
|
boundaryGap = axis.boundaryGap;
|
||||||
|
maxCache = axis.maxCache;
|
||||||
|
logBase = axis.logBase;
|
||||||
|
logBaseE = axis.logBaseE;
|
||||||
|
ceilRate = axis.ceilRate;
|
||||||
|
axisLine.Copy(axis.axisLine);
|
||||||
|
axisName.Copy(axis.axisName);
|
||||||
|
axisTick.Copy(axis.axisTick);
|
||||||
|
axisLabel.Copy(axis.axisLabel);
|
||||||
|
splitLine.Copy(axis.splitLine);
|
||||||
|
splitArea.Copy(axis.splitArea);
|
||||||
|
ChartHelper.CopyList(data, axis.data);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清空类目数据
|
/// 清空类目数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -153,6 +153,36 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AxisLabel Clone()
|
||||||
|
{
|
||||||
|
var axisLable = new AxisLabel();
|
||||||
|
axisLable.show = show;
|
||||||
|
axisLable.formatter = formatter;
|
||||||
|
axisLable.interval = interval;
|
||||||
|
axisLable.inside = inside;
|
||||||
|
axisLable.rotate = rotate;
|
||||||
|
axisLable.margin = margin;
|
||||||
|
axisLable.color = color;
|
||||||
|
axisLable.fontSize = fontSize;
|
||||||
|
axisLable.forceENotation = forceENotation;
|
||||||
|
axisLable.textLimit = textLimit.Clone();
|
||||||
|
return axisLable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Copy(AxisLabel axisLable)
|
||||||
|
{
|
||||||
|
show = axisLable.show;
|
||||||
|
formatter = axisLable.formatter;
|
||||||
|
interval = axisLable.interval;
|
||||||
|
inside = axisLable.inside;
|
||||||
|
rotate = axisLable.rotate;
|
||||||
|
margin = axisLable.margin;
|
||||||
|
color = axisLable.color;
|
||||||
|
fontSize = axisLable.fontSize;
|
||||||
|
forceENotation = axisLable.forceENotation;
|
||||||
|
textLimit.Copy(axisLable.textLimit);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetRelatedText(Text txt, float labelWidth)
|
public void SetRelatedText(Text txt, float labelWidth)
|
||||||
{
|
{
|
||||||
m_TextLimit.SetRelatedText(txt, labelWidth);
|
m_TextLimit.SetRelatedText(txt, labelWidth);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace XCharts
|
|||||||
public bool onZero
|
public bool onZero
|
||||||
{
|
{
|
||||||
get { return m_OnZero; }
|
get { return m_OnZero; }
|
||||||
set { if (PropertyUtility.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
|
set { if (PropertyUtility.SetStruct(ref m_OnZero, value)) SetVerticesDirty(); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// line style line width.
|
/// line style line width.
|
||||||
@@ -116,5 +116,31 @@ namespace XCharts
|
|||||||
return axisLine;
|
return axisLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AxisLine Clone()
|
||||||
|
{
|
||||||
|
var axisLine = new AxisLine();
|
||||||
|
axisLine.show = show;
|
||||||
|
axisLine.onZero = onZero;
|
||||||
|
axisLine.width = width;
|
||||||
|
axisLine.symbol = symbol;
|
||||||
|
axisLine.symbolWidth = symbolWidth;
|
||||||
|
axisLine.symbolHeight = symbolHeight;
|
||||||
|
axisLine.symbolOffset = symbolOffset;
|
||||||
|
axisLine.symbolDent = symbolDent;
|
||||||
|
return axisLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Copy(AxisLine axisLine)
|
||||||
|
{
|
||||||
|
show = axisLine.show;
|
||||||
|
onZero = axisLine.onZero;
|
||||||
|
width = axisLine.width;
|
||||||
|
symbol = axisLine.symbol;
|
||||||
|
symbolWidth = axisLine.symbolWidth;
|
||||||
|
symbolHeight = axisLine.symbolHeight;
|
||||||
|
symbolOffset = axisLine.symbolOffset;
|
||||||
|
symbolDent = axisLine.symbolDent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,5 +125,31 @@ namespace XCharts
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AxisName Clone()
|
||||||
|
{
|
||||||
|
var axisName = new AxisName();
|
||||||
|
axisName.show = show;
|
||||||
|
axisName.name = name;
|
||||||
|
axisName.location = location;
|
||||||
|
axisName.offset = offset;
|
||||||
|
axisName.rotate = rotate;
|
||||||
|
axisName.color = color;
|
||||||
|
axisName.fontSize = fontSize;
|
||||||
|
axisName.fontStyle = fontStyle;
|
||||||
|
return axisName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Copy(AxisName axisName)
|
||||||
|
{
|
||||||
|
show = axisName.show;
|
||||||
|
name = axisName.name;
|
||||||
|
location = axisName.location;
|
||||||
|
offset = axisName.offset;
|
||||||
|
rotate = axisName.rotate;
|
||||||
|
color = axisName.color;
|
||||||
|
fontSize = axisName.fontSize;
|
||||||
|
fontStyle = axisName.fontStyle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,6 +57,22 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AxisSplitArea Clone()
|
||||||
|
{
|
||||||
|
var axisSplitArea = new AxisSplitArea();
|
||||||
|
axisSplitArea.show = show;
|
||||||
|
axisSplitArea.color = new List<Color>();
|
||||||
|
ChartHelper.CopyList(axisSplitArea.color, color);
|
||||||
|
return axisSplitArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Copy(AxisSplitArea splitArea)
|
||||||
|
{
|
||||||
|
show = splitArea.show;
|
||||||
|
color.Clear();
|
||||||
|
ChartHelper.CopyList(color, splitArea.color);
|
||||||
|
}
|
||||||
|
|
||||||
public Color getColor(int index)
|
public Color getColor(int index)
|
||||||
{
|
{
|
||||||
var i = index % color.Count;
|
var i = index % color.Count;
|
||||||
|
|||||||
@@ -61,6 +61,22 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AxisSplitLine Clone()
|
||||||
|
{
|
||||||
|
var axisSplitLine = new AxisSplitLine();
|
||||||
|
axisSplitLine.show = show;
|
||||||
|
axisSplitLine.interval = interval;
|
||||||
|
axisSplitLine.lineStyle = lineStyle.Clone();
|
||||||
|
return axisSplitLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Copy(AxisSplitLine splitLine)
|
||||||
|
{
|
||||||
|
show = splitLine.show;
|
||||||
|
interval = splitLine.interval;
|
||||||
|
lineStyle.Copy(splitLine.lineStyle);
|
||||||
|
}
|
||||||
|
|
||||||
internal Color GetColor(ThemeInfo theme)
|
internal Color GetColor(ThemeInfo theme)
|
||||||
{
|
{
|
||||||
if (lineStyle.color != Color.clear)
|
if (lineStyle.color != Color.clear)
|
||||||
|
|||||||
@@ -84,5 +84,25 @@ namespace XCharts
|
|||||||
return tick;
|
return tick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AxisTick Clone()
|
||||||
|
{
|
||||||
|
var axisTick = new AxisTick();
|
||||||
|
axisTick.show = show;
|
||||||
|
axisTick.alignWithLabel = alignWithLabel;
|
||||||
|
axisTick.inside = inside;
|
||||||
|
axisTick.length = length;
|
||||||
|
axisTick.width = width;
|
||||||
|
return axisTick;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Copy(AxisTick axisTick)
|
||||||
|
{
|
||||||
|
show = axisTick.show;
|
||||||
|
alignWithLabel = axisTick.alignWithLabel;
|
||||||
|
inside = axisTick.inside;
|
||||||
|
length = axisTick.length;
|
||||||
|
width = axisTick.width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,6 @@ namespace XCharts
|
|||||||
|
|
||||||
public LineStyle()
|
public LineStyle()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LineStyle(float width)
|
public LineStyle(float width)
|
||||||
@@ -112,6 +111,26 @@ namespace XCharts
|
|||||||
this.width = width;
|
this.width = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LineStyle Clone()
|
||||||
|
{
|
||||||
|
var lineStyle = new LineStyle();
|
||||||
|
lineStyle.show = show;
|
||||||
|
lineStyle.type = type;
|
||||||
|
lineStyle.color = color;
|
||||||
|
lineStyle.width = width;
|
||||||
|
lineStyle.opacity = opacity;
|
||||||
|
return lineStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Copy(LineStyle lineStyle)
|
||||||
|
{
|
||||||
|
show = lineStyle.show;
|
||||||
|
type = lineStyle.type;
|
||||||
|
color = lineStyle.color;
|
||||||
|
width = lineStyle.width;
|
||||||
|
opacity = lineStyle.opacity;
|
||||||
|
}
|
||||||
|
|
||||||
public Color GetColor()
|
public Color GetColor()
|
||||||
{
|
{
|
||||||
var color = m_Color;
|
var color = m_Color;
|
||||||
|
|||||||
@@ -60,6 +60,24 @@ namespace XCharts
|
|||||||
private TextGenerationSettings m_RelatedTextSettings;
|
private TextGenerationSettings m_RelatedTextSettings;
|
||||||
private float m_RelatedTextWidth = 0;
|
private float m_RelatedTextWidth = 0;
|
||||||
|
|
||||||
|
public TextLimit Clone()
|
||||||
|
{
|
||||||
|
var textLimit = new TextLimit();
|
||||||
|
textLimit.enable = enable;
|
||||||
|
textLimit.maxWidth = maxWidth;
|
||||||
|
textLimit.gap = gap;
|
||||||
|
textLimit.suffix = suffix;
|
||||||
|
return textLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Copy(TextLimit textLimit)
|
||||||
|
{
|
||||||
|
enable = textLimit.enable;
|
||||||
|
maxWidth = textLimit.maxWidth;
|
||||||
|
gap = textLimit.gap;
|
||||||
|
suffix = textLimit.suffix;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetRelatedText(Text txt, float labelWidth)
|
public void SetRelatedText(Text txt, float labelWidth)
|
||||||
{
|
{
|
||||||
m_RelatedText = txt;
|
m_RelatedText = txt;
|
||||||
|
|||||||
Reference in New Issue
Block a user