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

Special enums #84

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ac94266
Updated to preview9.
SeppPenner Sep 5, 2019
d2b95be
Merge branch 'master' of https://github.com/SeppPenner/ChartJSBlazor
Joelius300 Sep 11, 2019
b6211ea
Added polar area example.
SeppPenner Sep 13, 2019
a700480
Adjusted lists to arrays.
SeppPenner Sep 13, 2019
1c3cc4e
Fixed issue that doubles couldn't be automatically detected.
SeppPenner Sep 13, 2019
db06fec
Adjusted NavMenu in example project.
SeppPenner Sep 13, 2019
46e7bfd
Merge branch 'master' of https://github.com/SeppPenner/ChartJSBlazor
Joelius300 Sep 13, 2019
d302a38
Use explicit double array
Joelius300 Sep 13, 2019
ad9c571
Code style and spelling fixes, updated index page. (#81)
SeppPenner Sep 14, 2019
4883247
Update changelog
Joelius300 Sep 10, 2019
27eadb5
Update package version
Joelius300 Sep 10, 2019
8c08667
Fix list in details-tag, open 0.10.3 by default
Joelius300 Sep 10, 2019
d493d33
Mention canvas-id being readonly now
Joelius300 Sep 10, 2019
84ca875
Add how-to-update, rephrase static assets part
Joelius300 Sep 12, 2019
f9eabf5
Include information about code-cleanup
Joelius300 Sep 14, 2019
49f5f1f
Merge branch 'master' of https://github.com/Joelius300/ChartJSBlazor
SeppPenner Sep 16, 2019
dedc04b
Implemented border align as a special enum.
SeppPenner Sep 16, 2019
3c0d4df
Implemented font style as string enum.
SeppPenner Sep 16, 2019
52c9277
Implemented border cap style as string enum.
SeppPenner Sep 16, 2019
ebacc1e
Made border join style a string enum, small commentary fixes.
SeppPenner Sep 16, 2019
303e581
Made cubic interpolation mode a string enum.
SeppPenner Sep 16, 2019
0d07641
Added point style as string enum.
SeppPenner Sep 16, 2019
172b526
Added missing indexable options for border align.
SeppPenner Sep 16, 2019
822dfbc
Small documentation adjustment for font style.
SeppPenner Sep 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions ChartJs.Blazor/ChartJS/BubbleChart/BubbleDataset.cs
@@ -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,7 +47,11 @@ public class BubbleDataset
/// </summary>
public string Label { get; set; }

public string PointStyle { get; set; } = BubblePointStyle.circle.ToString();
/// <summary>
/// Gets or sets the point style.
/// <para>See https://www.chartjs.org/docs/latest/configuration/elements.html#point-styles for options.</para>
/// </summary>
public IndexableOption<PointStyle> PointStyle { get; set; }

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

Expand Down
16 changes: 0 additions & 16 deletions ChartJs.Blazor/ChartJS/BubbleChart/BubblePointStyle.cs

This file was deleted.

25 changes: 25 additions & 0 deletions ChartJs.Blazor/ChartJS/Common/Enums/BorderAlign.cs
@@ -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 class BorderAlign : StringEnum
{
/// <summary>
/// When '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 'inner' is set, it is guaranteed that all the borders are 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
@@ -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 class BorderCapStyle: StringEnum
{
/// <summary>
/// The butt border cap style.
/// </summary>
public static BorderCapStyle Butt => new BorderCapStyle("butt");

/// <summary>
/// The round border cap style.
/// </summary>
public static BorderCapStyle Round => new BorderCapStyle("round");

/// <summary>
/// The square border cap style.
/// </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
@@ -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 class BorderJoinStyle : StringEnum
{
/// <summary>
/// The bevel border join style.
/// </summary>
public static BorderJoinStyle Bevel => new BorderJoinStyle("bevel");

/// <summary>
/// The round border join style.
/// </summary>
public static BorderJoinStyle Round => new BorderJoinStyle("round");

/// <summary>
/// The miter border join style.
/// </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) { }
}
}
28 changes: 28 additions & 0 deletions ChartJs.Blazor/ChartJS/Common/Enums/CubicInterpolationMode.cs
@@ -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 class CubicInterpolationMode : StringEnum
{
/// <summary>
/// The default cubic interpolation mode.
/// </summary>
public static CubicInterpolationMode Default => new CubicInterpolationMode("default");

/// <summary>
/// The monotone cubic interpolation mode.
/// The 'default' algorithm uses a custom weighted cubic interpolation, which produces pleasant curves for all types of datasets.
/// </summary>
public static CubicInterpolationMode Monotone => new CubicInterpolationMode("monotone");

/// <summary>
/// Creates a new instance of the <see cref="CubicInterpolationMode"/> class.
/// The '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>
/// <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
@@ -0,0 +1,40 @@
namespace ChartJs.Blazor.ChartJS.Common.Enums
{
/// <summary>
/// Specifies the font style of axes.
/// <para>As per documentation here https://www.chartjs.org/docs/latest/axes/labelling.html</para>
/// </summary>
public class FontStyle : StringEnum
{
/// <summary>
/// The normal font style.
/// </summary>
public static FontStyle Normal => new FontStyle("normal");

/// <summary>
/// The italic font style.
/// </summary>
public static FontStyle Italic => new FontStyle("italic");

/// <summary>
/// The oblique font style.
/// </summary>
public static FontStyle Oblique => new FontStyle("oblique");

/// <summary>
/// The initial font style.
/// </summary>
public static FontStyle Initial => new FontStyle("initial");

/// <summary>
/// The inherit font style.
/// </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) { }
}
}
66 changes: 66 additions & 0 deletions ChartJs.Blazor/ChartJS/Common/Enums/PointStyle.cs
@@ -0,0 +1,66 @@

namespace ChartJs.Blazor.ChartJS.Common.Enums
{
/// <summary>
/// Specifies the point style.
/// <para>As per documentation here https://www.chartjs.org/docs/latest/configuration/elements.html#point-styles</para>
/// </summary>
public class PointStyle: StringEnum
{
/// <summary>
/// The circle point style.
/// </summary>
public static PointStyle Circle = new PointStyle("circle");

/// <summary>
/// The cross point style.
/// </summary>
public static PointStyle Cross = new PointStyle("cross");

/// <summary>
/// The crossRot point style.
/// </summary>
public static PointStyle CrossRot = new PointStyle("crossRot");

/// <summary>
/// The dash point style.
/// </summary>
public static PointStyle Dash = new PointStyle("dash");

/// <summary>
/// The line point style.
/// </summary>
public static PointStyle Line = new PointStyle("line");

/// <summary>
/// The rect point style.
/// </summary>
public static PointStyle Rect = new PointStyle("rect");

/// <summary>
/// The rectRounded point style.
/// </summary>
public static PointStyle RectRounded = new PointStyle("rectRounded");

/// <summary>
/// The rectRot point style.
/// </summary>
public static PointStyle RectRot = new PointStyle("rectRot");

/// <summary>
/// The star point style.
/// </summary>
public static PointStyle Star = new PointStyle("star");

/// <summary>
/// The triangle point style.
/// </summary>
public static PointStyle Triangle = new PointStyle("triangle");

/// <summary>
/// Creates a new instance of the <see cref="PointStyle"/> class.
/// </summary>
/// <param name="stringValue">The <see cref="string"/> value to set.</param>
private PointStyle(string stringValue) : base(stringValue) { }
}
}
9 changes: 4 additions & 5 deletions ChartJs.Blazor/ChartJS/Common/Legends/Labels.cs
@@ -1,4 +1,5 @@
using ChartJs.Blazor.Util;
using ChartJs.Blazor.ChartJS.Common.Enums;

namespace ChartJs.Blazor.ChartJS.Common.Legends
{
Expand All @@ -17,13 +18,11 @@ public class LegendLabelConfiguration
/// </summary>
public int FontSize { get; set; } = 12;

// TODO: implement with enum (normal, italic, oblique, initial, inherit)
/// <summary>
/// Font style of text.
///
/// <para>Supported fonts: http://www.chartjs.org/docs/latest/configuration/legend.html#legend-label-configuration </para>
/// Gets or sets the font style for a text, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
/// <para>As per documentation here https://www.chartjs.org/docs/latest/charts/doughnut.html#border-alignment</para>
/// </summary>
public string FontStyle { get; set; }
public FontStyle FontStyle { get; set; } = FontStyle.Normal;

/// <summary>
/// Color of text.
Expand Down
4 changes: 3 additions & 1 deletion ChartJs.Blazor/ChartJS/Common/SubTicks.cs
@@ -1,4 +1,5 @@
using ChartJs.Blazor.Util;
using ChartJs.Blazor.ChartJS.Common.Enums;

namespace ChartJs.Blazor.ChartJS.Common
{
Expand All @@ -25,8 +26,9 @@ public abstract class SubTicks

/// <summary>
/// Gets or sets the font style for a tick's label, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
/// <para>As per documentation here https://www.chartjs.org/docs/latest/charts/doughnut.html#border-alignment</para>
/// </summary>
public string FontStyle { get; set; }
public FontStyle FontStyle { get; set; } = FontStyle.Normal;

/// <summary>
/// Gets or sets the height of an individual line of text.
Expand Down
4 changes: 3 additions & 1 deletion ChartJs.Blazor/ChartJS/Common/Ticks.cs
@@ -1,4 +1,5 @@
using ChartJs.Blazor.Util;
using ChartJs.Blazor.ChartJS.Common.Enums;

namespace ChartJs.Blazor.ChartJS.Common
{
Expand Down Expand Up @@ -31,8 +32,9 @@ public abstract class Ticks

/// <summary>
/// Gets or sets the font style for the <see cref="Ticks"/> labels, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
/// <para>As per documentation here https://www.chartjs.org/docs/latest/charts/doughnut.html#border-alignment</para>
/// </summary>
public string FontStyle { get; set; }
public FontStyle FontStyle { get; set; } = FontStyle.Normal;

/// <summary>
/// Gets or sets the height of an individual line of text.
Expand Down
15 changes: 6 additions & 9 deletions ChartJs.Blazor/ChartJS/LineChart/LineDataset.cs
Expand Up @@ -49,26 +49,23 @@ public LineDataset(IEnumerable<TData> data) : this()
/// </summary>
public int BorderWidth { get; set; } = 1;

// TODO: Implement options
/// <summary>
/// Cap style of the line.
/// Gets or sets the cap style of the line.
/// <para>See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap for options.</para>
/// </summary>
public string BorderCapStyle { get; set; }
public BorderCapStyle BorderCapStyle { get; set; }

// TODO: Implement options
/// <summary>
/// Line joint style.
/// Gets or sets the line join style.
/// <para>See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin for options.</para>
/// </summary>
public string BorderJoinStyle { get; set; }
public BorderJoinStyle BorderJoinStyle { get; set; }

// TODO: Implement options
/// <summary>
/// Algorithm used to interpolate a smooth curve from the discrete data points.
/// Gets or sets the algorithm used to interpolate a smooth curve from the discrete data points.
/// <para>See https://www.chartjs.org/docs/latest/charts/line.html#cubicinterpolationmode for options.</para>
/// </summary>
public string CubicInterpolationMode { get; set; }
public CubicInterpolationMode CubicInterpolationMode { get; set; }

/// <summary>
/// Length and spacing of dashes. It's an int array. Whatever JS!
Expand Down
3 changes: 1 addition & 2 deletions ChartJs.Blazor/ChartJS/PieChart/PieDataset.cs
Expand Up @@ -22,12 +22,11 @@ public class PieDataset
/// </summary>
public IndexableOption<string> BackgroundColor { get; set; }

// Todo: Make this an enum later?!
/// <summary>
/// Gets or sets the border align. When 'center' is set, the borders of arcs next to each other will overlap.
/// When 'inner' is set, it is guaranteed that all the borders are not overlap.
/// </summary>
public string BorderAlign { get; set; } = "center";
public IndexableOption<BorderAlign> BorderAlign { get; set; }

/// <summary>
/// Gets or sets the border color of the arcs in the dataset.
Expand Down