fixed y axis label onZero does not work

This commit is contained in:
monitor1394
2022-02-08 20:50:47 +08:00
parent 77c5c6af7e
commit 5db8fe09d5
3 changed files with 5 additions and 2 deletions

View File

@@ -42,6 +42,7 @@
## branch-2.0
* (2022.02.08) Fixed `YAxis` `AxisLabel`'s `onZero` does not work
* (2022.01.06) Improved `Zebra` bar chart
## v2.6.0

View File

@@ -42,6 +42,7 @@
## branch-2.0
* (2022.02.08) 修复`YAxis``AxisLabel``onZero`参数不生效的问题
* (2022.01.06) 优化`Zebra`斑马柱图
## v2.6.0

View File

@@ -848,7 +848,8 @@ namespace XCharts
private Vector3 GetLabelYPosition(float scaleWid, int i, int yAxisIndex, YAxis yAxis)
{
var grid = GetAxisGridOrDefault(yAxis);
var startX = yAxis.IsLeft() ? grid.runtimeX : grid.runtimeX + grid.runtimeWidth;
var startX = grid.runtimeX + (yAxis.axisLabel.onZero ? m_XAxes[yAxisIndex].runtimeZeroXOffset : 0);
if (yAxis.IsRight()) startX += grid.runtimeWidth;
var posX = 0f;
var inside = yAxis.axisLabel.inside;
if ((inside && yAxis.IsLeft()) || (!inside && yAxis.IsRight()))
@@ -1700,7 +1701,7 @@ namespace XCharts
{
ClampInChart(ref p1);
ClampInChart(ref p2);
UGL.DrawZebraLine(vh, p1, p2, size, zebraWidth, zebraGap, color, toColor,maxDistance);
UGL.DrawZebraLine(vh, p1, p2, size, zebraWidth, zebraGap, color, toColor, maxDistance);
}
protected Color32 GetXLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, Grid grid)