mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-26 02:40:13 +00:00
优化Editor下的图表创建 #147
This commit is contained in:
@@ -70,6 +70,9 @@ namespace XCharts
|
|||||||
rect.anchorMin = new Vector2(0.5f, 0.5f);
|
rect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||||
rect.anchorMax = new Vector2(0.5f, 0.5f);
|
rect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||||
rect.pivot = new Vector2(0.5f, 0.5f);
|
rect.pivot = new Vector2(0.5f, 0.5f);
|
||||||
|
GameObjectUtility.EnsureUniqueNameForSibling(chart);
|
||||||
|
Selection.activeGameObject = chart;
|
||||||
|
EditorUtility.SetDirty(chart);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("XCharts/LineChart", priority = 44)]
|
[MenuItem("XCharts/LineChart", priority = 44)]
|
||||||
|
|||||||
@@ -1046,15 +1046,15 @@ namespace XCharts
|
|||||||
var grid = GetAxisGridOrDefault(yAxis);
|
var grid = GetAxisGridOrDefault(yAxis);
|
||||||
var size = AxisHelper.GetScaleNumber(yAxis, grid.runtimeWidth, dataZoom);
|
var size = AxisHelper.GetScaleNumber(yAxis, grid.runtimeWidth, dataZoom);
|
||||||
var totalWidth = grid.runtimeY;
|
var totalWidth = grid.runtimeY;
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i <= size; i++)
|
||||||
{
|
{
|
||||||
var scaleWidth = AxisHelper.GetScaleWidth(yAxis, grid.runtimeHeight, i + 1, dataZoom);
|
var scaleWidth = AxisHelper.GetScaleWidth(yAxis, grid.runtimeHeight, i + 1, dataZoom);
|
||||||
if (i == 0 && !yAxis.axisTick.showStartTick)
|
if (i == 0 && (!yAxis.axisTick.showStartTick || yAxis.axisTick.alignWithLabel))
|
||||||
{
|
{
|
||||||
totalWidth += scaleWidth;
|
totalWidth += scaleWidth;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (i == size - 1 && !yAxis.axisTick.showEndTick)
|
if (i == size && !yAxis.axisTick.showEndTick)
|
||||||
{
|
{
|
||||||
totalWidth += scaleWidth;
|
totalWidth += scaleWidth;
|
||||||
continue;
|
continue;
|
||||||
@@ -1166,8 +1166,7 @@ namespace XCharts
|
|||||||
for (int i = 0; i <= size; i++)
|
for (int i = 0; i <= size; i++)
|
||||||
{
|
{
|
||||||
var scaleWidth = AxisHelper.GetScaleWidth(xAxis, grid.runtimeWidth, i + 1, dataZoom);
|
var scaleWidth = AxisHelper.GetScaleWidth(xAxis, grid.runtimeWidth, i + 1, dataZoom);
|
||||||
|
if (i == 0 && (!xAxis.axisTick.showStartTick || xAxis.axisTick.alignWithLabel))
|
||||||
if (i == 0 && !xAxis.axisTick.showStartTick)
|
|
||||||
{
|
{
|
||||||
totalWidth += scaleWidth;
|
totalWidth += scaleWidth;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user