diff --git a/src/LiveChartsCore/CoreAxis.cs b/src/LiveChartsCore/CoreAxis.cs
index ac81d04c8..0ceb53ca1 100644
--- a/src/LiveChartsCore/CoreAxis.cs
+++ b/src/LiveChartsCore/CoreAxis.cs
@@ -766,6 +766,7 @@ public void InvalidateCrosshair(Chart chart, LvcPoint pointerPosition)
_crosshairLabel.Padding = CrosshairPadding ?? _padding;
_crosshairLabel.X = x;
_crosshairLabel.Y = y;
+ _crosshairLabel.Paint = CrosshairLabelsPaint;
var r = (float)_labelsRotation;
var hasRotation = Math.Abs(r) > 0.01f;
@@ -844,10 +845,11 @@ public LvcSize GetNameLabelSize(Chart chart)
RotateTransform = Orientation == AxisOrientation.X
? 0
: InLineNamePlacement ? 0 : -90,
- Padding = NamePadding
+ Padding = NamePadding,
+ Paint = NamePaint
};
- return textGeometry.Measure(NamePaint);
+ return textGeometry.Measure();
}
///
@@ -883,9 +885,10 @@ public virtual LvcSize GetPossibleSize(Chart chart)
Text = TryGetLabelOrLogError(labeler, i),
TextSize = ts,
RotateTransform = r,
- Padding = _padding
+ Padding = _padding,
+ Paint = LabelsPaint
};
- var m = textGeometry.Measure(LabelsPaint);
+ var m = textGeometry.Measure();
if (m.Width > w) w = m.Width;
if (m.Height > h) h = m.Height;
}
@@ -1028,10 +1031,11 @@ private LvcSize GetPossibleMaxLabelSize()
Text = labeler(i),
TextSize = (float)_textSize,
RotateTransform = (float)LabelsRotation,
- Padding = _padding
+ Padding = _padding,
+ Paint = LabelsPaint
};
- var m = textGeometry.Measure(LabelsPaint);
+ var m = textGeometry.Measure();
maxLabelSize = new LvcSize(
maxLabelSize.Width > m.Width ? maxLabelSize.Width : m.Width,
@@ -1067,6 +1071,7 @@ private void DrawName(
_nameGeometry.Padding = NamePadding;
_nameGeometry.Text = Name ?? string.Empty;
_nameGeometry.TextSize = (float)_nameTextSize;
+ _nameGeometry.Paint = NamePaint;
if (_orientation == AxisOrientation.X)
{
@@ -1309,8 +1314,8 @@ private void UpdateLabel(
if (hasRotation && _labelsPaint is not null)
{
var notRotatedSize =
- new TTextGeometry { TextSize = (float)_textSize, Padding = _padding, Text = text }
- .Measure(_labelsPaint);
+ new TTextGeometry { TextSize = (float)_textSize, Padding = _padding, Text = text, Paint = _labelsPaint }
+ .Measure();
var rhx = Math.Cos((90 - actualRotatation) * toRadians) * notRotatedSize.Height;
x += (float)Math.Abs(rhx * 0.5f);
@@ -1324,8 +1329,8 @@ private void UpdateLabel(
if (hasRotation && _labelsPaint is not null)
{
var notRotatedSize =
- new TTextGeometry { TextSize = (float)_textSize, Padding = _padding, Text = text }
- .Measure(_labelsPaint);
+ new TTextGeometry { TextSize = (float)_textSize, Padding = _padding, Text = text, Paint = _labelsPaint }
+ .Measure();
var rhx = Math.Cos((90 - actualRotatation) * toRadians) * notRotatedSize.Height;
x -= (float)Math.Abs(rhx * 0.5f);
@@ -1351,8 +1356,8 @@ private void UpdateLabel(
if (hasRotation && _labelsPaint is not null)
{
var notRotatedSize =
- new TTextGeometry { TextSize = (float)_textSize, Padding = _padding, Text = text }
- .Measure(_labelsPaint);
+ new TTextGeometry { TextSize = (float)_textSize, Padding = _padding, Text = text, Paint = _labelsPaint }
+ .Measure();
var rhx = Math.Sin((90 - actualRotatation) * toRadians) * notRotatedSize.Height;
y += (float)Math.Abs(rhx * 0.5f);
@@ -1375,8 +1380,8 @@ private void UpdateLabel(
if (hasRotation && _labelsPaint is not null)
{
var notRotatedSize =
- new TTextGeometry { TextSize = (float)_textSize, Padding = _padding, Text = text }
- .Measure(_labelsPaint);
+ new TTextGeometry { TextSize = (float)_textSize, Padding = _padding, Text = text, Paint = _labelsPaint }
+ .Measure();
var rhx = Math.Sin((90 - actualRotatation) * toRadians) * notRotatedSize.Height;
y -= (float)Math.Abs(rhx * 0.5f);
@@ -1401,6 +1406,7 @@ private void UpdateLabel(
label.Padding = _padding;
label.X = x;
label.Y = y;
+ label.Paint = _labelsPaint;
if (hasRotation) label.RotateTransform = actualRotatation;
diff --git a/src/LiveChartsCore/CoreBoxSeries.cs b/src/LiveChartsCore/CoreBoxSeries.cs
index 896201686..796713e0c 100644
--- a/src/LiveChartsCore/CoreBoxSeries.cs
+++ b/src/LiveChartsCore/CoreBoxSeries.cs
@@ -261,7 +261,9 @@ public override void Invalidate(Chart chart)
label.Text = DataLabelsFormatter(new ChartPoint(point));
label.TextSize = dls;
label.Padding = DataLabelsPadding;
- var m = label.Measure(DataLabelsPaint);
+ label.Paint = DataLabelsPaint;
+
+ var m = label.Measure();
var labelPosition = GetLabelPosition(
x, high, helper.uw, Math.Abs(low - high), m, DataLabelsPosition,
SeriesProperties, coordinate.PrimaryValue > Pivot, drawLocation, drawMarginSize);
diff --git a/src/LiveChartsCore/CoreColumnSeries.cs b/src/LiveChartsCore/CoreColumnSeries.cs
index ea7bb2ba2..d196a3f4c 100644
--- a/src/LiveChartsCore/CoreColumnSeries.cs
+++ b/src/LiveChartsCore/CoreColumnSeries.cs
@@ -296,12 +296,13 @@ public override void Invalidate(Chart chart)
label.Text = DataLabelsFormatter(new ChartPoint(point));
label.TextSize = dls;
label.Padding = DataLabelsPadding;
+ label.Paint = DataLabelsPaint;
if (isFirstDraw)
label.CompleteTransition(
nameof(label.TextSize), nameof(label.X), nameof(label.Y), nameof(label.RotateTransform));
- var m = label.Measure(DataLabelsPaint);
+ var m = label.Measure();
var labelPosition = GetLabelPosition(
x, cy, helper.uw, b, m,
DataLabelsPosition, SeriesProperties, coordinate.PrimaryValue > Pivot, drawLocation, drawMarginSize);
diff --git a/src/LiveChartsCore/CoreFinancialSeries.cs b/src/LiveChartsCore/CoreFinancialSeries.cs
index 28ed4ba4c..c6cc98a6a 100644
--- a/src/LiveChartsCore/CoreFinancialSeries.cs
+++ b/src/LiveChartsCore/CoreFinancialSeries.cs
@@ -300,12 +300,13 @@ public override void Invalidate(Chart chart)
label.Text = DataLabelsFormatter(new ChartPoint(point));
label.TextSize = dls;
label.Padding = DataLabelsPadding;
+ label.Paint = DataLabelsPaint;
if (isFirstDraw)
label.CompleteTransition(
nameof(label.TextSize), nameof(label.X), nameof(label.Y), nameof(label.RotateTransform));
- var m = label.Measure(DataLabelsPaint);
+ var m = label.Measure();
var labelPosition = GetLabelPosition(
x, high, uw, Math.Abs(low - high), m, DataLabelsPosition,
SeriesProperties, coordinate.PrimaryValue > Pivot, drawLocation, drawMarginSize);
diff --git a/src/LiveChartsCore/CoreHeatSeries.cs b/src/LiveChartsCore/CoreHeatSeries.cs
index 66692a45a..4e1153d60 100644
--- a/src/LiveChartsCore/CoreHeatSeries.cs
+++ b/src/LiveChartsCore/CoreHeatSeries.cs
@@ -252,6 +252,7 @@ public override void Invalidate(Chart chart)
label.Text = DataLabelsFormatter(new ChartPoint(point));
label.TextSize = dls;
label.Padding = DataLabelsPadding;
+ label.Paint = DataLabelsPaint;
if (isFirstDraw)
label.CompleteTransition(
@@ -259,7 +260,7 @@ public override void Invalidate(Chart chart)
var labelPosition = GetLabelPosition(
secondary - uws * 0.5f + p.Left, primary - uwp * 0.5f + p.Top, uws - p.Left - p.Right, uwp - p.Top - p.Bottom,
- label.Measure(DataLabelsPaint), DataLabelsPosition, SeriesProperties, coordinate.PrimaryValue > Pivot, drawLocation, drawMarginSize);
+ label.Measure(), DataLabelsPosition, SeriesProperties, coordinate.PrimaryValue > Pivot, drawLocation, drawMarginSize);
label.X = labelPosition.X;
label.Y = labelPosition.Y;
}
diff --git a/src/LiveChartsCore/CoreLineSeries.cs b/src/LiveChartsCore/CoreLineSeries.cs
index ebe2f2bb7..4dbfa2567 100644
--- a/src/LiveChartsCore/CoreLineSeries.cs
+++ b/src/LiveChartsCore/CoreLineSeries.cs
@@ -418,12 +418,13 @@ public override void Invalidate(Chart chart)
label.Text = DataLabelsFormatter(new ChartPoint(data.TargetPoint));
label.TextSize = dls;
label.Padding = DataLabelsPadding;
+ label.Paint = DataLabelsPaint;
if (isFirstDraw)
label.CompleteTransition(
nameof(label.TextSize), nameof(label.X), nameof(label.Y), nameof(label.RotateTransform));
- var m = label.Measure(DataLabelsPaint);
+ var m = label.Measure();
var labelPosition = GetLabelPosition(
x - hgs, y - hgs, gs, gs, m, DataLabelsPosition,
SeriesProperties, coordinate.PrimaryValue > Pivot, drawLocation, drawMarginSize);
diff --git a/src/LiveChartsCore/CorePieSeries.cs b/src/LiveChartsCore/CorePieSeries.cs
index f9b114340..7dee0a825 100644
--- a/src/LiveChartsCore/CorePieSeries.cs
+++ b/src/LiveChartsCore/CorePieSeries.cs
@@ -415,6 +415,7 @@ public override void Invalidate(Chart chart)
label.TextSize = dls;
label.Padding = DataLabelsPadding;
label.RotateTransform = actualRotation;
+ label.Paint = DataLabelsPaint;
AlignLabel(label, (float)start, initialRotation, sweep);
@@ -429,7 +430,7 @@ public override void Invalidate(Chart chart)
(stackedOuterRadius + relativeOuterRadius * 2) * 0.5f,
(float)(start + initialRotation),
(float)sweep,
- label.Measure(DataLabelsPaint),
+ label.Measure(),
DataLabelsPosition);
label.X = labelPosition.X;
diff --git a/src/LiveChartsCore/CorePolarAxis.cs b/src/LiveChartsCore/CorePolarAxis.cs
index f53c80f1c..ddaa299da 100644
--- a/src/LiveChartsCore/CorePolarAxis.cs
+++ b/src/LiveChartsCore/CorePolarAxis.cs
@@ -432,10 +432,11 @@ public LvcSize GetNameLabelSize(Chart chart)
{
Text = Name ?? string.Empty,
TextSize = (float)NameTextSize,
- Padding = _labelsPadding
+ Padding = _labelsPadding,
+ Paint = NamePaint
};
- return textGeometry.Measure(NamePaint);
+ return textGeometry.Measure();
}
///
@@ -489,9 +490,10 @@ public virtual LvcSize GetPossibleSize(Chart chart)
Text = labeler(i),
TextSize = ts,
RotateTransform = r + (_orientation == PolarAxisOrientation.Angle ? scaler.GetAngle(i) - 90 : 0),
- Padding = _labelsPadding
+ Padding = _labelsPadding,
+ Paint = LabelsPaint
};
- var m = textGeometry.Measure(LabelsPaint);
+ var m = textGeometry.Measure();
var h = (float)Math.Sqrt(Math.Pow(m.Width * 0.5, 2) + Math.Pow(m.Height * 0.5, 2));
if (h > totalH) totalH = h;
diff --git a/src/LiveChartsCore/CorePolarLineSeries.cs b/src/LiveChartsCore/CorePolarLineSeries.cs
index 207ee624d..7933491b4 100644
--- a/src/LiveChartsCore/CorePolarLineSeries.cs
+++ b/src/LiveChartsCore/CorePolarLineSeries.cs
@@ -426,6 +426,7 @@ public override void Invalidate(Chart chart)
label.TextSize = dls;
label.Padding = DataLabelsPadding;
label.RotateTransform = actualRotation;
+ label.Paint = DataLabelsPaint;
var rad = Math.Sqrt(Math.Pow(cp.X - scaler.CenterX, 2) + Math.Pow(cp.Y - scaler.CenterY, 2));
@@ -435,7 +436,7 @@ public override void Invalidate(Chart chart)
var labelPosition = GetLabelPolarPosition(
scaler.CenterX, scaler.CenterY, (float)rad, scaler.GetAngle(coordinate.SecondaryValue),
- label.Measure(DataLabelsPaint), (float)GeometrySize, DataLabelsPosition);
+ label.Measure(), (float)GeometrySize, DataLabelsPosition);
label.X = labelPosition.X;
label.Y = labelPosition.Y;
diff --git a/src/LiveChartsCore/CoreRowSeries.cs b/src/LiveChartsCore/CoreRowSeries.cs
index 7cc498185..055969230 100644
--- a/src/LiveChartsCore/CoreRowSeries.cs
+++ b/src/LiveChartsCore/CoreRowSeries.cs
@@ -301,15 +301,16 @@ public override void Invalidate(Chart chart)
label.Text = DataLabelsFormatter(new ChartPoint(point));
label.TextSize = dls;
label.Padding = DataLabelsPadding;
+ label.Paint = DataLabelsPaint;
if (isFirstDraw)
label.CompleteTransition(
nameof(label.TextSize), nameof(label.X), nameof(label.Y), nameof(label.RotateTransform));
- var m = label.Measure(DataLabelsPaint);
+ var m = label.Measure();
var labelPosition = GetLabelPosition(
- cx, y, b, helper.uw, label.Measure(DataLabelsPaint),
- DataLabelsPosition, SeriesProperties, coordinate.PrimaryValue > Pivot, drawLocation, drawMarginSize);
+ cx, y, b, helper.uw, m, DataLabelsPosition, SeriesProperties,
+ coordinate.PrimaryValue > Pivot, drawLocation, drawMarginSize);
if (DataLabelsTranslate is not null) label.TranslateTransform =
new LvcPoint(m.Width * DataLabelsTranslate.Value.X, m.Height * DataLabelsTranslate.Value.Y);
diff --git a/src/LiveChartsCore/CoreScatterSeries.cs b/src/LiveChartsCore/CoreScatterSeries.cs
index 5157543ff..510ca1a56 100644
--- a/src/LiveChartsCore/CoreScatterSeries.cs
+++ b/src/LiveChartsCore/CoreScatterSeries.cs
@@ -285,12 +285,13 @@ public override void Invalidate(Chart chart)
label.Text = DataLabelsFormatter(new ChartPoint(point));
label.TextSize = dls;
label.Padding = DataLabelsPadding;
+ label.Paint = DataLabelsPaint;
if (isFirstDraw)
label.CompleteTransition(
nameof(label.TextSize), nameof(label.X), nameof(label.Y), nameof(label.RotateTransform));
- var m = label.Measure(DataLabelsPaint);
+ var m = label.Measure();
var labelPosition = GetLabelPosition(
x - hgs, y - hgs, gs, gs, m, DataLabelsPosition,
SeriesProperties, coordinate.PrimaryValue > 0, drawLocation, drawMarginSize);
diff --git a/src/LiveChartsCore/CoreStepLineSeries.cs b/src/LiveChartsCore/CoreStepLineSeries.cs
index b5d3230a6..15549e294 100644
--- a/src/LiveChartsCore/CoreStepLineSeries.cs
+++ b/src/LiveChartsCore/CoreStepLineSeries.cs
@@ -350,12 +350,13 @@ public override void Invalidate(Chart chart)
label.Text = DataLabelsFormatter(new ChartPoint(point));
label.TextSize = dls;
label.Padding = DataLabelsPadding;
+ label.Paint = DataLabelsPaint;
if (isFirstDraw)
label.CompleteTransition(
nameof(label.TextSize), nameof(label.X), nameof(label.Y), nameof(label.RotateTransform));
- var m = label.Measure(DataLabelsPaint);
+ var m = label.Measure();
var labelPosition = GetLabelPosition(
x - hgs, y - hgs, gs, gs, m, DataLabelsPosition,
SeriesProperties, coordinate.PrimaryValue > Pivot, drawLocation, drawMarginSize);
diff --git a/src/LiveChartsCore/Drawing/CoreBoxGeometry.cs b/src/LiveChartsCore/Drawing/CoreBoxGeometry.cs
index 68efdb892..9876f568c 100644
--- a/src/LiveChartsCore/Drawing/CoreBoxGeometry.cs
+++ b/src/LiveChartsCore/Drawing/CoreBoxGeometry.cs
@@ -94,7 +94,7 @@ public float Median
set => _medProperty.SetMovement(value, this);
}
- ///
- public override LvcSize Measure(Paint paintTasks) =>
+ ///
+ public override LvcSize Measure() =>
new(Width, Math.Abs(Min - Y));
}
diff --git a/src/LiveChartsCore/Drawing/CoreCandlestickGeometry.cs b/src/LiveChartsCore/Drawing/CoreCandlestickGeometry.cs
index 87c3dbb00..b15dd06d4 100644
--- a/src/LiveChartsCore/Drawing/CoreCandlestickGeometry.cs
+++ b/src/LiveChartsCore/Drawing/CoreCandlestickGeometry.cs
@@ -83,7 +83,7 @@ public float Low
set => _lProperty.SetMovement(value, this);
}
- ///
- public override LvcSize Measure(Paint paintTasks) =>
+ ///
+ public override LvcSize Measure() =>
new(Width, Math.Abs(Low - Y));
}
diff --git a/src/LiveChartsCore/Drawing/CoreGeometry.cs b/src/LiveChartsCore/Drawing/CoreGeometry.cs
index 4ac68580d..edaec36f0 100644
--- a/src/LiveChartsCore/Drawing/CoreGeometry.cs
+++ b/src/LiveChartsCore/Drawing/CoreGeometry.cs
@@ -203,6 +203,6 @@ public Paint? Fill
}
}
- ///
- public abstract LvcSize Measure(Paint drawableTask);
+ ///
+ public abstract LvcSize Measure();
}
diff --git a/src/LiveChartsCore/Drawing/CoreLabelGeometry.cs b/src/LiveChartsCore/Drawing/CoreLabelGeometry.cs
index 58054c56c..1d86fd84a 100644
--- a/src/LiveChartsCore/Drawing/CoreLabelGeometry.cs
+++ b/src/LiveChartsCore/Drawing/CoreLabelGeometry.cs
@@ -253,6 +253,6 @@ public Paint? Paint
Paint? IDrawable.Stroke { get; set; }
Paint? IDrawable.Fill { get; set; }
- ///
- public abstract LvcSize Measure(Paint drawableTask);
+ ///
+ public abstract LvcSize Measure();
}
diff --git a/src/LiveChartsCore/Drawing/CoreLineGeometry.cs b/src/LiveChartsCore/Drawing/CoreLineGeometry.cs
index 5db1ce4a3..9a79d25ee 100644
--- a/src/LiveChartsCore/Drawing/CoreLineGeometry.cs
+++ b/src/LiveChartsCore/Drawing/CoreLineGeometry.cs
@@ -65,7 +65,7 @@ public float Y1
set => _y1.SetMovement(value, this);
}
- ///
- public override LvcSize Measure(Paint drawable) =>
+ ///
+ public override LvcSize Measure() =>
new(Math.Abs(X1 - X), Math.Abs(Y1 - Y));
}
diff --git a/src/LiveChartsCore/Drawing/CoreNeedleGeometry.cs b/src/LiveChartsCore/Drawing/CoreNeedleGeometry.cs
index 98683314f..df74cb433 100644
--- a/src/LiveChartsCore/Drawing/CoreNeedleGeometry.cs
+++ b/src/LiveChartsCore/Drawing/CoreNeedleGeometry.cs
@@ -60,8 +60,8 @@ public float Width
set => _wProperty.SetMovement(value, this);
}
- ///
- public override LvcSize Measure(Paint paintTasks) =>
+ ///
+ public override LvcSize Measure() =>
new(Width, Radius);
}
diff --git a/src/LiveChartsCore/Drawing/CoreSizedGeometry.cs b/src/LiveChartsCore/Drawing/CoreSizedGeometry.cs
index ac822e3e1..e3d6bf927 100644
--- a/src/LiveChartsCore/Drawing/CoreSizedGeometry.cs
+++ b/src/LiveChartsCore/Drawing/CoreSizedGeometry.cs
@@ -60,7 +60,7 @@ public float Height
set => _heightProperty.SetMovement(value, this);
}
- ///
- public override LvcSize Measure(Paint paint) =>
+ ///
+ public override LvcSize Measure() =>
new(Width, Height);
}
diff --git a/src/LiveChartsCore/Drawing/CoreVectorGeometry.cs b/src/LiveChartsCore/Drawing/CoreVectorGeometry.cs
index 182d4ad2e..6897792fa 100644
--- a/src/LiveChartsCore/Drawing/CoreVectorGeometry.cs
+++ b/src/LiveChartsCore/Drawing/CoreVectorGeometry.cs
@@ -230,6 +230,6 @@ public override void CompleteTransition(params string[]? propertyName)
base.CompleteTransition(propertyName);
}
- ///
- public LvcSize Measure(Paint paint) => new();
+ ///
+ public LvcSize Measure() => new();
}
diff --git a/src/LiveChartsCore/Drawing/IDrawable.cs b/src/LiveChartsCore/Drawing/IDrawable.cs
index 8680cb0d7..8d9587270 100644
--- a/src/LiveChartsCore/Drawing/IDrawable.cs
+++ b/src/LiveChartsCore/Drawing/IDrawable.cs
@@ -107,9 +107,8 @@ public interface IDrawable : ITimeLineElement
///
/// Measures the instance.
///
- /// The paint.
/// The size.
- LvcSize Measure(Paint paint);
+ LvcSize Measure();
}
///
diff --git a/src/LiveChartsCore/Kernel/SeriesContext.cs b/src/LiveChartsCore/Kernel/SeriesContext.cs
index 24040f246..90a2bae75 100644
--- a/src/LiveChartsCore/Kernel/SeriesContext.cs
+++ b/src/LiveChartsCore/Kernel/SeriesContext.cs
@@ -308,7 +308,8 @@ private void CalculatePieLabelsOuterSpace()
label.TextSize = (float)series.DataLabelsSize;
label.Padding = series.DataLabelsPadding;
label.RotateTransform = r;
- var labelSize = label.Measure(series.DataLabelsPaint);
+ label.Paint = series.DataLabelsPaint;
+ var labelSize = label.Measure();
var h = 1.5f * (float)Math.Sqrt(Math.Pow(labelSize.Width, 2) + Math.Pow(labelSize.Height, 2));
if (h > _pieLabelsSize) _pieLabelsSize = h;
diff --git a/src/LiveChartsCore/VisualElements/LabelVisual.cs b/src/LiveChartsCore/VisualElements/LabelVisual.cs
index 5d9c02a6d..6992ef149 100644
--- a/src/LiveChartsCore/VisualElements/LabelVisual.cs
+++ b/src/LiveChartsCore/VisualElements/LabelVisual.cs
@@ -174,10 +174,11 @@ public override LvcSize Measure(Chart chart)
_labelGeometry.Padding = Padding;
_labelGeometry.LineHeight = LineHeight;
_labelGeometry.MaxWidth = MaxWidth;
+ _labelGeometry.Paint = _paint;
return _paint is null
? new LvcSize()
- : _labelGeometry.Measure(_paint);
+ : _labelGeometry.Measure();
}
private void InitializeLabel()
diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/ArcGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/ArcGeometry.cs
index 9eb68b6ee..3c554a3ea 100644
--- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/ArcGeometry.cs
+++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/ArcGeometry.cs
@@ -61,7 +61,7 @@ public virtual void OnDraw(SkiaSharpDrawingContext context, SKPaint paint)
context.Canvas.DrawPath(path, context.Paint);
}
- ///
- public override LvcSize Measure(Paint paintTasks) =>
+ ///
+ public override LvcSize Measure() =>
new();
}
diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/BoxGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/BoxGeometry.cs
index 289cf6c89..5309523c3 100644
--- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/BoxGeometry.cs
+++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/BoxGeometry.cs
@@ -78,7 +78,7 @@ public virtual void OnDraw(SkiaSharpDrawingContext context, SKPaint paint)
context.Canvas.DrawRect(x, yi, w, Math.Abs(o - c), paint);
}
- ///
- public override LvcSize Measure(Paint paintTasks) =>
+ ///
+ public override LvcSize Measure() =>
new(Width, Math.Abs(Min - Y));
}
diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/CandlestickGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/CandlestickGeometry.cs
index 3ad911e4d..f43d9d727 100644
--- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/CandlestickGeometry.cs
+++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/CandlestickGeometry.cs
@@ -67,7 +67,7 @@ public virtual void OnDraw(SkiaSharpDrawingContext context, SKPaint paint)
context.Canvas.DrawLine(cx, yj, cx, l, paint);
}
- ///
- public override LvcSize Measure(Paint paintTasks) =>
+ ///
+ public override LvcSize Measure() =>
new(Width, Math.Abs(Low - Y));
}
diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LabelGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LabelGeometry.cs
index 65a6a38d9..c277da44c 100644
--- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LabelGeometry.cs
+++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LabelGeometry.cs
@@ -25,7 +25,6 @@
using System.Linq;
using System.Text;
using LiveChartsCore.Drawing;
-using LiveChartsCore.Painting;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using SkiaSharp.HarfBuzz;
@@ -61,7 +60,7 @@ public virtual void OnDraw(SkiaSharpDrawingContext context, SKPaint paint)
var p = Padding;
var bg = Background;
- var size = Measure(context.PaintTask);
+ var size = Measure();
var isFirstLine = true;
var verticalPos =
@@ -135,10 +134,15 @@ public virtual void OnDraw(SkiaSharpDrawingContext context, SKPaint paint)
shaper?.Dispose();
}
- ///
- public override LvcSize Measure(Paint paint)
+ ///
+ public override LvcSize Measure()
{
- var skiaPaint = (SkiaPaint)paint;
+ if (Paint is null)
+ throw new Exception(
+ $"A paint is required to measure a label, please set the {nameof(Paint)} " +
+ $"property with the paint that is drawing the label.");
+
+ var skiaPaint = (SkiaPaint)Paint;
var typeface = skiaPaint.GetSKTypeface();
using var p = new SKPaint
diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LineGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LineGeometry.cs
index 7273e8a43..617de7530 100644
--- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LineGeometry.cs
+++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LineGeometry.cs
@@ -41,7 +41,7 @@ public void Draw(SkiaSharpDrawingContext ctx) =>
public virtual void OnDraw(SkiaSharpDrawingContext context, SKPaint paint) =>
context.Canvas.DrawLine(X, Y, X1, Y1, paint);
- ///
- public override LvcSize Measure(Paint drawable) =>
+ ///
+ public override LvcSize Measure() =>
new(Math.Abs(X1 - X), Math.Abs(Y1 - Y));
}
diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/NeedleGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/NeedleGeometry.cs
index b6dd3f988..f4543f0ba 100644
--- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/NeedleGeometry.cs
+++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/NeedleGeometry.cs
@@ -52,7 +52,7 @@ public virtual void OnDraw(SkiaSharpDrawingContext context, SKPaint paint)
context.Canvas.DrawCircle(X, Y, w, paint);
}
- ///
- public override LvcSize Measure(Paint paintTasks) =>
+ ///
+ public override LvcSize Measure() =>
new();
}
diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/SkiaSharpDrawingContext.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/SkiaSharpDrawingContext.cs
index f495298d3..d4c8f89b0 100644
--- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/SkiaSharpDrawingContext.cs
+++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/SkiaSharpDrawingContext.cs
@@ -156,7 +156,14 @@ public override void Draw(IDrawable drawable, float opacity)
{
_ = Canvas.Save();
- var m = element.Measure(PaintTask);
+ if (drawable is CoreLabelGeometry label)
+ {
+ var a = label.Text;
+ var b = 1;
+ var m1 = element.Measure();
+ }
+
+ var m = element.Measure();
var o = element.TransformOrigin;
var p = new SKPoint(element.X, element.Y);
@@ -200,7 +207,7 @@ public override void Draw(IDrawable drawable, float opacity)
//}
}
- if (Paint.IsStroke)
+ if (PaintTask.IsStroke)
{
if (element.Stroke is null) DrawByActivePaint(element, opacity);
else DrawByPaint(element.Stroke, element, opacity);