Skip to content

Commit c7f7a9e

Browse files
author
Mischa Spelt
committed
Add documentation
1 parent d687a46 commit c7f7a9e

6 files changed

+151
-34
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
@page "/charts/line-chart"
2+
3+
<PageTitle>@title</PageTitle>
4+
5+
<MetaTags PageUrl="@pageUrl" Title="@title" Description="@description" ImageUrl="@imageUrl" />
6+
7+
<h1>Blazor Line Chart</h1>
8+
<div class="lead mb-3">
9+
A Blazor Bootstrap line chart component is a graphical representation of data that uses a series of connected points to show how the data changes over time.
10+
It is a type of x-y chart, where the x-axis represents the independent variable, such as time, and the y-axis represents the dependent variable, such as the value.
11+
</div>
12+
13+
<CarbonAds />
14+
15+
<SectionHeading Size="HeadingSize.H4" Text="Prerequisites" PageUrl="@pageUrl" HashTagName="prerequisites" />
16+
<div class="mb-3">
17+
Refer to the <a href="/getting-started/blazor-webassembly">getting started guide</a> for setting up charts.
18+
</div>
19+
20+
<SectionHeading Size="HeadingSize.H4" Text="How it works" PageUrl="@pageUrl" HashTagName="how-it-works" />
21+
<div class="mb-3">
22+
In the following example, a <a href="/utils/color-utility#categorical-12-color">categorical 12-color</a> palette is used.
23+
</div>
24+
<Callout Heading="TIP" Color="CalloutColor.Success">
25+
For data visualization, you can use the predefined palettes <code>ColorUtility.CategoricalTwelveColors</code> for a 12-color palette and <code>ColorUtility.CategoricalSixColors</code> for a 6-color palette.
26+
These palettes offer a range of distinct and visually appealing colors that can be applied to represent different categories or data elements in your visualizations.
27+
</Callout>
28+
<Demo Type="typeof(LineChart_Demo_01_A_Examples)" Tabs="true" />
29+
<div class="my-3"></div>
30+
<Demo Type="typeof(LineChart_Demo_01_B_Examples)" Tabs="true" />
31+
32+
<SectionHeading Size="HeadingSize.H4" Text="Locale" PageUrl="@pageUrl" HashTagName="locale" />
33+
<div class="my-3">
34+
By default, the chart is using the default locale of the platform on which it is running.
35+
In the following example, you will see the chart in the <b>German</b> locale (<b>de_DE</b>).
36+
</div>
37+
<Demo Type="typeof(LineChart_Demo_02_Locale)" Tabs="true" />
38+
39+
<SectionHeading Size="HeadingSize.H4" Text="Add data dynamically for a specific dataset" PageUrl="@pageUrl" HashTagName="add-data-dynamically-for-a-specific-dataset" />
40+
<Demo Type="typeof(LineChart_Demo_03_Dynamically_add_data)" Tabs="true" />
41+
42+
<SectionHeading Size="HeadingSize.H4" Text="Data labels" PageUrl="@pageUrl" HashTagName="data-labels" />
43+
<Demo Type="typeof(LineChart_Demo_04_Datalabels)" Tabs="true" />
44+
45+
<SectionHeading Size="HeadingSize.H4" Text="Tick Configuration" PageUrl="@pageUrl" HashTagName="tick-configuration" />
46+
<Demo Type="typeof(LineChart_Demo_05_Tick_Configuration)" Tabs="true" />
47+
48+
<SectionHeading Size="HeadingSize.H4" Text="Fill between datasets" PageUrl="@pageUrl" HashTagName="dataset-fill" />
49+
<Demo Type="typeof(LineChart_Demo_06_Dataset_Fill)" Tabs="true" />
50+
51+
<<<<<<< HEAD
52+
<SectionHeading Size="HeadingSize.H4" Text="Time Axis" PageUrl="@pageUrl" HashTagName="time-axis" />
53+
<Demo Type="typeof(LineChart_Demo_07_Time_Axis)" Tabs="true" />
54+
=======
55+
<SectionHeading Size="HeadingSize.H4" Text="(Custom) Plugins" PageUrl="@pageUrl" HashTagName="plugins" />
56+
<Demo Type="typeof(LineChart_Demo_08_Plugins)" Tabs="true" />
57+
>>>>>>> pr-chartjs-plugins
58+
59+
@code {
60+
private readonly string pageUrl = "/charts/line-chart";
61+
private readonly string title = "Blazor Line Chart";
62+
private readonly string description = "A Blazor Bootstrap line chart component is a graphical representation of data that uses a series of connected points to show how the data changes over time. It is a type of x-y chart, where the x-axis represents the independent variable, such as time, and the y-axis represents the dependent variable, such as the value.";
63+
private readonly string imageUrl = "https://i.imgur.com/8b7jH0D.png";
64+
}

BlazorBootstrap.Demo.RCL/Components/Pages/Offcanvas/OffcanvasDocumentation.razor

+27-15
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<h1>Blazor Offcanvas</h1>
88
<div class="lead mb-3">
9-
Build hidden sidebars into your project for navigation, shopping carts, and more with a offcanvas component.
9+
Build hidden sidebars into your project for navigation, shopping carts, and more with a offcanvas component.
1010
</div>
1111

1212
<CarbonAds />
@@ -19,7 +19,7 @@
1919
<SectionHeading Size="HeadingSize.H2" Text="Dynamic component as offcanvas" PageUrl="@pageUrl" HashTagName="dynamic-component-as-offcanvas" />
2020
<div class="mb-3">Render different components dynamically within the offcanvas without iterating through possible types or using conditional logic.</div>
2121
<div class="mb-3">
22-
If dynamically-rendered components have component parameters, pass them as an <code>IDictionary</code>. The <code>string</code> is the parameter's name, and the <code>object</code> is the parameter's value.
22+
If dynamically-rendered components have component parameters, pass them as an <code>IDictionary</code>. The <code>string</code> is the parameter's name, and the <code>object</code> is the parameter's value.
2323
</div>
2424
<Demo Type="typeof(Offcanvas_Demo_02_A_Show_Dynamic_Component)" />
2525
<b>EmployeeDemoComponent1.razor</b>
@@ -28,12 +28,12 @@
2828
<SectionHeading Size="HeadingSize.H2" Text="Pass event callbacks to a dynamic component" PageUrl="@pageUrl" HashTagName="pass-event-callbacks-to-a-dynamic-component" />
2929
<div class="mb-3">Event callbacks <code>(EventCallback)</code> can be passed in its parameter dictionary.</div>
3030
<div class="mb-3">
31-
In the following parent component example, the <code>ShowDTMessage</code> method assigns a string with the current time to <code>message</code>, and the value of <code>message</code> is rendered.
32-
The parent component passes the callback method, ShowDTMessage in the parameter dictionary:
33-
<ul style="disc">
34-
<li>The <code>string</code> key is the callback method's name, <code>OnClickCallback</code>.</li>
35-
<li>The <code>object</code> value is created by <code>EventCallbackFactory.Create</code> for the parent callback method, <code>ShowDTMessage</code>.</li>
36-
</ul>
31+
In the following parent component example, the <code>ShowDTMessage</code> method assigns a string with the current time to <code>message</code>, and the value of <code>message</code> is rendered.
32+
The parent component passes the callback method, ShowDTMessage in the parameter dictionary:
33+
<ul style="disc">
34+
<li>The <code>string</code> key is the callback method's name, <code>OnClickCallback</code>.</li>
35+
<li>The <code>object</code> value is created by <code>EventCallbackFactory.Create</code> for the parent callback method, <code>ShowDTMessage</code>.</li>
36+
</ul>
3737
</div>
3838
<Demo Type="typeof(Offcanvas_Demo_02_B_Pass_Event_Callback_to_a_Dynamic_Component)" />
3939
<b>EmployeeDemoComponent2.razor</b>
@@ -45,9 +45,9 @@
4545

4646
<Callout Type="CalloutColor.Info">Default placement for the offcanvas component is right.</Callout>
4747

48-
<SectionHeading Size="HeadingSize.H2" Text="Static backdrop" PageUrl="@pageUrl" HashTagName="static-backdrop" />
49-
<div class="mb-3">When <b>UseStaticBackdrop</b> is set to <b>true</b>, the offcanvas will not close when clicking outside of it.</div>
50-
<Demo Type="typeof(Offcanvas_Demo_04_Static_Backdrop)" Tabs="true" />
48+
<SectionHeading Size="HeadingSize.H2" Text="Backdrop options" PageUrl="@pageUrl" HashTagName="backdrops" />
49+
<div class="mb-3">When <b>Backdrop</b> is set to <b>Offcanvas.BackdropType.Static</b>, the offcanvas will not close when clicking outside of it.</div>
50+
<Demo Type="typeof(Offcanvas_Demo_04_Backdrops)" Tabs="true" />
5151

5252
<SectionHeading Size="HeadingSize.H2" Text="Sizes" PageUrl="@pageUrl" HashTagName="sizes" />
5353
<div class="mb-3">Set the size of the <code>Offcanvas</code> with the Size parameter. The default value is <code>OffcanvasSize.Regular</code>.</div>
@@ -58,9 +58,21 @@
5858
<div class="mb-3">Blazor Bootstrap offcanvas component exposes a few events for hooking into offcanvas functionality.</div>
5959
<Demo Type="typeof(Offcanvas_Demo_06_Events)" Tabs="true" />
6060

61+
<SectionHeading Size="HeadingSize.H2" Text="Scrollable" PageUrl="@pageUrl" HashTagName="static-backdrop" />
62+
<div class="mb-3">When <b>IsScrollable</b> to <b>true</b> the page will be scrollable and interactable below the offcanvas backdrop.</div>
63+
<div class="mb-3">
64+
<Alert Color="AlertColor.Warning">Note: This demo does not work because the main viewport has <code>overflow: hidden</code> set in the CSS.</Alert>
65+
</div>
66+
<Demo Type="typeof(Offcanvas_Demo_07_Scrollable)" Tabs="true" />
67+
68+
<SectionHeading Size="HeadingSize.H2" Text="Bind IsVisible" PageUrl="@pageUrl" HashTagName="static-backdrop" />
69+
<div class="mb-3">You can read <code>IsVisible</code> to get the current status and use <code>@@bind-IsVisible</code> to toggle the offcanvas with a switch.</div>
70+
<Demo Type="typeof(Offcanvas_Demo_08_Bind_IsVisible)" Tabs="true" />
71+
72+
6173
@code {
62-
private string pageUrl = "/offcanvas";
63-
private string title = "Blazor Offcanvas Component";
64-
private string description = "Build hidden sidebars into your project for navigation, shopping carts, and more with Blazor Bootstrap offcanvas component.";
65-
private string imageUrl = "https://i.imgur.com/1vNz5Ci.jpg";
74+
private string pageUrl = "/offcanvas";
75+
private string title = "Blazor Offcanvas Component";
76+
private string description = "Build hidden sidebars into your project for navigation, shopping carts, and more with Blazor Bootstrap offcanvas component.";
77+
private string imageUrl = "https://i.imgur.com/1vNz5Ci.jpg";
6678
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@foreach( var backdrop in backdropTypes )
2+
{
3+
offcanvas.TryAdd( backdrop, default! );
4+
<Offcanvas @ref="offcanvas[ backdrop ]" Title="Offcanvas title" Backdrop="@backdrop">
5+
<BodyTemplate>
6+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tincidunt blandit mauris. Aliquam sit amet lorem laoreet, laoreet elit ut, placerat tellus. In mollis ultricies elit, volutpat maximus ipsum sodales interdum. Suspendisse eget tellus mollis, rutrum mauris ac, vulputate enim. Cras porta neque vitae lacinia elementum. Nunc sit amet pulvinar nibh. Curabitur interdum eget odio in tempor. Nulla dictum orci quis ligula auctor fermentum. Pellentesque finibus tellus ac massa convallis malesuada. Nam id pharetra velit, sed eleifend mi. Sed sed justo lorem. Quisque et nulla ut dolor feugiat vestibulum. Nunc at porttitor orci, at dignissim metus. Donec vitae metus vitae felis semper placerat.</p>
7+
<p>Proin quis congue enim, ut ultricies erat. Nulla facilisi. Fusce pretium, metus eget tempor vehicula, nisl lorem tincidunt metus, consectetur molestie lorem leo vel lectus. Vivamus pellentesque pharetra mattis. Aenean dignissim quam non velit ultrices rutrum. Aliquam lacinia faucibus sapien vel pretium. Nullam libero massa, ultricies id lacinia nec, scelerisque ut felis. Vivamus ac egestas urna, sit amet condimentum odio. Suspendisse ultrices, libero sed interdum pulvinar, lectus felis pellentesque enim, eu finibus magna massa id augue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget tempor libero. Cras ut interdum purus. Donec eu pulvinar urna, ut porttitor purus. Suspendisse sed sodales nunc. Quisque posuere augue sed luctus placerat.</p>
8+
<p>Morbi ullamcorper risus turpis, et ullamcorper nulla semper vitae. Proin pharetra dolor dui, non condimentum ex fermentum in. Vestibulum pharetra, risus et pulvinar eleifend, nulla tortor blandit risus, ac imperdiet elit massa quis leo. Vivamus urna lacus, luctus eget felis id, eleifend tristique nisl. Sed dignissim mollis ligula vitae laoreet. Vestibulum eget magna nisi. Aenean auctor elit et turpis blandit, eget porttitor felis suscipit. Duis placerat, sapien a sodales tempus, odio orci malesuada neque, ac molestie ipsum nisi vel eros. Integer sem lectus, luctus vitae sapien ut, efficitur aliquam sem. Praesent placerat est eros, vulputate rutrum nunc imperdiet vitae. Fusce sed felis eget purus aliquet convallis eu eget lacus. Sed finibus nec magna et accumsan. Donec vitae tellus eros. Nullam et ex vitae est sagittis malesuada. Vivamus molestie malesuada libero, a consequat magna dapibus pellentesque. Cras molestie tortor vitae congue pretium.</p>
9+
<p>Pellentesque nec iaculis justo, sed pretium sem. Mauris finibus lacus at mollis fringilla. Etiam auctor in justo ac bibendum. Vestibulum at lorem accumsan, maximus erat suscipit, suscipit ex. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris dignissim id quam sit amet varius. Etiam pretium ultrices dignissim. Cras at tortor hendrerit metus ultrices lobortis at ac est. Suspendisse consectetur pellentesque nunc sit amet scelerisque. Maecenas feugiat nunc laoreet, auctor erat eget, ultricies ex. Aliquam nisi nulla, cursus et ante ut, interdum volutpat leo. Phasellus laoreet aliquam maximus. Vestibulum eu neque porta, consectetur ipsum non, euismod enim. Vestibulum euismod purus elit, ultrices imperdiet nisl porttitor eget. Vivamus eros turpis, tincidunt a vulputate vel, malesuada tristique nulla.</p>
10+
<p>Vestibulum sed aliquam urna. Ut ullamcorper erat vitae velit mattis commodo. Phasellus dignissim rhoncus dapibus. Quisque congue egestas tellus id finibus. Suspendisse nibh felis, mattis et finibus vel, tempor in lectus. Nullam eget eros dui. Mauris eget vestibulum nibh. Nullam mattis malesuada lorem vel condimentum. Mauris id odio ac est feugiat condimentum.</p>
11+
</BodyTemplate>
12+
<FooterTemplate>
13+
<Button Color="ButtonColor.Secondary" @onclick="() => offcanvas[backdrop].HideAsync()">Close</Button>
14+
</FooterTemplate>
15+
</Offcanvas>
16+
}
17+
18+
@foreach( var backdrop in backdropTypes )
19+
{
20+
<Button Color="ButtonColor.Primary" @onclick="() => OnShowOffcanvasClick(backdrop)">Show offcanvas @backdrop</Button>
21+
}
22+
23+
@code {
24+
private IEnumerable<Offcanvas.BackdropType> backdropTypes = Enum.GetValues( typeof( Offcanvas.BackdropType ) ).Cast<Offcanvas.BackdropType>();
25+
private Dictionary<Offcanvas.BackdropType, Offcanvas> offcanvas = new();
26+
27+
private async Task OnShowOffcanvasClick( Offcanvas.BackdropType backdrop ) => await offcanvas[ backdrop ].ShowAsync();
28+
}

BlazorBootstrap.Demo.RCL/Components/Pages/Offcanvas/Offcanvas_Demo_04_Static_Backdrop.razor

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Offcanvas @ref="offcanvas" Title="Scrollable offcanvas" IsScrollable="true">
2+
<BodyTemplate>...</BodyTemplate>
3+
</Offcanvas>
4+
5+
<Button Color="ButtonColor.Primary" @onclick="() => OnShowOffcanvasClick()">Show scrollable canvas</Button>
6+
<p>After showing the canvas, note how you can still scroll this page and interact with it.</p>
7+
8+
@code {
9+
private Offcanvas offcanvas = default!;
10+
11+
private async Task OnShowOffcanvasClick() => await offcanvas.ShowAsync();
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Offcanvas Title="IsVisible binding" @bind-IsVisible="IsVisible" Backdrop="Offcanvas.BackdropType.None">
2+
<BodyTemplate>
3+
<Switch @bind-Value="IsVisible" Label="Toggle offcanvas" />
4+
5+
Note that no @@ref is needed to bind the property.
6+
</BodyTemplate>
7+
</Offcanvas>
8+
9+
<div>
10+
The offcanvas is <b>@(IsVisible ? "visible" : "hidden")</b>.
11+
12+
<Button Color="ButtonColor.Primary" @onclick="_ => IsVisible = true">Show Offcanvas</Button>
13+
</div>
14+
<div>
15+
<Switch @bind-Value="IsVisible" Label="Toggle offcanvas" />
16+
</div>
17+
18+
@code {
19+
public bool IsVisible { get; set; }
20+
}

0 commit comments

Comments
 (0)