Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Implemented all special enums. #87

Merged
merged 14 commits into from
Sep 29, 2019
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
2 changes: 1 addition & 1 deletion ChartJs.Blazor/ChartJS/BarChart/BarConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ namespace ChartJs.Blazor.ChartJS.BarChart
/// </summary>
public class BarConfig : ConfigBase<BarOptions, BarData>
{
public BarConfig(ChartTypes type = null) : base(type ?? ChartTypes.Bar) { }
public BarConfig(ChartType type = null) : base(type ?? ChartType.Bar) { }
}
}
4 changes: 2 additions & 2 deletions ChartJs.Blazor/ChartJS/BarChart/Dataset/BaseBarDataset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public BaseBarDataset(IEnumerable<TData> data) : this()
public BaseBarDataset() { }


public override ChartTypes Type => ChartTypes.Bar;
public override ChartType Type => ChartType.Bar;

/// <summary>
/// The label for the dataset which appears in the legend and tooltips.
Expand All @@ -42,7 +42,7 @@ public BaseBarDataset() { }
/// <summary>
/// Which edge to skip drawing the border for.
/// </summary>
public Positions BorderSkipped { get; set; }
public Position BorderSkipped { get; set; }

/// <summary>
/// The ID of the group to which this dataset belongs to (when stacked, each group will be a separate stack)
Expand Down
2 changes: 1 addition & 1 deletion ChartJs.Blazor/ChartJS/BubbleChart/BubbleConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ namespace ChartJs.Blazor.ChartJS.BubbleChart
{
public class BubbleConfig : ConfigBase<BubbleOptions, BubbleData>
{
public BubbleConfig() : base(ChartTypes.Bubble) { }
public BubbleConfig() : base(ChartType.Bubble) { }
}
}
16 changes: 10 additions & 6 deletions ChartJs.Blazor/ChartJS/BubbleChart/BubbleDataset.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using ChartJs.Blazor.ChartJS.Common;
using ChartJs.Blazor.ChartJS.Common.Enums;
using ChartJs.Blazor.Util;

Expand All @@ -25,13 +26,13 @@ public class BubbleDataset

public List<BubbleDataPoint> Data { get; set; } = new List<BubbleDataPoint> { new BubbleDataPoint { X = 1, Y = 2, r = 3 } };

/// <summary>
/// <para>See <see cref="ColorUtil"/> for working with colors.</para>
/// <summary>
/// <para>See <see cref="ColorUtil"/> for working with colors.</para>
/// </summary>
public string HoverBackgroundColor { get; set; }

/// <summary>
/// <para>See <see cref="ColorUtil"/> for working with colors.</para>
/// <summary>
/// <para>See <see cref="ColorUtil"/> for working with colors.</para>
/// </summary>
public string HoverBorderColor { get; set; }

Expand All @@ -46,12 +47,15 @@ public class BubbleDataset
/// </summary>
public string Label { get; set; }

public string PointStyle { get; set; } = BubblePointStyle.circle.ToString();
/// <summary>
/// Gets or sets the point style.
/// </summary>
public IndexableOption<PointStyle> PointStyle { get; set; }

public int Rotation { get; set; } = 0;

public int Radius { get; set; } = 3;

public ChartTypes Type { get; } = ChartTypes.Bubble;
public ChartType Type { get; } = ChartType.Bubble;
}
}
16 changes: 0 additions & 16 deletions ChartJs.Blazor/ChartJS/BubbleChart/BubblePointStyle.cs

This file was deleted.

6 changes: 3 additions & 3 deletions ChartJs.Blazor/ChartJS/Common/ConfigBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public abstract class ConfigBase
/// Creates a new instance of <see cref="ConfigBase"/>
/// </summary>
/// <param name="chartType">The chartType this config is for</param>
protected ConfigBase(ChartTypes chartType)
protected ConfigBase(ChartType chartType)
{
Type = chartType;
}

/// <summary>
/// Defines what type of chart this config is for
/// </summary>
public ChartTypes Type { get; }
public ChartType Type { get; }

/// <summary>
/// The id for the html canvas element associated with this chart
Expand All @@ -42,7 +42,7 @@ public abstract class ConfigBase<TOptions, TData> : ConfigBase
/// Creates a new instance of <see cref="ConfigBase"/>
/// </summary>
/// <param name="chartType">The chartType this config is for</param>
protected ConfigBase(ChartTypes chartType) : base(chartType)
protected ConfigBase(ChartType chartType) : base(chartType)
{
Data = new TData();
}
Expand Down
2 changes: 1 addition & 1 deletion ChartJs.Blazor/ChartJS/Common/Enums/AxisDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace ChartJs.Blazor.ChartJS.Common.Enums
/// <summary>
/// As per documentation here https://www.chartjs.org/docs/latest/axes/#common-configuration
/// </summary>
public class AxisDisplay: ObjectEnum
public sealed class AxisDisplay : ObjectEnum
{
/// <summary>
/// Hidden
Expand Down
3 changes: 1 addition & 2 deletions ChartJs.Blazor/ChartJS/Common/Enums/AxisType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/// <summary>
/// As per documentation here https://www.chartjs.org/docs/latest/axes/cartesian/
/// </summary>
///
public sealed class AxisType : StringEnum
{
/// <summary>
Expand All @@ -28,7 +27,7 @@ public sealed class AxisType : StringEnum
/// If only data.labels is defined, this will be used. If data.xLabels is defined and the axis is horizontal, this will be used.
/// Similarly, if data.yLabels is defined and the axis is vertical, this property will be used.
/// Using both xLabels and yLabels together can create a chart that uses strings for both the X and Y axes.
/// Specifying any of the settings above defines the x axis as type: 'category' if not defined otherwise.
/// Specifying any of the settings above defines the x axis as type: <see cref="AxisType.Category" /> if not defined otherwise.
/// For more fine-grained control of category labels it is also possible to add labels as part of the category axis definition.
/// Doing so does not apply the global defaults.
/// <para>See https://www.chartjs.org/docs/latest/axes/cartesian/category.html </para>
Expand Down
25 changes: 25 additions & 0 deletions ChartJs.Blazor/ChartJS/Common/Enums/BorderAlign.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace ChartJs.Blazor.ChartJS.Common.Enums
{
/// <summary>
/// Specifies the border alignment of a <see cref="PieChart"/> and a <see cref="PolarAreaChart"/>.
/// <para>As per documentation here https://www.chartjs.org/docs/latest/charts/doughnut.html#border-alignment </para>
/// </summary>
public sealed class BorderAlign : StringEnum
{
/// <summary>
/// When <see cref="BorderAlign.Center" /> is set, the borders of arcs next to each other will overlap. The default value.
/// </summary>
public static BorderAlign Center => new BorderAlign("center");

/// <summary>
/// When <see cref="BorderAlign.Inner" /> is set, it is guaranteed that all the borders will not overlap.
/// </summary>
public static BorderAlign Inner => new BorderAlign("inner");

/// <summary>
/// Creates a new instance of the <see cref="BorderAlign"/> class.
/// </summary>
/// <param name="stringValue">The <see cref="string"/> value to set.</param>
private BorderAlign(string stringValue) : base(stringValue) { }
}
}
30 changes: 30 additions & 0 deletions ChartJs.Blazor/ChartJS/Common/Enums/BorderCapStyle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace ChartJs.Blazor.ChartJS.Common.Enums
{
/// <summary>
/// Specifies the border cap style.
/// <para>As per documentation here https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap </para>
/// </summary>
public sealed class BorderCapStyle : StringEnum
{
/// <summary>
/// The ends of lines are squared off at the endpoints.
/// </summary>
public static BorderCapStyle Butt => new BorderCapStyle("butt");

/// <summary>
/// The ends of lines are rounded.
/// </summary>
public static BorderCapStyle Round => new BorderCapStyle("round");

/// <summary>
/// The ends of lines are squared off by adding a box with an equal width and half the height of the line's thickness.
/// </summary>
public static BorderCapStyle Square => new BorderCapStyle("square");

/// <summary>
/// Creates a new instance of the <see cref="BorderCapStyle"/> class.
/// </summary>
/// <param name="stringValue">The <see cref="string"/> value to set.</param>
private BorderCapStyle(string stringValue) : base(stringValue) { }
}
}
30 changes: 30 additions & 0 deletions ChartJs.Blazor/ChartJS/Common/Enums/BorderJoinStyle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace ChartJs.Blazor.ChartJS.Common.Enums
{
/// <summary>
/// Specifies the border join style.
/// <para>As per documentation here https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin </para>
/// </summary>
public sealed class BorderJoinStyle : StringEnum
{
/// <summary>
/// Fills an additional triangular area between the common endpoint of connected segments, and the separate outside rectangular corners of each segment.
/// </summary>
public static BorderJoinStyle Bevel => new BorderJoinStyle("bevel");

/// <summary>
/// Rounds off the corners of a shape by filling an additional sector of disc centered at the common endpoint of connected segments. The radius for these rounded corners is equal to the line width.
/// </summary>
public static BorderJoinStyle Round => new BorderJoinStyle("round");

/// <summary>
/// Connected segments are joined by extending their outside edges to connect at a single point, with the effect of filling an additional lozenge-shaped area.
/// </summary>
public static BorderJoinStyle Miter => new BorderJoinStyle("miter");

/// <summary>
/// Creates a new instance of the <see cref="BorderJoinStyle"/> class.
/// </summary>
/// <param name="stringValue">The <see cref="string"/> value to set.</param>
private BorderJoinStyle(string stringValue) : base(stringValue) { }
}
}
59 changes: 59 additions & 0 deletions ChartJs.Blazor/ChartJS/Common/Enums/ChartType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
namespace ChartJs.Blazor.ChartJS.Common.Enums
{
/// <summary>
/// Defines the chart types.
/// </summary>
public sealed class ChartType : StringEnum
{
/// <summary>
/// The bar chart type.
/// </summary>
public static ChartType Bar => new ChartType("bar");

/// <summary>
/// The horizontal bar chart type.
/// </summary>
public static ChartType HorizontalBar => new ChartType("horizontalBar");

/// <summary>
/// The line chart type.
/// </summary>
public static ChartType Line => new ChartType("line");

/// <summary>
/// The pie chart type.
/// </summary>
public static ChartType Pie => new ChartType("pie");

/// <summary>
/// The doughnut chart type.
/// </summary>
public static ChartType Doughnut => new ChartType("doughnut");

/// <summary>
/// The radar chart type.
/// </summary>
public static ChartType Radar => new ChartType("radar");

/// <summary>
/// The bubble chart type.
/// </summary>
public static ChartType Bubble => new ChartType("bubble");

/// <summary>
/// The polar area chart type.
/// </summary>
public static ChartType PolarArea => new ChartType("polarArea");

/// <summary>
/// The scatter chart type.
/// </summary>
public static ChartType Scatter => new ChartType("scatter");

/// <summary>
/// Creates a new instance of the <see cref="ChartType"/> class.
/// </summary>
/// <param name="stringValue">The <see cref="string"/> value to set.</param>
private ChartType(string stringValue) : base(stringValue) { }
}
}
22 changes: 0 additions & 22 deletions ChartJs.Blazor/ChartJS/Common/Enums/ChartTypes.cs

This file was deleted.

28 changes: 28 additions & 0 deletions ChartJs.Blazor/ChartJS/Common/Enums/CubicInterpolationMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace ChartJs.Blazor.ChartJS.Common.Enums
{
/// <summary>
/// Specifies the cubic interpolation mode.
/// <para>As per documentation here https://www.chartjs.org/docs/latest/charts/line.html#cubicinterpolationmode </para>
/// </summary>
public sealed class CubicInterpolationMode : StringEnum
{
/// <summary>
/// The default cubic interpolation mode.
/// The <see cref="CubicInterpolationMode.Default" /> algorithm uses a custom weighted cubic interpolation, which produces pleasant curves for all types of datasets.
/// </summary>
public static CubicInterpolationMode Default => new CubicInterpolationMode("default");

/// <summary>
/// The monotone cubic interpolation mode.
/// The <see cref="CubicInterpolationMode.Monotone" /> algorithm is more suited to y = f(x) datasets:
/// It preserves monotonicity (or piecewise monotonicity) of the dataset being interpolated, and ensures local extrema (if any) stay at input data points.
/// </summary>
public static CubicInterpolationMode Monotone => new CubicInterpolationMode("monotone");

/// <summary>
/// Creates a new instance of the <see cref="CubicInterpolationMode"/> class.
/// </summary>
/// <param name="stringValue">The <see cref="string"/> value to set.</param>
private CubicInterpolationMode(string stringValue) : base(stringValue) { }
}
}
40 changes: 40 additions & 0 deletions ChartJs.Blazor/ChartJS/Common/Enums/FontStyle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace ChartJs.Blazor.ChartJS.Common.Enums
{
/// <summary>
/// Specifies the css font style of text.
/// <para>As per documentation here https://developer.mozilla.org/en-US/docs/Web/CSS/font-style </para>
/// </summary>
public sealed class FontStyle : StringEnum
{
/// <summary>
/// Specifies a font that is classified as normal within a font-family.
/// </summary>
public static FontStyle Normal => new FontStyle("normal");

/// <summary>
/// Specifies a font that is classified as italic. If no italic version of the face is available, one classified as oblique is used instead. If neither is available, the style is artificially simulated.
/// </summary>
public static FontStyle Italic => new FontStyle("italic");

/// <summary>
/// Specifies a font that is classified as oblique. If no oblique version of the face is available, one classified as italic is used instead. If neither is available, the style is artificially simulated.
/// </summary>
public static FontStyle Oblique => new FontStyle("oblique");

/// <summary>
/// Specifies a font with its font style set to its default value.
/// </summary>
public static FontStyle Initial => new FontStyle("initial");

/// <summary>
/// Specifies a font that inherits the font style from its parent element.
/// </summary>
public static FontStyle Inherit => new FontStyle("inherit");

/// <summary>
/// Creates a new instance of the <see cref="FontStyle"/> class.
/// </summary>
/// <param name="stringValue">The <see cref="string"/> value to set.</param>
private FontStyle(string stringValue) : base(stringValue) { }
}
}
Loading