Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<div class="table-attr">
<h4>@Title</h4>
<p class="table-attr-desc">
<span class="code-label">@Title</span>
@if (Type != null)
{
<span class="table-attr-mark">Automatically generated</span>
}
</p>

<Table TItem="AttributeItem" Items="Items" ShowFooter="@ShowFooter">
<Table TItem="AttributeItem" Items="Items" IsBordered="true" IsStriped="true" ShowFooter="@ShowFooter">
<TableColumns>
<TableColumn @bind-Field="@context.Name" />
<TableColumn @bind-Field="@context.Description" TextWrap="true" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.table-attr {
margin-top: 1rem;
}

.table-attr-desc {
display: flex;
justify-content: space-between;
}

.table-attr-mark {
font-size: 90%;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/chart/index"
@page "/chart/index"
@layout MainLayout
@inject IStringLocalizer<Index> Localizer

Expand All @@ -9,6 +9,6 @@

<p class="mt-2">@((MarkupString)Localizer["ChartIntro2"].Value)</p>

<AttributeTable Items="@GetAttributes()" />
<AttributeTable Type="typeof(Chart)" />

<MethodTable Items="@GetMethodAttributes()" />
142 changes: 1 addition & 141 deletions src/BootstrapBlazor.Server/Components/Samples/Charts/Index.razor.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,146 +10,6 @@ namespace BootstrapBlazor.Server.Components.Samples.Charts;
/// </summary>
public sealed partial class Index
{
/// <summary>
/// 获得属性列表
/// </summary>
/// <returns></returns>
private static AttributeItem[] GetAttributes() =>
[
new() {
Name = "Title",
Description = "图表标题",
Type = "string",
ValueList = " — ",
DefaultValue = " — "
},
new() {
Name = "Height",
Description = "组件高度支持单位, 如: 30% , 30px , 30em , calc(30%)",
Type = "string",
ValueList = " — ",
DefaultValue = " — "
},
new() {
Name = "Width",
Description = "组件宽度支持单位, 如: 30% , 30px , 30em , calc(30%)",
Type = "string",
ValueList = " — ",
DefaultValue = " — "
},
new() {
Name = "Responsive",
Description = "设置图表所在canvas是否随其容器大小变化而变化",
Type = "bool",
ValueList = "true|false",
DefaultValue = "true"
},
new() {
Name = "MaintainAspectRatio",
Description = "设置是否约束图表比例",
Type = "bool",
ValueList = "true|false",
DefaultValue = "true"
},
new() {
Name = "AspectRatio",
Description = "设置canvas的宽高比(值为1表示canvas是正方形),如果显示定义了canvas的高度,则此属性无效",
Type = "int",
ValueList = " - ",
DefaultValue = "2"
},
new() {
Name = "ResizeDelay",
Description = "设置 图表尺寸延迟变化时间",
Type = "int",
ValueList = " - ",
DefaultValue = "0"
},
new() {
Name = "Angle",
Description = "设置 Bubble 模式下显示角度 180 为 半圆 360 为正圆",
Type = "int",
ValueList = " - ",
DefaultValue = " - "
},
new() {
Name = "LoadingText",
Description = "设置正在加载文本",
Type = "string",
ValueList = " - ",
DefaultValue = " - "
},
new() {
Name = "ChartType",
Description = "图表组件渲染类型",
Type = "ChartType",
ValueList = "Line|Bar|Pie|Doughnut|Bubble",
DefaultValue = "Line"
},
new() {
Name = "ChartAction",
Description = "图表组件组件方法",
Type = "ChartAction",
ValueList = "Update|AddDataset|RemoveDataset|AddData|RemoveData|SetAngle|Reload",
DefaultValue = "Update"
},
new() {
Name = "DisplayLegend",
Description = "是否显示图例",
Type = "bool",
ValueList = "true|false",
DefaultValue = "true"
},
new() {
Name = "LegendPosition",
Description = "图例显示位置",
Type = "ChartLegendPosition",
ValueList = "Top|Bottom|Left|Right",
DefaultValue = "Top"
},
new()
{
Name = "OnInitAsync",
Description="组件数据初始化委托方法",
Type ="Func<Task<ChartDataSource>>",
ValueList = " - ",
DefaultValue = " - "
},
new()
{
Name = "OnAfterInitAsync",
Description="客户端绘制图表完毕后回调此委托方法",
Type ="Func<Task>",
ValueList = " - ",
DefaultValue = " - "
},
new()
{
Name = "OnAfterUpdateAsync",
Description="客户端更新图表完毕后回调此委托方法",
Type ="Func<ChartAction, Task>",
ValueList = " - ",
DefaultValue = " - "
},
new()
{
Name = "Update",
Description="更新图表方法",
Type ="Task",
ValueList = " - ",
DefaultValue = " - "
},
new()
{
Name = "Reload",
Description="重新加载,强制重新渲染图表",
Type ="Task",
ValueList = " - ",
DefaultValue = " - "
}

];

/// <summary>
/// 获得方法列表
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,4 @@
</Table>
</DemoBlock>

<AttributeTable Items="GetAttributes()" />

<MethodTable Items="GetMethods()" />

<AttributeTable Items="GetTableColumnAttributes()" Title="@Localizer["AttributeTitle"]" />
<AttributeTable Type="typeof(Table<>)" ShowFooter="true" />
Loading
Loading