Skip to content

Commit 4b28ccd

Browse files
committed
Refactor chart dataset data labels structure
Removed data labels classes from `LineChartDataset`, `PieChartDataset`, `PolarAreaChartDataset`, `RadarChartDataset`, and `ScatterChartDataset`. Introduced new data labels classes in separate files under the `BlazorExpress.ChartJS` namespace, inheriting from `ChartDatasetDataLabels`. This change streamlines the dataset structure and improves code organization. NOTE: This commit message is auto-generated using GitHub Copilot.
1 parent b710920 commit 4b28ccd

10 files changed

Lines changed: 16 additions & 150 deletions

File tree

BlazorExpress.ChartJS/Models/ChartDataset/LineChart/LineChartDataset.cs

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public LineChartDataset FillToValue(double value)
118118
}
119119

120120
#endregion
121+
121122
#region Properties, Indexers
122123

123124
/// <summary>
@@ -444,67 +445,3 @@ public LineChartDataset FillToValue(double value)
444445

445446
#endregion
446447
}
447-
448-
public class LineChartDatasetDataLabels
449-
{
450-
#region Fields and Constants
451-
452-
private Alignment alignment;
453-
454-
private Anchor anchor;
455-
456-
#endregion
457-
458-
#region Properties, Indexers
459-
460-
/// <summary>
461-
/// Gets or sets the data labels alignment.
462-
/// </summary>
463-
/// <remarks>
464-
/// Default value is <see cref="Alignment.Center"/>.
465-
/// </remarks>
466-
[JsonIgnore]
467-
public Alignment Alignment
468-
{
469-
get => alignment;
470-
set
471-
{
472-
alignment = value;
473-
DataLabelsAlignment = value.ToAlignmentString();
474-
}
475-
}
476-
477-
/// <summary>
478-
/// Gets or sets the data labels anchor.
479-
/// </summary>
480-
/// <remarks>
481-
/// Default value is <see cref="Anchor.None"/>.
482-
/// </remarks>
483-
[JsonIgnore]
484-
public Anchor Anchor
485-
{
486-
get => anchor;
487-
set
488-
{
489-
anchor = value;
490-
DataLabelsAnchor = value.ToAnchorString();
491-
}
492-
}
493-
494-
/// <summary>
495-
/// Gets or sets the data labels alignment.
496-
/// Possible values: start, center, and end.
497-
/// </summary>
498-
[JsonPropertyName("align")]
499-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
500-
public string? DataLabelsAlignment { get; private set; }
501-
502-
/// <summary>
503-
/// Gets or sets the data labels anchor.
504-
/// Possible values: start, center, and end.
505-
/// </summary>
506-
[JsonPropertyName("anchor")]
507-
public string? DataLabelsAnchor { get; private set; }
508-
509-
#endregion
510-
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace BlazorExpress.ChartJS;
2+
3+
public class LineChartDatasetDataLabels : ChartDatasetDataLabels { }

BlazorExpress.ChartJS/Models/ChartDataset/PieChart/PieChartDataset.cs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -197,44 +197,3 @@ public class PieChartDataset : ChartDataset<double?>
197197

198198
#endregion
199199
}
200-
201-
public class PieChartDatasetDataLabels
202-
{
203-
#region Fields and Constants
204-
205-
private Anchor anchor;
206-
207-
#endregion
208-
209-
#region Properties, Indexers
210-
211-
/// <summary>
212-
/// Gets or sets the data labels anchor.
213-
/// </summary>
214-
/// <remarks>
215-
/// Default value is <see cref="Anchor.None"/>.
216-
/// </remarks>
217-
[JsonIgnore]
218-
public Anchor Anchor
219-
{
220-
get => anchor;
221-
set
222-
{
223-
anchor = value;
224-
DataLabelsAnchor = value.ToAnchorString();
225-
}
226-
}
227-
228-
//public string? BackgroundColor { get; set; }
229-
230-
public double? BorderWidth { get; set; } = 2;
231-
232-
/// <summary>
233-
/// Gets or sets the data labels anchor.
234-
/// Possible values: start, center, and end.
235-
/// </summary>
236-
[JsonPropertyName("anchor")]
237-
public string? DataLabelsAnchor { get; private set; }
238-
239-
#endregion
240-
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace BlazorExpress.ChartJS;
2+
3+
public class PieChartDatasetDataLabels : ChartDatasetDataLabels { }

BlazorExpress.ChartJS/Models/ChartDataset/PolarAreaChart/PolarAreaChartDataset.cs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -137,44 +137,3 @@ public class PolarAreaChartDataset : ChartDataset<double?>
137137

138138
#endregion
139139
}
140-
141-
public class PolarAreaChartDatasetDataLabels
142-
{
143-
#region Fields and Constants
144-
145-
private Anchor anchor;
146-
147-
#endregion
148-
149-
#region Properties, Indexers
150-
151-
/// <summary>
152-
/// Gets or sets the data labels anchor.
153-
/// </summary>
154-
/// <remarks>
155-
/// Default value is <see cref="Anchor.None"/>.
156-
/// </remarks>
157-
[JsonIgnore]
158-
public Anchor Anchor
159-
{
160-
get => anchor;
161-
set
162-
{
163-
anchor = value;
164-
DataLabelsAnchor = value.ToAnchorString();
165-
}
166-
}
167-
168-
//public string? BackgroundColor { get; set; }
169-
170-
public double? BorderWidth { get; set; } = 2;
171-
172-
/// <summary>
173-
/// Gets or sets the data labels anchor.
174-
/// Possible values: start, center, and end.
175-
/// </summary>
176-
[JsonPropertyName("anchor")]
177-
public string? DataLabelsAnchor { get; private set; }
178-
179-
#endregion
180-
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace BlazorExpress.ChartJS;
2+
3+
public class PolarAreaChartDatasetDataLabels : ChartDatasetDataLabels { }

BlazorExpress.ChartJS/Models/ChartDataset/RadarChart/RadarChartDataset.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,5 +267,3 @@ public class RadarChartDataset : ChartDataset<double?>
267267

268268
#endregion
269269
}
270-
271-
public class RadarChartDatasetDataLabels : ChartDatasetDataLabels { }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace BlazorExpress.ChartJS;
2+
3+
public class RadarChartDatasetDataLabels : ChartDatasetDataLabels { }

BlazorExpress.ChartJS/Models/ChartDataset/ScatterChart/ScatterChartDataset.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,5 +337,3 @@ public class ScatterChartDataset : ChartDataset<ScatterChartDataPoint>
337337

338338
#endregion
339339
}
340-
341-
public class ScatterChartDatasetDataLabels : ChartDatasetDataLabels { }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace BlazorExpress.ChartJS;
2+
3+
public class ScatterChartDatasetDataLabels : ChartDatasetDataLabels { }

0 commit comments

Comments
 (0)