From 7fb78dadf5f5c2db1b291a3bf17b6f98c43ceb0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Dang=C3=A5rden?= Date: Mon, 4 Mar 2024 14:32:12 +0100 Subject: [PATCH] Removed warnings --- .../Models/ApexChartOptions.cs | 51 +----------------- .../Models/MultiType/LabelText.cs | 53 +++++++++++++++++++ 2 files changed, 55 insertions(+), 49 deletions(-) create mode 100644 src/Blazor-ApexCharts/Models/MultiType/LabelText.cs diff --git a/src/Blazor-ApexCharts/Models/ApexChartOptions.cs b/src/Blazor-ApexCharts/Models/ApexChartOptions.cs index a2dcd19a..b294e4b1 100644 --- a/src/Blazor-ApexCharts/Models/ApexChartOptions.cs +++ b/src/Blazor-ApexCharts/Models/ApexChartOptions.cs @@ -487,7 +487,7 @@ public class Label public Style Style { get; set; } /// - /// Text for tha annotation label (single string or List to put a multine label + /// Text for tha annotation label (single string or List of string) to put a multine label /// public LabelText Text { get; set; } @@ -531,54 +531,7 @@ internal void SetEventFunction(AnnotationEventType eventType) } } - /// - /// Accepts either a single value or collection of values. - /// By providing a collection in the case of chart annotations, the supplied strings will be printed as separate lines, thus allowing for multiline annotation handling.

- /// - /// Example:

- /// - /// - /// // Single text - /// options.Annotations[0].Xaxis.Label.Text = "TextAnnotations"; - /// - /// // Multiple texts - /// Annotations = new Annotations { - /// Xaxis = new List { - /// new AnnotationsXAxis { - /// Label = new Label { - /// Text = new LabelText("Annotation Text") - /// } - /// } - /// } - /// - ///
- public class LabelText : ValueOrList - { - /// - /// Converts a label text collection into a list of strings - /// - public static implicit operator List(LabelText source) => source.values; - - /// - /// Converts a list of strings into an label text collection - /// - public static implicit operator LabelText(List source) => new(source); - - /// - /// Converts a string into an label text collection - /// - public static implicit operator LabelText(string source) => new(source); - - /// - /// Creates a new collection of label texts with the provided values - /// - public LabelText(params string[] values) : base(values) { } - - /// - /// Creates a new collection of label texts with the provided values - /// - public LabelText(IEnumerable values) : base(values) { } - } + /// diff --git a/src/Blazor-ApexCharts/Models/MultiType/LabelText.cs b/src/Blazor-ApexCharts/Models/MultiType/LabelText.cs new file mode 100644 index 00000000..713ccfd8 --- /dev/null +++ b/src/Blazor-ApexCharts/Models/MultiType/LabelText.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace ApexCharts +{ + /// + /// Accepts either a single value or collection of values. + /// By providing a collection in the case of chart annotations, the supplied strings will be printed as separate lines, thus allowing for multiline annotation handling.

+ /// + /// Example:

+ /// + /// + /// // Single text + /// options.Annotations[0].Xaxis.Label.Text = "TextAnnotations"; + /// + /// // Multiple texts + /// Annotations = new Annotations { + /// Xaxis = new List<AnnotationsXAxis> { + /// new AnnotationsXAxis { + /// Label = new Label { + /// Text = new LabelText("Annotation Text") + /// } + /// } + /// } + /// + ///
+ public class LabelText : ValueOrList + { + /// + /// Converts a label text collection into a list of strings + /// + public static implicit operator List(LabelText source) => source.values; + + /// + /// Converts a list of strings into an label text collection + /// + public static implicit operator LabelText(List source) => new(source); + + /// + /// Converts a string into an label text collection + /// + public static implicit operator LabelText(string source) => new(source); + + /// + /// Creates a new collection of label texts with the provided values + /// + public LabelText(params string[] values) : base(values) { } + + /// + /// Creates a new collection of label texts with the provided values + /// + public LabelText(IEnumerable values) : base(values) { } + } +}