mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 06:20:15 +00:00
Editor上添加第二个X轴或Y轴时自动设置位置
This commit is contained in:
@@ -133,7 +133,26 @@ namespace XCharts.Editor
|
||||
|
||||
public void AddChartComponent(Type type)
|
||||
{
|
||||
chart.AddChartComponent(type);
|
||||
var component = chart.AddChartComponent(type);
|
||||
if (component != null)
|
||||
{
|
||||
if (component is YAxis)
|
||||
{
|
||||
var yAxis = component as YAxis;
|
||||
if (yAxis.index == 1)
|
||||
{
|
||||
yAxis.position = Axis.AxisPosition.Right;
|
||||
}
|
||||
}
|
||||
else if (component is XAxis)
|
||||
{
|
||||
var xAxis = component as XAxis;
|
||||
if (xAxis.index == 1)
|
||||
{
|
||||
xAxis.position = Axis.AxisPosition.Top;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_ComponentsProperty = m_BaseEditor.RefreshComponent();
|
||||
RefreshEditors();
|
||||
EditorUtility.SetDirty(chart);
|
||||
|
||||
Reference in New Issue
Block a user