Skip to content

Commit 49ae6ca

Browse files
committed
Enhance LineChart documentation and add Segment property
Updated the "Interpolation Modes" section in `LineChartDocumentation.razor` with detailed usage instructions for the `LineChart` component. Introduced a new `Segment` property in `LineChartDataset.cs` for customizing line segment styles, along with comprehensive documentation linking to Chart.js resources. NOTE: This commit message is auto-generated using GitHub Copilot.
1 parent 6d8e761 commit 49ae6ca

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

BlazorExpress.ChartJS.Demo.RCL/Pages/Demos/LineChart/LineChartDocumentation.razor

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,19 @@
9393

9494
<Section Class="p-0" Size="HeadingSize.H4" Name="Interpolation modes" PageUrl="@pageUrl" Link="interpolation-modes">
9595
<Block>
96-
TODO: Add a description for the Interpolation Modes section.
96+
The <strong>Interpolation Modes</strong> demo showcases how different interpolation settings affect the appearance and smoothness of lines in the <code>LineChart</code> component. Interpolation determines how data points are connected, allowing you to choose between straight lines, smooth curves, or monotone cubic curves for more natural transitions.
97+
<br /><br />
98+
<strong>How to use:</strong>
99+
<div class="content">
100+
<ol>
101+
<li>Prepare your chart data by defining <code>Labels</code> for the X-axis and one or more <code>Datasets</code> for the Y-axis values.</li>
102+
<li>For each dataset, set the <code>CubicInterpolationMode</code> property to control the interpolation style (e.g., <code>"monotone"</code> for monotone cubic interpolation, or leave unset for linear).</li>
103+
<li>Optionally, adjust the <code>Tension</code> property to fine-tune the curve smoothness.</li>
104+
<li>Add the <code>LineChart</code> component to your page, binding your data and options as shown in the demo code below.</li>
105+
<li>Experiment with different interpolation modes and tension values to achieve the desired visual effect for your data.</li>
106+
</ol>
107+
</div>
108+
Using interpolation modes helps you present trends more clearly, making your charts easier to interpret and visually appealing. Refer to the demo code for practical implementation details.
97109
</Block>
98110
<Demo Type="typeof(LineChart_Demo_05_Interpolation_Modes)" Tabs="true" />
99111
</Section>

BlazorExpress.ChartJS/Models/ChartDataset/LineChart/LineChartDataset.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,20 @@ public LineChartDataset FillToValue(double value)
512512
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
513513
public List<string>? PointStyle { get; set; }
514514

515-
//segment
516-
//https://www.chartjs.org/docs/latest/charts/line.html#segment
515+
/// <summary>
516+
/// Line segment styles can be overridden by scriptable options in the segment object. Currently, all of the Border* and <see cref="BackgroundColor" /> options are supported.
517+
/// The segment styles are resolved for each section of the line between each point.
518+
/// <para>
519+
/// Default value is <see langword="null"/>.
520+
/// </para>
521+
/// <see href="https://www.chartjs.org/docs/latest/charts/line.html#segment" />
522+
/// </summary>
523+
[AddedVersion("1.2.0")]
524+
[DefaultValue(null)]
525+
[Description("Line segment styles can be overridden by scriptable options in the segment object. Currently, all of the Border* and <code>BackgroundColor</code>> options are supported. The segment styles are resolved for each section of the line between each point.")]
526+
[ParameterTypeName("List<string>?")]
527+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
528+
public object? Segment { get; set; }
517529

518530
/// <summary>
519531
/// If <see langword="false" />, the line is not drawn for this dataset.

0 commit comments

Comments
 (0)