diff --git a/src/ChartJSCore/Plugins/Annotation/Annotation.cs b/src/ChartJSCore/Plugins/Annotation/Annotation.cs index 0a8e67b..691fb62 100644 --- a/src/ChartJSCore/Plugins/Annotation/Annotation.cs +++ b/src/ChartJSCore/Plugins/Annotation/Annotation.cs @@ -11,22 +11,22 @@ public class Annotation /// /// Should the scale range be adjusted if this annotation is out of range. /// - public bool AdjustScaleRange { get; set; } = true; + public bool? AdjustScaleRange { get; set; } /// /// Fill color. /// - public ChartColor BackgroundColor { get; set; } = ChartColor.FromRgba(255, 99, 132, 1); + public ChartColor BackgroundColor { get; set; } /// /// Stroke color. /// - public ChartColor BorderColor { get; set; } = ChartColor.FromRgba(255, 99, 132, 1); + public ChartColor BorderColor { get; set; } public List BorderDash { get; set; } = new List(); - public int BorderDashOffset { get; set; } + public int? BorderDashOffset { get; set; } public ChartColor BorderShadowColor { get; set; } public bool Display { get; set; } = true; - public string DrawTime { get; set; } = "afterDatasetsDraw"; + public string DrawTime { get; set; } /// /// Identifies a unique id for the annotation and it will be stored in the element context. @@ -35,61 +35,60 @@ public class Annotation /// array, the id, passed by this option in the annotation, will be used. /// public string Id { get; set; } - public int ShadowBlur { get; set; } = 0; - public int ShadowOffsetX { get; set; } = 0; - public int ShadowOffsetY { get; set; } = 0; + public int? ShadowBlur { get; set; } + public int? ShadowOffsetX { get; set; } + public int? ShadowOffsetY { get; set; } /// /// Left edge of the box in units along the x axis. /// - public decimal xMin { get; set; } + public double? xMin { get; set; } /// /// Right edge of the box in units along the x axis. /// - public decimal xMax { get; set; } - + public double? xMax { get; set; } /// /// Top edge of the box in units along the y axis. /// - public decimal yMin { get; set; } + public double? yMin { get; set; } /// /// Bottom edge of the box in units along the y axis. /// - public decimal yMax { get; set; } + public double? yMax { get; set; } /// /// Adjustment along x-axis (left-right) of label relative to computed position. Negative values move the label left, positive right. /// - public decimal xAdjust { get; set; } = 0; + public double? xAdjust { get; set; } /// /// Adjustment along y-axis (top-bottom) of label relative to computed position. Negative values move the label up, positive down. /// - public decimal yAdjust { get; set; } = 0; + public double? yAdjust { get; set; } /// /// ID of the X scale to bind onto. If missing, the plugin will try to use the scale of the chart, /// configured as 'x' axis. If more than one scale has been defined in the chart as 'x' axis, the /// option is mandatory to select the right scale. /// - public decimal xScaleID { get; set; } = 0; + public string xScaleID { get; set; } /// /// ID of the Y scale to bind onto. If missing, the plugin will try to use the scale of the chart, configured as /// 'y' axis. If more than one scale has been defined in the chart as 'y' axis, the option is mandatory /// to select the right scale. /// - public decimal yScaleID { get; set; } = 0; + public string yScaleID { get; set; } /// /// The z property determines the drawing stack level of the label annotation element. /// All visible elements will be drawn in ascending order of z option, with the same drawTime option. /// - public decimal z { get; set; } = 0; - public decimal? Width { get; set; } + public double? z { get; set; } + public double? Width { get; set; } /// /// Overrides the height of the image or canvas element. Could be set in @@ -97,17 +96,17 @@ public class Annotation /// canvas element by a string. If undefined, uses the height of the /// image or canvas element. It is used only when the content is an image or canvas element. /// - public decimal? Height { get; set; } + public double? Height { get; set; } /// /// Anchor position of label on line. Options are: 'left', 'right' or 'center'. /// - public string Position { get; set; } = "center"; + public string Position { get; set; } /// /// Horizontal alignment of the label text. Options are: 'left', 'right' or 'center'. /// - public string TextPosition { get; set; } = "center"; + public string TextPosition { get; set; } /// /// Rotation of the label in degrees. diff --git a/src/ChartJSCore/Plugins/Annotation/LabelAnnotation.cs b/src/ChartJSCore/Plugins/Annotation/LabelAnnotation.cs index 47a7e81..c02f6ea 100644 --- a/src/ChartJSCore/Plugins/Annotation/LabelAnnotation.cs +++ b/src/ChartJSCore/Plugins/Annotation/LabelAnnotation.cs @@ -12,12 +12,12 @@ namespace ChartJSCore.Plugins.Annotation public class LabelAnnotation : Annotation { public string Type { get; private set; } = "label"; - public decimal? xValue { get; set; } - public decimal? yValue { get; set; } - public decimal? Height { get; set; } - public decimal? Width { get; set; } + public double? xValue { get; set; } + public double? yValue { get; set; } + public double? Height { get; set; } + public double? Width { get; set; } public List Content { get; set; } = new List(); public Font Font { get; set; } - public ChartColor Color { get; set; } = ChartColor.FromRgba(0, 0, 0, 1); + public ChartColor Color { get; set; } } } diff --git a/src/ChartJSCore/Plugins/Annotation/LineAnnotation.cs b/src/ChartJSCore/Plugins/Annotation/LineAnnotation.cs index 80d0e32..f6c5053 100644 --- a/src/ChartJSCore/Plugins/Annotation/LineAnnotation.cs +++ b/src/ChartJSCore/Plugins/Annotation/LineAnnotation.cs @@ -12,8 +12,8 @@ public class LineAnnotation : Annotation { public string Type { get; private set; } = "line"; public LabelAnnotation Label { get; set; } - public bool Curve { get; set; } + public bool? Curve { get; set; } public string ScaleID { get; set; } - public int BorderWidth { get; set; } = 2; + public int? BorderWidth { get; set; } } } diff --git a/src/ChartJSCore/Plugins/DataLabels/DataLabels.cs b/src/ChartJSCore/Plugins/DataLabels/DataLabels.cs index 8bb3a3b..3271c4a 100644 --- a/src/ChartJSCore/Plugins/DataLabels/DataLabels.cs +++ b/src/ChartJSCore/Plugins/DataLabels/DataLabels.cs @@ -22,7 +22,7 @@ public class DataLabels: Models.Options /// 'left': the label is positioned to the left of the anchor point(180°) /// 'top': the label is positioned to the top of the anchor point(270°) /// - public string Align { get; set; } = "center"; + public string Align { get; set; } /// /// An anchor point is defined by an orientation vector and a position on the data element. @@ -35,25 +35,25 @@ public class DataLabels: Models.Options /// 'start': lowest element boundary /// 'end': highest element boundary /// - public string Anchor { get; set; } = "center"; + public string Anchor { get; set; } public ChartColor BackgroundColor { get; set; } public ChartColor BorderColor { get; set; } - public int BorderRadius { get; set; } = 0; - public int BorderWidth { get; set; } = 0; + public int? BorderRadius { get; set; } + public int? BorderWidth { get; set; } /// /// The clamp option, when true, enforces the anchor position to be calculated based on /// the visible geometry of the associated element (i.e. part inside the chart area). /// - public bool Clamp { get; set; } = false; + public bool? Clamp { get; set; } /// /// When the clip option is true, the part of the label which is outside the chart /// area will be masked (see CanvasRenderingContext2D.clip() ) /// - public bool Clip { get; set; } = false; + public bool? Clip { get; set; } public ChartColor Color { get; set; } - public bool Display { get; set; } = true; + public bool? Display { get; set; } public Font Font { get; set; } public string Formatter { get; set; } @@ -62,15 +62,15 @@ public class DataLabels: Models.Options /// This option is not applicable when align is 'center'. Also note that if align is 'start', /// the label is moved in the opposite direction. The default value is 4. /// - public int Offset { get; set; } = 4; - public int Opacity { get; set; } = 1; + public int? Offset { get; set; } + public int? Opacity { get; set; } public Padding Padding { get; set; } - public int Rotation { get; set; } = 0; - public string TextAlign { get; set; } = "start"; + public int? Rotation { get; set; } + public string TextAlign { get; set; } public ChartColor TextStrokeColor { get; set; } - public int TextStrokeWidth { get; set; } = 0; - public int TextShadowBlur { get; set; } = 0; + public int? TextStrokeWidth { get; set; } + public int? TextShadowBlur { get; set; } public ChartColor TextShadowColor { get; set; } } }