|
1 | 1 | @attribute [Route(pageUrl)] |
| 2 | +@layout DemosMainLayout |
2 | 3 |
|
3 | | -<PageHeroSection PageUrl="@pageUrl" |
4 | | - Title="@title" |
5 | | - Heading="@heading" |
6 | | - Description="@description" |
7 | | - ImageUrl="@imageUrl" /> |
| 4 | +<PageMetaTags PageUrl="@pageUrl" Title="@metaTitle" Description="@metaDescription" ImageUrl="@imageUrl" /> |
8 | 5 |
|
9 | | -<Prerequisites PageUrl="@pageUrl" /> |
| 6 | +<PageHero Title="@pageTitle"> |
| 7 | + <SubTitleTemplate> |
| 8 | + @((MarkupString)pageDescription) |
| 9 | + </SubTitleTemplate> |
| 10 | +</PageHero> |
| 11 | + |
| 12 | +<DocsLink Href="@RouteConstants.Docs_ScatterChart" /> |
10 | 13 |
|
11 | | -<Section Size="HeadingSize.H4" Text="How it works" PageUrl="@pageUrl" HashTagName="how-it-works" /> |
12 | | -<div class="mb-3"> |
13 | | - In the following example, a categorical 12-color palette is used. |
14 | | -</div> |
15 | | -<BlazorBootstrap.Callout Heading="TIP" Color="CalloutColor.Success"> |
16 | | - 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. |
17 | | - 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. |
18 | | -</BlazorBootstrap.Callout> |
| 14 | +<Prerequisites PageUrl="@pageUrl" /> |
19 | 15 |
|
20 | | -<Demo Type="typeof(ScatterChart_Demo_01_Examples)" Tabs="true" /> |
| 16 | +<Section Class="p-0" Size="HeadingSize.H4" Name="How it works" PageUrl="@pageUrl" Link="how-it-works"> |
| 17 | + <Block> |
| 18 | + The <strong>Scatter Chart</strong> component visualizes individual data points as (X, Y) coordinates, making it ideal for displaying relationships or distributions between two numeric variables. |
| 19 | + <br /><br /> |
| 20 | + <strong>How to use:</strong> |
| 21 | + <ul> |
| 22 | + <li>Add the <code>ScatterChart</code> component to your page and set its dimensions (e.g., <code>Width="560"</code>, <code>Height="480"</code>).</li> |
| 23 | + <li>Prepare your chart data by creating one or more <code>ScatterChartDataset</code> objects, each containing a list of <code>ScatterChartDataPoint</code> instances with X and Y values.</li> |
| 24 | + <li>Customize the appearance of each dataset using properties like <code>BackgroundColor</code>, <code>BorderColor</code>, and <code>BorderWidth</code>.</li> |
| 25 | + <li>Configure chart options using the <code>ScatterChartOptions</code> object as needed.</li> |
| 26 | + <li>Initialize the chart in <code>OnAfterRenderAsync</code> by calling <code>scatterChart.InitializeAsync(chartData, scatterChartOptions)</code>.</li> |
| 27 | + <li>Refer to the demo code below for practical examples of data preparation, dataset customization, and chart initialization.</li> |
| 28 | + </ul> |
| 29 | + This demo shows how to set up a scatter chart, bind your data, and customize the chart's appearance to fit your application's needs. |
| 30 | + </Block> |
| 31 | + <Demo Type="typeof(ScatterChart_Demo_01_Examples)" Tabs="true" /> |
| 32 | +</Section> |
21 | 33 |
|
22 | | -<Section Size="HeadingSize.H4" Text="How it works" PageUrl="@pageUrl" HashTagName="how-it-works" /> |
23 | | -<div class="mb-3"> |
24 | | - In the following example, a categorical 12-color palette is used. |
25 | | -</div> |
26 | | -<BlazorBootstrap.Callout Heading="TIP" Color="CalloutColor.Success"> |
27 | | - 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. |
28 | | - 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. |
29 | | -</BlazorBootstrap.Callout> |
30 | | -<Demo Type="typeof(ScatterChart_Demo_02_Dynamic_Data)" Tabs="true" /> |
| 34 | +<Section Class="p-0" Size="HeadingSize.H4" Name="Dynamic data" PageUrl="@pageUrl" Link="dynamic-data"> |
| 35 | + <Block> |
| 36 | + The <strong>Scatter Chart</strong> component supports dynamic data updates, allowing you to add, remove, or modify data points and datasets at runtime. This is useful for visualizing real-time data or enabling interactive data exploration. |
| 37 | + <br /><br /> |
| 38 | + <strong>How to use:</strong> |
| 39 | + <ul> |
| 40 | + <li>Add the <code>ScatterChart</code> component to your page and set its <code>Width</code> and <code>Height</code> as needed.</li> |
| 41 | + <li>Prepare your chart data using one or more <code>ScatterChartDataset</code> objects, each containing a list of <code>ScatterChartDataPoint</code> (with X and Y values).</li> |
| 42 | + <li>Implement methods to update your data dynamically, such as adding new points, randomizing values, or modifying existing datasets.</li> |
| 43 | + <li>After updating the data, call <code>scatterChart.UpdateAsync(chartData, scatterChartOptions)</code> to refresh the chart and reflect the changes.</li> |
| 44 | + <li>Refer to the demo code below for practical examples of dynamic data manipulation and chart updates in a Blazor application.</li> |
| 45 | + </ul> |
| 46 | + This demo demonstrates how to work with dynamic data in a scatter chart, enabling interactive and real-time data visualizations in your Blazor projects. |
| 47 | + </Block> |
| 48 | + <Demo Type="typeof(ScatterChart_Demo_02_Dynamic_Data)" Tabs="true" /> |
| 49 | +</Section> |
31 | 50 |
|
32 | 51 | @code { |
33 | | - private const string pageUrl = "/charts/scatter-chart"; |
34 | | - private const string title = "Blazor Scatter Chart"; |
35 | | - private const string heading = "Blazor Scatter Chart"; |
36 | | - private const string description = "A Blazor Bootstrap scatter chart components are based on basic line charts with the x-axis changed to a linear axis. To use a scatter chart, data must be passed as objects containing X and Y properties."; |
37 | | - private const string imageUrl = "https://i.imgur.com/MSFDsSo.png"; |
| 52 | + private const string pageUrl = RouteConstants.Demos_ScatterChart; |
| 53 | + private const string pageTitle = "Scatter Chart"; |
| 54 | + private const string pageDescription = "The <code>Blazor Scatter Chart</code> component displays data values as vertical bars, making it easy to compare multiple data sets or visualize trends over time."; |
| 55 | + private const string metaTitle = "Blazor Scatter Chart"; |
| 56 | + private const string metaDescription = "The Blazor Scatter Chart component displays data values as vertical bars, making it easy to compare multiple data sets or visualize trends over time."; |
| 57 | + private const string imageUrl = "https://i.imgur.com/IX3bajc.png"; // TODO: update with the actual image URL for the Bar Chart demo |
38 | 58 | } |
0 commit comments