Skip to content

Commit 12495ab

Browse files
Add section z-index constants and complete implementation
Co-authored-by: beto-rodriguez <[email protected]>
1 parent f19b446 commit 12495ab

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/LiveChartsCore/CoreSection.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public override void Invalidate(Chart chart)
210210

211211
if (Fill is not null)
212212
{
213-
Fill.ZIndex = ZIndex ?? -2.5;
213+
Fill.ZIndex = ZIndex ?? Paint.SectionFillZIndex;
214214

215215
if (_fillSizedGeometry is null)
216216
{
@@ -236,7 +236,7 @@ public override void Invalidate(Chart chart)
236236

237237
if (Stroke is not null)
238238
{
239-
Stroke.ZIndex = ZIndex ?? 0;
239+
Stroke.ZIndex = ZIndex ?? Paint.SectionStrokeZIndex;
240240

241241
if (_strokeSizedGeometry is null)
242242
{
@@ -262,7 +262,7 @@ public override void Invalidate(Chart chart)
262262

263263
if (LabelPaint is not null)
264264
{
265-
LabelPaint.ZIndex = ZIndex ?? 0.01;
265+
LabelPaint.ZIndex = ZIndex ?? Paint.SectionLabelsZIndex;
266266

267267
var xil = Xi is null ? drawLocation.X : secondaryScale.ToPixels(Xi.Value);
268268
var yil = Yi is null ? drawLocation.Y : primaryScale.ToPixels(Yi.Value);

src/LiveChartsCore/Painting/Paint.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,22 @@ public Paint(float strokeThickness = 1f, float strokeMiter = 0)
172172
/// </summary>
173173
internal const double DrawMarginFrameStrokeZIndex = -0.9;
174174

175+
// Section-related z-index constants
176+
/// <summary>
177+
/// Default z-index for section fill.
178+
/// </summary>
179+
internal const double SectionFillZIndex = -2.5;
180+
181+
/// <summary>
182+
/// Default z-index for section stroke.
183+
/// </summary>
184+
internal const double SectionStrokeZIndex = 0;
185+
186+
/// <summary>
187+
/// Default z-index for section labels.
188+
/// </summary>
189+
internal const double SectionLabelsZIndex = 0.01;
190+
175191
#endregion
176192

177193
/// <summary>

0 commit comments

Comments
 (0)