diff --git a/.editorconfig b/.editorconfig
index 7af7164..c938674 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -15,6 +15,9 @@ trim_trailing_whitespace = true
[project.json]
indent_size = 2
+[samples.json]
+indent_size = 2
+
# C# files
[*.cs]
# New line preferences
diff --git a/ChartJs.Blazor.Samples/Client/Pages/Charts/Line/Interpolation.razor b/ChartJs.Blazor.Samples/Client/Pages/Charts/Line/Interpolation.razor
new file mode 100644
index 0000000..dd27fec
--- /dev/null
+++ b/ChartJs.Blazor.Samples/Client/Pages/Charts/Line/Interpolation.razor
@@ -0,0 +1,118 @@
+@page "/charts/line/interpolation"
+@using ChartJs.Blazor.LineChart
+@layout SampleLayout
+
+
+
+
+
+@code {
+ private const int InitalCount = 12;
+ private int?[] _datapoints;
+ private Random _rng = new Random();
+ private LineConfig _config;
+ private Chart _chart;
+
+ protected override void OnInitialized()
+ {
+ _datapoints = new int?[] { 0, 20, 20, 60, 60, 120, null, 180, 120, 125, 105, 110, 170 };
+
+ _config = new LineConfig
+ {
+ Options = new LineOptions
+ {
+ Responsive = true,
+ Title = new OptionsTitle
+ {
+ Display = true,
+ Text = "ChartJs.Blazor Line Chart - Cubic interpolation mode"
+ },
+ Tooltips = new Tooltips
+ {
+ Mode = InteractionMode.Nearest,
+ Intersect = true
+ },
+ Hover = new Hover
+ {
+ Mode = InteractionMode.Nearest,
+ Intersect = true
+ },
+ Scales = new Scales
+ {
+ XAxes = new List
+ {
+ new CategoryAxis
+ {
+ ScaleLabel = new ScaleLabel()
+ }
+ },
+ YAxes = new List
+ {
+ new LinearCartesianAxis
+ {
+ ScaleLabel = new ScaleLabel
+ {
+ LabelString = "Value",
+ Display = true
+ },
+ Ticks = new LinearCartesianTicks
+ {
+ SuggestedMin = -10,
+ SuggestedMax = 200
+ }
+ }
+ }
+ }
+ }
+ };
+
+ IDataset dataset1 = new LineDataset(_datapoints)
+ {
+ Label = "Cubic interpolation (monotone)",
+ BackgroundColor = ColorUtil.FromDrawingColor(ChartColors.Red),
+ BorderColor = ColorUtil.FromDrawingColor(ChartColors.Red),
+ Fill = FillingMode.Disabled,
+ CubicInterpolationMode = CubicInterpolationMode.Monotone,
+ LineTension = 0.4
+ };
+
+ IDataset dataset2 = new LineDataset(_datapoints)
+ {
+ Label = "Cubic interpolation (default)",
+ BackgroundColor = ColorUtil.FromDrawingColor(ChartColors.Blue),
+ BorderColor = ColorUtil.FromDrawingColor(ChartColors.Blue),
+ Fill = FillingMode.Disabled,
+ LineTension = 0.4
+ };
+
+ IDataset dataset3 = new LineDataset(_datapoints)
+ {
+ Label = "Linear interpolation",
+ BackgroundColor = ColorUtil.FromDrawingColor(ChartColors.Green),
+ BorderColor = ColorUtil.FromDrawingColor(ChartColors.Green),
+ Fill = FillingMode.Disabled,
+ LineTension = 0
+ };
+
+ _config.Data.Labels.AddRange(Enumerable.Range(0, InitalCount).Select(i => i.ToString()));
+ _config.Data.Datasets.Add(dataset1);
+ _config.Data.Datasets.Add(dataset2);
+ _config.Data.Datasets.Add(dataset3);
+ }
+
+ private void RandomizeData()
+ {
+ for(int i = 0; i < _datapoints.Count(); i++)
+ {
+ _datapoints[i] = _rng.NextDouble() < 0.05 ? null : (int?)RandomScalingFactor();
+ }
+
+ foreach (IDataset dataset in _config.Data.Datasets)
+ {
+ dataset.Clear();
+ dataset.AddRange(_datapoints);
+ }
+
+ _chart.Update();
+ }
+}
diff --git a/ChartJs.Blazor.Samples/Server/samples.json b/ChartJs.Blazor.Samples/Server/samples.json
index f2e6e44..ef0ffe9 100644
--- a/ChartJs.Blazor.Samples/Server/samples.json
+++ b/ChartJs.Blazor.Samples/Server/samples.json
@@ -26,6 +26,10 @@
{
"Title": "Stepped",
"Path": "charts/line/stepped"
+ },
+ {
+ "Title": "Interpolation",
+ "Path": "charts/line/interpolation"
}
]
},