mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 10:20:10 +00:00
[feature][axis] support minor tick and minor split line
This commit is contained in:
@@ -15,17 +15,32 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
|
||||
UpdateAxisMinMaxValue(component.index, component);
|
||||
UpdatePointerValue(component);
|
||||
}
|
||||
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
{
|
||||
UpdatePosition(component);
|
||||
DrawXAxisSplit(vh, component);
|
||||
DrawXAxisLine(vh, component);
|
||||
DrawXAxisTick(vh, component);
|
||||
}
|
||||
|
||||
private void UpdatePosition(XAxis axis)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
if (grid != null && axis is XAxis && axis.IsValue())
|
||||
{
|
||||
var relativedAxis = chart.GetChartComponent<YAxis>(axis.gridIndex);
|
||||
axis.context.x = grid.context.x;
|
||||
axis.context.y = AxisHelper.GetXAxisXOrY(grid, axis, relativedAxis);
|
||||
axis.context.zeroY = grid.context.y;
|
||||
axis.context.zeroX = grid.context.x + axis.context.offset;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitXAxis(XAxis xAxis)
|
||||
{
|
||||
var theme = chart.theme;
|
||||
@@ -137,16 +152,9 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
protected override float GetAxisLineXOrY()
|
||||
internal override float GetAxisLineXOrY()
|
||||
{
|
||||
var xAxis = component;
|
||||
var grid = chart.GetChartComponent<GridCoord>(xAxis.gridIndex);
|
||||
var startY = grid.context.y + xAxis.offset;
|
||||
if (xAxis.IsTop())
|
||||
startY += grid.context.height;
|
||||
else
|
||||
startY += ComponentHelper.GetXAxisOnZeroOffset(chart.components, xAxis);
|
||||
return startY;
|
||||
return component.context.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user