Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mattosaurus committed Dec 6, 2024
2 parents 025dad9 + c6f76d9 commit c28da86
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 42 deletions.
43 changes: 21 additions & 22 deletions src/ChartJSCore/Plugins/Annotation/Annotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ public class Annotation
/// <summary>
/// Should the scale range be adjusted if this annotation is out of range.
/// </summary>
public bool AdjustScaleRange { get; set; } = true;
public bool? AdjustScaleRange { get; set; }

/// <summary>
/// Fill color.
/// </summary>
public ChartColor BackgroundColor { get; set; } = ChartColor.FromRgba(255, 99, 132, 1);
public ChartColor BackgroundColor { get; set; }

/// <summary>
/// Stroke color.
/// </summary>
public ChartColor BorderColor { get; set; } = ChartColor.FromRgba(255, 99, 132, 1);
public ChartColor BorderColor { get; set; }
public List<int> BorderDash { get; set; } = new List<int>();
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; }

/// <summary>
/// Identifies a unique id for the annotation and it will be stored in the element context.
Expand All @@ -35,79 +35,78 @@ public class Annotation
/// array, the id, passed by this option in the annotation, will be used.
/// </summary>
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; }

/// <summary>
/// Left edge of the box in units along the x axis.
/// </summary>
public decimal xMin { get; set; }
public double? xMin { get; set; }

/// <summary>
/// Right edge of the box in units along the x axis.
/// </summary>
public decimal xMax { get; set; }

public double? xMax { get; set; }

/// <summary>
/// Top edge of the box in units along the y axis.
/// </summary>
public decimal yMin { get; set; }
public double? yMin { get; set; }

/// <summary>
/// Bottom edge of the box in units along the y axis.
/// </summary>
public decimal yMax { get; set; }
public double? yMax { get; set; }

/// <summary>
/// Adjustment along x-axis (left-right) of label relative to computed position. Negative values move the label left, positive right.
/// </summary>
public decimal xAdjust { get; set; } = 0;
public double? xAdjust { get; set; }

/// <summary>
/// Adjustment along y-axis (top-bottom) of label relative to computed position. Negative values move the label up, positive down.
/// </summary>
public decimal yAdjust { get; set; } = 0;
public double? yAdjust { get; set; }

/// <summary>
/// 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.
/// </summary>
public decimal xScaleID { get; set; } = 0;
public string xScaleID { get; set; }

/// <summary>
/// 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.
/// </summary>
public decimal yScaleID { get; set; } = 0;
public string yScaleID { get; set; }

/// <summary>
/// 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.
/// </summary>
public decimal z { get; set; } = 0;
public decimal? Width { get; set; }
public double? z { get; set; }
public double? Width { get; set; }

/// <summary>
/// Overrides the height of the image or canvas element. Could be set in
/// pixel by a number, or in percentage of current height of image or
/// 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.
/// </summary>
public decimal? Height { get; set; }
public double? Height { get; set; }

/// <summary>
/// Anchor position of label on line. Options are: 'left', 'right' or 'center'.
/// </summary>
public string Position { get; set; } = "center";
public string Position { get; set; }

/// <summary>
/// Horizontal alignment of the label text. Options are: 'left', 'right' or 'center'.
/// </summary>
public string TextPosition { get; set; } = "center";
public string TextPosition { get; set; }

/// <summary>
/// Rotation of the label in degrees.
Expand Down
10 changes: 5 additions & 5 deletions src/ChartJSCore/Plugins/Annotation/LabelAnnotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> Content { get; set; } = new List<string>();
public Font Font { get; set; }
public ChartColor Color { get; set; } = ChartColor.FromRgba(0, 0, 0, 1);
public ChartColor Color { get; set; }
}
}
4 changes: 2 additions & 2 deletions src/ChartJSCore/Plugins/Annotation/LineAnnotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
}
26 changes: 13 additions & 13 deletions src/ChartJSCore/Plugins/DataLabels/DataLabels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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°)
/// </summary>
public string Align { get; set; } = "center";
public string Align { get; set; }

/// <summary>
/// An anchor point is defined by an orientation vector and a position on the data element.
Expand All @@ -35,25 +35,25 @@ public class DataLabels: Models.Options
/// 'start': lowest element boundary
/// 'end': highest element boundary
/// </summary>
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; }

/// <summary>
/// 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).
/// </summary>
public bool Clamp { get; set; } = false;
public bool? Clamp { get; set; }

/// <summary>
/// When the clip option is true, the part of the label which is outside the chart
/// area will be masked (see CanvasRenderingContext2D.clip() )
/// </summary>
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; }

Expand All @@ -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.
/// </summary>
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; }
}
}

0 comments on commit c28da86

Please sign in to comment.