Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace BlazorBootstrap;

/// <summary>
/// The bar chart allows a number of properties to be specified for each dataset.
/// The bar chart allows a number of properties to be specified for each dataset.
/// These are used to set display properties for a specific dataset.
/// <see href="https://www.chartjs.org/docs/latest/charts/bar.html#dataset-properties" />
/// <seealso href="https://www.chartjs.org/docs/latest/charts/bar.html#general" />
/// </summary>
public class BarChartDataset : ChartDataset
public class BarChartDataset : ChartDataset<double?>
{
#region Properties, Indexers

Expand All @@ -29,11 +29,11 @@ public class BarChartDataset : ChartDataset
public double BarPercentage { get; set; } = 0.9;

/// <summary>
/// It is applied to the width of each bar, in pixels.
/// It is applied to the width of each bar, in pixels.
/// When this is enforced, barPercentage and categoryPercentage are ignored.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? BarThickness { get; set; }
Expand Down Expand Up @@ -75,33 +75,25 @@ public class BarChartDataset : ChartDataset
/// </remarks>
public double CategoryPercentage { get; set; } = 0.8;

/// <summary>
/// Get or sets the Data.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public new List<double?>? Data { get; set; }

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public BarChartDatasetDataLabels Datalabels { get; set; } = new(); // TODO: add the reference link

/// <summary>
/// Should the bars be grouped on index axis.
/// When <see langword="true"/>, all the datasets at same index value will be placed next to each other centering on that index value.
/// When <see langword="false"/>, each bar is placed on its actual index-axis value.
/// Should the bars be grouped on index axis.
/// When <see langword="true" />, all the datasets at same index value will be placed next to each other centering on that
/// index value.
/// When <see langword="false" />, each bar is placed on its actual index-axis value.
/// </summary>
/// <remarks>
/// Default value is <see langword="true"/>.
/// Default value is <see langword="true" />.
/// </remarks>
public bool Grouped { get; set; } = true;

/// <summary>
/// The bar background color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? HoverBackgroundColor { get; set; }
Expand All @@ -110,7 +102,7 @@ public class BarChartDataset : ChartDataset
/// The bar border color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? HoverBorderColor { get; set; }
Expand Down Expand Up @@ -138,7 +130,7 @@ public class BarChartDataset : ChartDataset
/// Supported values are 'x' and 'y'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? IndexAxis { get; set; }
Expand All @@ -150,7 +142,7 @@ public class BarChartDataset : ChartDataset
/// Set this to ensure that bars are not sized thicker than this.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? MaxBarThickness { get; set; }
Expand All @@ -159,7 +151,7 @@ public class BarChartDataset : ChartDataset
/// Set this to ensure that bars have a minimum length in pixels.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? MinBarLength { get; set; }
Expand All @@ -168,10 +160,11 @@ public class BarChartDataset : ChartDataset
//https://www.chartjs.org/docs/latest/configuration/elements.html#point-styles

/// <summary>
/// If <see langword="true"/>, null or undefined values will not be used for spacing calculations when determining bar size.
/// If <see langword="true" />, null or undefined values will not be used for spacing calculations when determining bar
/// size.
/// </summary>
/// <remarks>
/// Default value is <see langword="false"/>.
/// Default value is <see langword="false" />.
/// </remarks>
public bool SkipNull { get; set; }

Expand Down Expand Up @@ -199,6 +192,4 @@ public class BarChartDataset : ChartDataset
#endregion
}

public class BarChartDatasetDataLabels : ChartDatasetDataLabels
{
}
public class BarChartDatasetDataLabels : ChartDatasetDataLabels { }
14 changes: 7 additions & 7 deletions blazorbootstrap/Models/Charts/ChartDataset/ChartDataset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public interface IChartDataset { }
/// <summary>
/// <See href="https://www.chartjs.org/docs/latest/general/data-structures.html#dataset-configuration" />
/// </summary>
public class ChartDataset : IChartDataset
public class ChartDataset<TData> : IChartDataset
{
#region Constructors

Expand All @@ -24,7 +24,7 @@ public ChartDataset()
/// Clipping can also be configured per side: clip: {left: 5, top: false, right: -2, bottom: 0}
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Clip { get; set; }
Expand All @@ -33,16 +33,16 @@ public ChartDataset()
/// Get or sets the Data.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public object Data { get; set; }
public List<TData>? Data { get; set; }

/// <summary>
/// Configures the visibility state of the dataset. Set it to <see langword="true"/>, to hide the dataset from the chart.
/// Configures the visibility state of the dataset. Set it to <see langword="true" />, to hide the dataset from the chart.
/// </summary>
/// <remarks>
/// Default value is <see langword="false"/>.
/// Default value is <see langword="false" />.
/// </remarks>
public bool Hidden { get; set; }

Expand Down Expand Up @@ -75,7 +75,7 @@ public ChartDataset()
/// Gets or sets the chart type.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Type { get; protected set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace BlazorBootstrap;

/// <summary>
/// The doughnut/pie chart allows a number of properties to be specified for each dataset.
/// The doughnut/pie chart allows a number of properties to be specified for each dataset.
/// These are used to set display properties for a specific dataset.
/// <see href="https://www.chartjs.org/docs/latest/charts/doughnut.html#dataset-properties" />.
/// </summary>
public class DoughnutChartDataset : ChartDataset
public class DoughnutChartDataset : ChartDataset<double?>
{
#region Properties, Indexers

Expand All @@ -20,7 +20,7 @@ public class DoughnutChartDataset : ChartDataset

/// <summary>
/// Supported values are 'center' and 'inner'.
/// When 'center' is set, the borders of arcs next to each other will overlap.
/// When 'center' is set, the borders of arcs next to each other will overlap.
/// When 'inner' is set, it is guaranteed that all borders will not overlap.
/// </summary>
/// <remarks>
Expand All @@ -42,7 +42,7 @@ public class DoughnutChartDataset : ChartDataset
/// Arc border length and spacing of dashes.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? BorderDash { get; set; }
Expand All @@ -60,7 +60,7 @@ public class DoughnutChartDataset : ChartDataset
/// Supported values are 'round', 'bevel', 'miter'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? BorderJoinStyle { get; set; } // TODO: change this to enum
Expand All @@ -87,28 +87,19 @@ public class DoughnutChartDataset : ChartDataset
/// Per-dataset override for the sweep that the arcs cover.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Circumference { get; set; }

/// <summary>
/// Get or sets the Data.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public new List<double?>? Data { get; set; }

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DoughnutChartDatasetDataLabels Datalabels { get; set; } = new(); // TODO: add the reference link

/// <summary>
/// Arc background color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? HoverBackgroundColor { get; set; }
Expand All @@ -117,16 +108,16 @@ public class DoughnutChartDataset : ChartDataset
/// Arc border color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? HoverBorderColor { get; set; }

/// <summary>
/// Arc border length and spacing of dashes when hovered.
/// Arc border length and spacing of dashes when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? HoverBorderDash { get; set; }
Expand All @@ -135,7 +126,7 @@ public class DoughnutChartDataset : ChartDataset
/// Arc border offset for line dashes when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? HoverBorderDashOffset { get; set; }
Expand All @@ -145,7 +136,7 @@ public class DoughnutChartDataset : ChartDataset
/// Supported values are 'round', 'bevel', 'miter'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? HoverBorderJoinStyle { get; set; } // TODO: change this to enum
Expand All @@ -154,7 +145,7 @@ public class DoughnutChartDataset : ChartDataset
/// Arc border width when hovered (in pixels).
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? HoverBorderWidth { get; set; }
Expand All @@ -181,7 +172,7 @@ public class DoughnutChartDataset : ChartDataset
/// Per-dataset override for the starting angle to draw arcs from.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Rotation { get; set; }
Expand All @@ -195,8 +186,8 @@ public class DoughnutChartDataset : ChartDataset
public double Spacing { get; set; }

/// <summary>
/// The relative thickness of the dataset.
/// Providing a value for weight will cause the pie or doughnut dataset to be drawn
/// The relative thickness of the dataset.
/// Providing a value for weight will cause the pie or doughnut dataset to be drawn
/// with a thickness relative to the sum of all the dataset weight values.
/// </summary>
/// <remarks>
Expand All @@ -207,6 +198,4 @@ public class DoughnutChartDataset : ChartDataset
#endregion
}

public class DoughnutChartDatasetDataLabels : ChartDatasetDataLabels
{
}
public class DoughnutChartDatasetDataLabels : ChartDatasetDataLabels { }
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// These are used to set display properties for a specific dataset.
/// <see href="https://www.chartjs.org/docs/latest/charts/line.html#dataset-properties" />.
/// </summary>
public class LineChartDataset : ChartDataset
public class LineChartDataset : ChartDataset<double?>
{
#region Methods

Expand Down Expand Up @@ -188,17 +188,9 @@ public LineChartDataset FillToValue(double value)
/// Default value is 'default'.
/// </remarks>
public string CubicInterpolationMode { get; set; } = "default";

/// <summary>
/// Get or sets the Data.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public new List<double?>? Data { get; set; }

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public LineChartDatasetDataLabels Datalabels { get; set; } = new(); // TODO: add the reference link

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public LineChartDatasetDataLabels Datalabels { get; set; } = new(); // TODO: add the reference link

/// <summary>
/// Draw the active points of a dataset over the other points of the dataset.
Expand Down
Loading
Loading