mirror of
https://github.com/dotnetcore/BootstrapBlazor.git
synced 2025-12-19 18:06:42 +08:00
Compare commits
4 Commits
f1154eda38
...
d06670cb6f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d06670cb6f | ||
|
|
3aba824723 | ||
|
|
0d0bf5c3ed | ||
|
|
264b9d6f5a |
@@ -29,7 +29,7 @@
|
||||
<PackageReference Include="BootstrapBlazor.BarCode" Version="10.0.0" />
|
||||
<PackageReference Include="BootstrapBlazor.BarcodeGenerator" Version="10.0.0" />
|
||||
<PackageReference Include="BootstrapBlazor.BootstrapIcon" Version="10.0.0" />
|
||||
<PackageReference Include="BootstrapBlazor.Chart" Version="10.0.0" />
|
||||
<PackageReference Include="BootstrapBlazor.Chart" Version="10.0.1" />
|
||||
<PackageReference Include="BootstrapBlazor.ChatBot" Version="10.0.0" />
|
||||
<PackageReference Include="BootstrapBlazor.CherryMarkdown" Version="10.0.1" />
|
||||
<PackageReference Include="BootstrapBlazor.CodeEditor" Version="10.0.0" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the Apache 2.0 License
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
|
||||
@@ -67,7 +67,11 @@ public partial class Bar
|
||||
ds.Labels = Enumerable.Range(1, _barDataCount).Select(i => i.ToString());
|
||||
for (var index = 0; index < _barDatasetCount; index++)
|
||||
{
|
||||
ds.Data.Add(new ChartDataset() { Label = $"Set {index}", Data = Enumerable.Range(1, _barDataCount).Select(i => Random.Shared.Next(20, 37) / 10.0f).Cast<object>() });
|
||||
ds.Data.Add(new ChartDataset()
|
||||
{
|
||||
Label = $"Set {index}",
|
||||
Data = Enumerable.Range(1, _barDataCount).Select(i => Random.Shared.Next(20, 37) / 10.0f).Cast<object>()
|
||||
});
|
||||
}
|
||||
|
||||
return Task.FromResult(ds);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@page "/chart/line"
|
||||
@page "/chart/line"
|
||||
@inject IStringLocalizer<Line> Localizer
|
||||
@inject CodeSnippetService CodeSnippetService
|
||||
@inherits WebSiteModuleComponentBase
|
||||
@@ -11,8 +11,8 @@
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" @onclick="e => Utility.RandomData(_lineChart)"><i class="fa-solid fa-chart-line"></i><span>@Localizer["LineOnInitRandomData"]</span></button>
|
||||
<button class="btn btn-primary" @onclick="OnReloadChart"><i class="fa-solid fa-chart-column"></i><span>@Localizer["LineOnInitReload"]</span></button>
|
||||
<button class="btn btn-primary" @onclick="e => Utility.AddDataSet(_lineChart, ref _lineDatasetCount)"><i class="fa-solid fa-circle-plus"></i><span>@Localizer["LineOnInitAddDataset"]</span></button>
|
||||
<button class="btn btn-primary" @onclick="e => Utility.RemoveDataSet(_lineChart, ref _lineDatasetCount)"><i class="fa-solid fa-circle-minus"></i><span>@Localizer["LineOnInitRemoveDataset"]</span></button>
|
||||
<button class="btn btn-primary" @onclick="AddDataset"><i class="fa-solid fa-circle-plus"></i><span>@Localizer["LineOnInitAddDataset"]</span></button>
|
||||
<button class="btn btn-primary" @onclick="RemoveDataset"><i class="fa-solid fa-circle-minus"></i><span>@Localizer["LineOnInitRemoveDataset"]</span></button>
|
||||
<button class="btn btn-primary" @onclick="e => Utility.AddData(_lineChart, ref _lineDataCount)"><i class="fa-solid fa-plus"></i><span>@Localizer["LineOnInitAddingData"]</span></button>
|
||||
<button class="btn btn-primary" @onclick="e => Utility.RemoveData(_lineChart, ref _lineDataCount)"><i class="fa-solid fa-minus"></i><span>@Localizer["LineOnInitRemoveData"]</span></button>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the Apache 2.0 License
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
|
||||
@@ -85,6 +85,26 @@ public partial class Line : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
private async Task AddDataset()
|
||||
{
|
||||
var dataset = new ChartDataset()
|
||||
{
|
||||
BorderWidth = _randomer.Next(1, 5),
|
||||
Label = $"Set {DateTime.Now:mmss}",
|
||||
Data = Enumerable.Range(1, _lineDataCount).Select((i, index) => (object)_randomer.Next(20, 37)),
|
||||
ShowPointStyle = true,
|
||||
PointStyle = chartPointStyles[_randomer.Next(0, 9)],
|
||||
PointRadius = 5,
|
||||
PointHoverRadius = 10
|
||||
};
|
||||
await _lineChart.AddDataset(dataset, 0);
|
||||
}
|
||||
|
||||
private async Task RemoveDataset()
|
||||
{
|
||||
await _lineChart.RemoveDatasetAt(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user