Skip to content

Commit e5e8ec7

Browse files
mhspeltMischa Speltgvreddy04
authored
Chart axes type (#834)
* Add default axis types to ChartAxesType. (cherry picked from commit 248b81e) * Add documentation to reference new constatns * Code cleanup --------- Co-authored-by: Mischa Spelt <mischa.spelt@talumis.com> Co-authored-by: Vikram Reddy <gvreddy04@gmail.com>
1 parent cbf1b52 commit e5e8ec7

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

blazorbootstrap/Models/Charts/ChartOptions/ChartOptions.cs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class ChartOptions : IChartOptions
2424
/// <see href="https://www.chartjs.org/docs/latest/configuration/responsive.html#configuration-options" />.
2525
/// </summary>
2626
/// <remarks>
27-
/// Default value is <see langword="true"/>.
27+
/// Default value is <see langword="true" />.
2828
/// </remarks>
2929
public bool MaintainAspectRatio { get; set; } = true;
3030

@@ -36,10 +36,10 @@ public class ChartOptions : IChartOptions
3636

3737
/// <summary>
3838
/// Resizes the chart canvas when its container does.
39-
/// <see href="https://www.chartjs.org/docs/latest/configuration/responsive.html#configuration-options" />. ///
39+
/// <see href="https://www.chartjs.org/docs/latest/configuration/responsive.html#configuration-options" />. ///
4040
/// </summary>
4141
/// <remarks>
42-
/// Default value is <see langword="false"/>.
42+
/// Default value is <see langword="false" />.
4343
/// </remarks>
4444
public bool Responsive { get; set; }
4545

@@ -58,7 +58,7 @@ public class ChartLayout
5858
/// Apply automatic padding so visible elements are completely drawn.
5959
/// </summary>
6060
/// <remarks>
61-
/// Default value is <see langword="true"/>.
61+
/// Default value is <see langword="true" />.
6262
/// </remarks>
6363
public bool AutoPadding { get; set; } = true;
6464

@@ -71,7 +71,7 @@ public class ChartLayout
7171
}
7272

7373
/// <summary>
74-
/// Namespace: options.interaction, the global interaction configuration is at Chart.defaults.interaction.
74+
/// Namespace: options.interaction, the global interaction configuration is at Chart.defaults.interaction.
7575
/// <see href="https://www.chartjs.org/docs/latest/configuration/interactions.html#interactions" />.
7676
/// </summary>
7777
public class Interaction
@@ -122,7 +122,7 @@ private void SetMode(InteractionMode interactionMode) =>
122122
/// if <see langword="true" />, the interaction mode only applies when the mouse position intersects an item on the chart.
123123
/// </summary>
124124
/// <remarks>
125-
/// Default value is <see langword="true"/>.
125+
/// Default value is <see langword="true" />.
126126
/// </remarks>
127127
public bool Intersect { get; set; } = true;
128128

@@ -140,10 +140,10 @@ public InteractionMode Mode
140140
}
141141
}
142142

143+
#endregion
144+
143145
//includeInvisible
144146
//https://www.chartjs.org/docs/latest/configuration/interactions.html#interactions
145-
146-
#endregion
147147
}
148148

149149
public enum InteractionMode
@@ -160,11 +160,22 @@ public class Scales
160160
{
161161
#region Properties, Indexers
162162

163-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
164-
public ChartAxes? X { get; set; } = new();
163+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public ChartAxes? X { get; set; } = new();
164+
165+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public ChartAxes? Y { get; set; } = new();
166+
167+
#endregion
168+
}
169+
170+
public class ChartAxesType
171+
{
172+
#region Fields and Constants
165173

166-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
167-
public ChartAxes? Y { get; set; } = new();
174+
public static readonly string Linear = "linear";
175+
public static readonly string Logarithmic = "logarithmic";
176+
public static readonly string Category = "category";
177+
public static readonly string Time = "time";
178+
public static readonly string Timeseries = "timeseries";
168179

169180
#endregion
170181
}
@@ -232,10 +243,10 @@ public class ChartAxes
232243
public ChartAxesTitle? Title { get; set; }
233244

234245
/// <summary>
235-
/// Gets or sets the index scale type.
246+
/// Gets or sets the index scale type. See <see cref="ChartAxesType" />.
236247
/// </summary>
237248
/// <remarks>
238-
/// Default value is <see langword="null"/>.
249+
/// Default value is <see langword="null" />.
239250
/// </remarks>
240251
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
241252
public string? Type { get; set; }

0 commit comments

Comments
 (0)