Skip to content

Commit 9406379

Browse files
committed
added test case for data label
1 parent 77c9aeb commit 9406379

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

maui/src/Charts/Series/FastLineSeries.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Syncfusion.Maui.Toolkit.Charts
1616
/// <para> <b>Data Label - </b> Data labels are used to display values related to a chart segment. To render the data labels, you need to set the <see cref="ChartSeries.ShowDataLabels"/> property as <b>true</b> in <see cref="FastLineSeries"/> class. To customize the chart data labels alignment, placement, and label styles, you need to create an instance of <see cref="CartesianDataLabelSettings"/> and set to the <see cref="CartesianSeries.DataLabelSettings"/> property.</para>
1717
/// <para> <b>Animation - </b> To animate the series, set <b>True</b> to the <see cref="ChartSeries.EnableAnimation"/> property.</para>
1818
/// <para> <b>LegendIcon - </b> To customize the legend icon using the <see cref="ChartSeries.LegendIcon"/> property.</para>
19+
/// <para> The FastLineSeries does not support empty points.</para>
1920
/// </remarks>
2021
/// <example>
2122
/// # [Xaml](#tab/tabid-1)

maui/tests/Syncfusion.Maui.Toolkit.UnitTest/Chart/Features/DataLabelUnitTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,24 @@ public void GetLabelContent_VariousInputs_ReturnsExpectedContent(double value, s
601601
Assert.Equal(expectedContent, result);
602602
}
603603

604+
[Theory]
605+
[InlineData(double.NaN, "", "")]
606+
[InlineData(0, "0", "")]
607+
[InlineData(0, "000", "000")]
608+
[InlineData(123.456, "123", "#")]
609+
[InlineData(123.456, "123.46", "")]
610+
[InlineData(123.456, "123.456", "#.###")]
611+
[InlineData(123.0, "123", "0")]
612+
public void GetLabelContent_VariousInput_ReturnsExpectedContent(double value, string expectedContent, string format)
613+
{
614+
var cartesianDataLabelSettings = new CartesianDataLabelSettings
615+
{
616+
LabelStyle = new ChartDataLabelStyle { LabelFormat = format }
617+
};
618+
var result = cartesianDataLabelSettings.GetLabelContent(value);
619+
Assert.Equal(expectedContent, result);
620+
}
621+
604622
[Fact]
605623
public void GetDefaultTextColor_ReturnsExpectedColor()
606624
{

0 commit comments

Comments
 (0)