Skip to content

Commit b39d4f1

Browse files
committed
Remove attributes and update ChartComponentBase methods
This commit removes the `AddedVersionAttribute` and `ParameterTypeNameAttribute` classes. The `BlazorExpress.Core` package version is updated from `0.0.4` to `0.1.0`. Several new asynchronous methods are added to the `ChartComponentBase` class, including `AddDataAsync`, `AddDatasetAsync`, and `InitializeAsync`, all marked with the `AddedVersion("1.0.0")` attribute. The `ResizeAsync` and `UpdateAsync` methods are updated with detailed XML documentation and versioning. New properties `Height` and `Width` are introduced, both marked with `AddedVersion("1.0.0")` and `ParameterTypeName("int?")`. NOTE: This commit message is auto-generated using GitHub Copilot.
1 parent d329eeb commit b39d4f1

4 files changed

Lines changed: 61 additions & 57 deletions

File tree

BlazorExpress.ChartJS/Attributes/AddedVersionAttribute.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

BlazorExpress.ChartJS/Attributes/ParameterTypeNameAttribute.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

BlazorExpress.ChartJS/BlazorExpress.ChartJS.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</ItemGroup>
3333

3434
<ItemGroup>
35-
<PackageReference Include="BlazorExpress.Core" Version="0.0.4" />
35+
<PackageReference Include="BlazorExpress.Core" Version="0.1.0" />
3636
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.17" />
3737
</ItemGroup>
3838

BlazorExpress.ChartJS/ChartComponents/Core/ChartComponentBase.cs

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,55 @@ public abstract class ChartComponentBase : BlazorExpressComponentCore, IDisposab
2626

2727
//public async Task ToBase64Image(string type, double quality) { }
2828

29+
/// <summary>
30+
/// Asynchronously adds a new data entry to the specified chart data.
31+
/// </summary>
32+
/// <param name="chartData">The chart data to which the new entry will be added.</param>
33+
/// <param name="dataLabel">The label associated with the new data entry.</param>
34+
/// <param name="data">The dataset containing the data to be added.</param>
35+
/// <returns>A task representing the asynchronous operation, with a result of the updated <see cref="ChartData"/>.</returns>
36+
[AddedVersion("1.0.0")]
37+
[Description("Asynchronously adds a new data entry to the specified chart data.")]
2938
public virtual async Task<ChartData> AddDataAsync(ChartData chartData, string dataLabel, IChartDatasetData data) => await Task.FromResult(chartData);
3039

40+
/// <summary>
41+
/// Asynchronously adds a new dataset to the specified chart data.
42+
/// </summary>
43+
/// <param name="chartData">The chart data to which the dataset will be added.</param>
44+
/// <param name="dataLabel">The label for the new dataset.</param>
45+
/// <param name="data">A read-only collection of data points to be included in the new dataset.</param>
46+
/// <returns>A task that represents the asynchronous operation. The task result contains the updated chart data with the new
47+
/// dataset added.</returns>
48+
[AddedVersion("1.0.0")]
49+
[Description("Asynchronously adds a new dataset to the specified chart data.")]
3150
public virtual async Task<ChartData> AddDataAsync(ChartData chartData, string dataLabel, IReadOnlyCollection<IChartDatasetData> data) => await Task.FromResult(chartData);
3251

52+
/// <summary>
53+
/// Asynchronously adds a dataset to the specified chart data.
54+
/// </summary>
55+
/// <param name="chartData">The chart data to which the dataset will be added.</param>
56+
/// <param name="chartDataset">The dataset to add to the chart data.</param>
57+
/// <param name="chartOptions">The options that configure the chart's appearance and behavior.</param>
58+
/// <returns>A task that represents the asynchronous operation. The task result contains the updated chart data with the new
59+
/// dataset added.</returns>
60+
[AddedVersion("1.0.0")]
61+
[Description("Asynchronously adds a dataset to the specified chart data.")]
3362
public virtual async Task<ChartData> AddDatasetAsync(ChartData chartData, IChartDataset chartDataset, IChartOptions chartOptions) => await Task.FromResult(chartData);
3463

3564
//public async Task Clear() { }
3665

3766
/// <summary>
38-
/// Initialize the chart.
67+
/// Asynchronously initializes the chart with the specified data and options.
3968
/// </summary>
40-
/// <param name="chartData"></param>
41-
/// <param name="chartOptions"></param>
42-
/// <param name="plugins"></param>
69+
/// <remarks>This method prepares the chart for rendering by invoking the necessary JavaScript functions
70+
/// to set up the chart with the provided data and options. Ensure that <paramref name="chartData"/> contains valid
71+
/// datasets before calling this method.</remarks>
72+
/// <param name="chartData">The data to be used for the chart. Must contain at least one dataset.</param>
73+
/// <param name="chartOptions">The options to configure the chart's appearance and behavior.</param>
74+
/// <param name="plugins">An optional array of plugin identifiers to enhance the chart's functionality.</param>
75+
/// <returns>A task that represents the asynchronous initialization operation.</returns>
76+
[AddedVersion("1.0.0")]
77+
[Description("Asynchronously initializes the chart with the specified data and options.")]
4378
public virtual async Task InitializeAsync(ChartData chartData, IChartOptions chartOptions, string[]? plugins = null)
4479
{
4580
if (chartData is not null && chartData.Datasets is not null && chartData.Datasets.Any())
@@ -54,12 +89,18 @@ public virtual async Task InitializeAsync(ChartData chartData, IChartOptions cha
5489
//public async Task Reset() { }
5590

5691
/// <summary>
57-
/// Resize the chart.
92+
/// Asynchronously resizes the chart to the specified dimensions.
5893
/// </summary>
59-
/// <param name="width"></param>
60-
/// <param name="height"></param>
61-
/// <param name="widthUnit"></param>
62-
/// <param name="heightUnit"></param>
94+
/// <remarks>This method updates the chart's dimensions by invoking a JavaScript function. Ensure that the
95+
/// chart is properly initialized before calling this method. The operation is performed asynchronously and will not
96+
/// block the calling thread.</remarks>
97+
/// <param name="width">The new width of the chart. Must be a non-negative integer.</param>
98+
/// <param name="height">The new height of the chart. Must be a non-negative integer.</param>
99+
/// <param name="widthUnit">The unit of measurement for the width. Defaults to pixels.</param>
100+
/// <param name="heightUnit">The unit of measurement for the height. Defaults to pixels.</param>
101+
/// <returns>A task that represents the asynchronous resize operation.</returns>
102+
[AddedVersion("1.0.0")]
103+
[Description("Asynchronously resizes the chart to the specified dimensions.")]
63104
public async Task ResizeAsync(int width, int height, Unit widthUnit = Unit.Px, Unit heightUnit = Unit.Px)
64105
{
65106
var widthWithUnit = $"width:{width.ToString(CultureInfo.InvariantCulture)}{widthUnit.ToCssString()}";
@@ -68,10 +109,15 @@ public async Task ResizeAsync(int width, int height, Unit widthUnit = Unit.Px, U
68109
}
69110

70111
/// <summary>
71-
/// Update the chart.
112+
/// Asynchronously updates the chart with the specified data and options.
72113
/// </summary>
73-
/// <param name="chartData"></param>
74-
/// <param name="chartOptions"></param>
114+
/// <remarks>This method updates the chart by invoking a JavaScript function to render the new data and
115+
/// options. Ensure that <paramref name="chartData"/> contains valid datasets to avoid no operation.</remarks>
116+
/// <param name="chartData">The data to be displayed on the chart. Must not be null and must contain at least one dataset.</param>
117+
/// <param name="chartOptions">The options to configure the chart's appearance and behavior.</param>
118+
/// <returns></returns>
119+
[AddedVersion("1.0.0")]
120+
[Description("Asynchronously updates the chart with the specified data and options.")]
75121
public virtual async Task UpdateAsync(ChartData chartData, IChartOptions chartOptions)
76122
{
77123
if (chartData is null || chartData.Datasets is null || !chartData.Datasets.Any())
@@ -169,6 +215,7 @@ private object GetChartDataObject(ChartData chartData)
169215
[AddedVersion("1.0.0")]
170216
[DefaultValue(null)]
171217
[Description("Gets or sets chart container height.")]
218+
[ParameterTypeName("int?")]
172219
[Parameter]
173220
public int? Height { get; set; }
174221

@@ -209,6 +256,7 @@ private object GetChartDataObject(ChartData chartData)
209256
[AddedVersion("1.0.0")]
210257
[DefaultValue(null)]
211258
[Description("Gets or sets chart container width.")]
259+
[ParameterTypeName("int?")]
212260
[Parameter]
213261
public int? Width { get; set; }
214262

0 commit comments

Comments
 (0)