first commit -push

This commit is contained in:
dungtt
2025-10-15 15:15:53 +07:00
parent 674ae395be
commit a9577c5756
885 changed files with 74595 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.BarChart.Axes;
public class ChartAxes
{
/// <summary>
/// If true, scale will include 0 if it is not already included.
/// </summary>
public bool BeginAtZero { get; set; } = true;
/// <summary>
/// Define options for the border that run perpendicular to the axis.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxesBorder? Border { get; set; }
/// <summary>
/// Gets or sets the grid configuration.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxesGrid? Grid { get; set; }
/// <summary>
/// User defined maximum number for the scale, overrides maximum value from data.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Max { get; set; }
/// <summary>
/// User defined minimum number for the scale, overrides minimum value from data.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Min { get; set; }
/// <summary>
/// Should the data be stacked.
/// By default data is not stacked.
/// If the stacked option of the value scale (y-axis on horizontal chart) is true, positive and negative values are stacked
/// separately.
/// </summary>
public bool Stacked { get; set; }
/// <summary>
/// Adjustment used when calculating the maximum data value.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? SuggestedMax { get; set; }
/// <summary>
/// Adjustment used when calculating the minimum data value.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? SuggestedMin { get; set; }
/// <summary>
/// Gets or sets the tick configuration.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxesTicks? Ticks { get; set; }
/// <summary>
/// Gets or sets the title configuration.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxesTitle? Title { get; set; }
/// <summary>
/// Gets or sets the index scale type. />.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxesType? Type { get; set; } = null;
/// <summary>
/// The weight used to sort the axis. Higher weights are further away from the chart area.
/// </summary>
public int? Weight { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TitlePosition? Position { get; set; }
}

View File

@@ -0,0 +1,41 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.BarChart.Axes;
public class ChartAxesBorder
{
/// <summary>
/// The color of the border line.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
/// <summary>
/// Length and spacing of dashes on grid lines
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<int>? Dash { get; set; }
/// <summary>
/// Offset for line dashes.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? DashOffset { get; set; }
/// <summary>
/// If <see langword="true" />, draw a border at the edge between the axis and the chart area.
/// </summary>
public bool Display { get; set; } = true;
/// <summary>
/// The width of the border line.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Width { get; set; }
/// <summary>
/// z-index of the border layer. Values <= 0 are drawn under datasets, > 0 on top.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Z { get; set; }
}

View File

@@ -0,0 +1,82 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.BarChart.Axes;
public class ChartAxesGrid
{
/// <summary>
/// If <see langword="true" />, gridlines are circular (on radar and polar area charts only).
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Circular { get; set; }
/// <summary>
/// Color of the grid axis lines. Here one can write a CSS method or even a JavaScript method for a dynamic color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
/// <summary>
/// If false, do not display grid lines for this axis.
/// </summary>
public bool Display { get; set; } = true;
/// <summary>
/// If <see langword="true" />, draw lines on the chart area inside the axis lines. This is useful when there are multiple
/// axes and you need to control which grid lines are drawn.
/// </summary>
public bool DrawOnChartArea { get; set; } = true;
/// <summary>
/// If <see langword="true" />, draw lines beside the ticks in the axis area beside the chart.
/// </summary>
public bool DrawTicks { get; set; } = true;
/// <summary>
/// Stroke width of grid lines.
/// </summary>
public int LineWidth { get; set; } = 1;
/// <summary>
/// If <see langword="true" />, grid lines will be shifted to be between labels. This is set to true for a bar chart by
/// default.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Offset { get; set; } = false;
/// <summary>
/// Length and spacing of the tick mark line.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<int>? TickBorderDash { get; set; }
/// <summary>
/// Offset for the line dash of the tick mark.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? TickBorderDashOffset { get; set; }
/// <summary>
/// Color of the tick line. If unset, defaults to the grid line color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TickColor { get; set; }
/// <summary>
/// Length in pixels that the grid lines will draw into the axis area.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? TickLength { get; set; }
/// <summary>
/// Width of the tick mark in pixels.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? TickWidth { get; set; }
/// <summary>
/// z-index of the gridline layer. Values <= 0 are drawn under datasets, > 0 on top.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Z { get; set; }
}

View File

@@ -0,0 +1,64 @@
using RobotNet.WebApp.Charts.Enums;
using RobotNet.WebApp.Charts.Models.Common;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.BarChart.Axes;
public class ChartAxesTicks
{
[JsonPropertyName("align")]
public TicksAlignment Alignment { get; set; } = TicksAlignment.Center;
/// <summary>
/// Color of label backdrops
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BackdropColor { get; set; }
/// <summary>
/// Padding of label backdrop
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BackdropPadding { get; set; }
/// <summary>
/// Color of ticks
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
/// <summary>
/// If <see langword="true" />, show tick labels.
/// </summary>
public bool Display { get; set; } = true;
/// <summary>
/// defines options for the major tick marks that are generated by the axis.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxesTicksMajor? Major { get; set; }
/// <summary>
/// Sets the offset of the tick labels from the axis
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPadding? Padding { get; set; }
/// <summary>
/// If <see langword="true" />, draw a background behind the tick labels.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? ShowLabelBackdrop { get; set; }
/// <summary>
/// The color of the stroke around the text.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TextStrokeColor { get; set; }
/// <summary>
/// Stroke width around the text.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? TextStrokeWidth { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace RobotNet.WebApp.Charts.Models.BarChart.Axes;
public class ChartAxesTicksMajor
{
/// <summary>
/// If <see langword="true" />, major ticks are generated. A major tick will affect auto skipping and major will be defined
/// on ticks in the scriptable options context.
/// </summary>
public bool Enabled { get; set; } = false;
}

View File

@@ -0,0 +1,44 @@
using RobotNet.WebApp.Charts.Enums;
using RobotNet.WebApp.Charts.Models.Common;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.BarChart.Axes;
public class ChartAxesTitle
{
/// <summary>
/// Alignment of the title.
/// Options are: 'start', 'center', and 'end'
/// </summary>
[JsonPropertyName("align")]
public TitleAlignment Alignment { get; set; } = TitleAlignment.Center;
/// <summary>
/// Color of text.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; } = "black";
/// <summary>
/// Is the title shown?
/// </summary>
public bool Display { get; set; } = true;
public ChartFont? Font { get; set; } = new();
public bool FullSize { get; set; } = true;
/// <summary>
/// Gets or sets the position of the title.
/// </summary>
public TitlePosition Position { get; set; } = TitlePosition.Top;
/// <summary>
/// Gets or sets the number of pixels to add above and below the title text.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPadding? Padding { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Text { get; set; }
}

View File

@@ -0,0 +1,118 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.BarChart;
public class BarChartDataset : ChartDataset<double>
{
/// <summary>
/// Percent (0-1) of the available width each bar should be within the category width.
/// 1.0 will take the whole category width and put the bars right next to each other.
/// </summary>
/// <remarks>
/// Default value is 0.9.
/// </remarks>
public double BarPercentage { get; set; } = 0.9;
/// <summary>
/// It is applied to the width of each bar, in pixels.
/// When this is enforced, barPercentage and categoryPercentage are ignored.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? BarThickness { get; set; }
/// <summary>
/// This setting is used to avoid drawing the bar stroke at the base of the fill, or disable the border radius.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public BorderSkipped? BorderSkipped { get; set; }
/// <summary>
/// Percent (0-1) of the available width each category should be within the sample width.
/// </summary>
/// <remarks>
/// Default value is 0.8.
/// </remarks>
public double CategoryPercentage { get; set; } = 0.8;
/// <summary>
/// Should the bars be grouped on index axis.
/// When <see langword="true" />, all the datasets at same index value will be placed next to each other centering on that
/// index value.
/// When <see langword="false" />, each bar is placed on its actual index-axis value.
/// </summary>
/// <remarks>
/// Default value is <see langword="true" />.
/// </remarks>
public bool Grouped { get; set; } = true;
/// <summary>
/// The bar border radius when hovered (in pixels).
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? HoverBorderRadius { get; set; }
/// <summary>
/// The base axis of the chart. 'x' for vertical charts and 'y' for horizontal charts.
/// Supported values are 'x' and 'y'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IndexAxis? IndexAxis { get; set; }
/// <summary>
/// Set this to ensure that bars are not sized thicker than this.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? MaxBarThickness { get; set; }
/// <summary>
/// Set this to ensure that bars have a minimum length in pixels.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? MinBarLength { get; set; }
public PointStyle PointStyle { get; set; } = PointStyle.Circle;
/// <summary>
/// If <see langword="true" />, null or undefined values will not be used for spacing calculations when determining bar
/// size.
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public bool SkipNull { get; set; }
/// <summary>
/// The ID of the x axis to plot this dataset on.
/// </summary>
/// <remarks>
/// Default value is first x axis.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? XAxisID { get; set; }
/// <summary>
/// The ID of the y axis to plot this dataset on.
/// </summary>
/// <remarks>
/// Default value is first y axis.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? YAxisID { get; set; }
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.BarChart;
public class BarChartDatasetData(string? datasetLabel, object data, string? backgroundColor) : ChartDatasetData(datasetLabel, data, backgroundColor)
{
}

View File

@@ -0,0 +1,21 @@
using RobotNet.WebApp.Charts.Enums;
using RobotNet.WebApp.Charts.Models.Common;
namespace RobotNet.WebApp.Charts.Models.BarChart;
public class BarChartOptions : ChartOptions
{
/// <summary>
/// The base axis of the chart. 'x' for vertical charts and 'y' for horizontal charts.
/// Supported values are 'x' and 'y'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// </remarks>
public IndexAxis IndexAxis { get; set; } = IndexAxis.X;
public BarChartPlugins Plugins { get; set; } = new();
public BarScales Scales { get; set; } = new();
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Plugins;
namespace RobotNet.WebApp.Charts.Models.BarChart;
public class BarChartPlugins : ChartPlugins
{
}

View File

@@ -0,0 +1,13 @@
using RobotNet.WebApp.Charts.Models.BarChart.Axes;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.BarChart;
public class BarScales
{
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxes? X { get; set; } = new();
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxes? Y { get; set; } = new();
}

View File

@@ -0,0 +1,18 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.BubbleChart;
public class BubbleChartDataset : ChartDataset<BubblePoint>
{
public bool DrawActiveElementsOnTop { get; set; } = true;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? HoverRadius { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? HitRadius { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Radius { get; set; }
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.BubbleChart;
public class BubbleChartDatasetData(string? datasetLabel, BubblePoint data, string? backgroundColor) : ChartDatasetData(datasetLabel, data, backgroundColor)
{
}

View File

@@ -0,0 +1,21 @@
using RobotNet.WebApp.Charts.Enums;
using RobotNet.WebApp.Charts.Models.BarChart;
using RobotNet.WebApp.Charts.Models.Common;
namespace RobotNet.WebApp.Charts.Models.BubbleChart;
public class BubbleChartOptions : ChartOptions
{
/// <summary>
/// The base axis of the chart. 'x' for vertical charts and 'y' for horizontal charts.
/// Supported values are 'x' and 'y'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// </remarks>
public IndexAxis IndexAxis { get; set; } = IndexAxis.X;
public BubbleChartPlugins Plugins { get; set; } = new();
public BarScales Scales { get; set; } = new();
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Plugins;
namespace RobotNet.WebApp.Charts.Models.BubbleChart;
public class BubbleChartPlugins : ChartPlugins
{
}

View File

@@ -0,0 +1,26 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.BubbleChart;
public class BubblePoint(double x, double y, double r)
{
/// <summary>
/// Gets the X-value of this <see cref="BubblePoint"/>.
/// </summary>
public double X { get; } = x;
/// <summary>
/// Gets the Y-value of this <see cref="BubblePoint"/>.
/// </summary>
public double Y { get; } = y;
/// <summary>
/// Gets the radius of this <see cref="BubblePoint"/> in pixels. Will be serialized as 'r'.
/// <para>
/// Important: this property is not scaled by the chart,
/// it is the raw radius in pixels of the bubble that is drawn on the canvas.
/// </para>
/// </summary>
[JsonPropertyName("r")]
public double Radius { get; } = r;
}

View File

@@ -0,0 +1,116 @@
using RobotNet.WebApp.Charts.Enums;
using RobotNet.WebApp.Charts.Models.Common.Dataset;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.ComboBarLineChart;
public class ComboBarLineDataset : ChartDataset<double>
{
/// <summary>
/// Percent (0-1) of the available width each bar should be within the category width.
/// 1.0 will take the whole category width and put the bars right next to each other.
/// </summary>
/// <remarks>
/// Default value is 0.9.
/// </remarks>
public double BarPercentage { get; set; } = 0.9;
/// <summary>
/// It is applied to the width of each bar, in pixels.
/// When this is enforced, barPercentage and categoryPercentage are ignored.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? BarThickness { get; set; }
/// <summary>
/// This setting is used to avoid drawing the bar stroke at the base of the fill, or disable the border radius.
/// </summary>
public BorderSkipped BorderSkipped { get; set; } = BorderSkipped.Start;
/// <summary>
/// Percent (0-1) of the available width each category should be within the sample width.
/// </summary>
/// <remarks>
/// Default value is 0.8.
/// </remarks>
public double CategoryPercentage { get; set; } = 0.8;
/// <summary>
/// Should the bars be grouped on index axis.
/// When <see langword="true" />, all the datasets at same index value will be placed next to each other centering on that
/// index value.
/// When <see langword="false" />, each bar is placed on its actual index-axis value.
/// </summary>
/// <remarks>
/// Default value is <see langword="true" />.
/// </remarks>
public bool Grouped { get; set; } = true;
/// <summary>
/// The bar border radius when hovered (in pixels).
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? HoverBorderRadius { get; set; }
/// <summary>
/// The base axis of the chart. 'x' for vertical charts and 'y' for horizontal charts.
/// Supported values are 'x' and 'y'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
public IndexAxis IndexAxis { get; set; } = IndexAxis.X;
/// <summary>
/// Set this to ensure that bars are not sized thicker than this.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? MaxBarThickness { get; set; }
/// <summary>
/// Set this to ensure that bars have a minimum length in pixels.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? MinBarLength { get; set; }
public PointStyle PointStyle { get; set; } = PointStyle.Circle;
/// <summary>
/// If <see langword="true" />, null or undefined values will not be used for spacing calculations when determining bar
/// size.
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public bool SkipNull { get; set; }
/// <summary>
/// The ID of the x axis to plot this dataset on.
/// </summary>
/// <remarks>
/// Default value is first x axis.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? XAxisID { get; set; }
/// <summary>
/// The ID of the y axis to plot this dataset on.
/// </summary>
/// <remarks>
/// Default value is first y axis.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? YAxisID { get; set; }
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.ComboBarLineChart;
public class ComboBarLineDatasetData(string? datasetLabel, object data, string? backgroundColor) : ChartDatasetData(datasetLabel, data, backgroundColor)
{
}

View File

@@ -0,0 +1,21 @@
using RobotNet.WebApp.Charts.Enums;
using RobotNet.WebApp.Charts.Models.BarChart;
using RobotNet.WebApp.Charts.Models.Common;
namespace RobotNet.WebApp.Charts.Models.ComboBarLineChart;
public class ComboBarLineOptions : ChartOptions
{
/// <summary>
/// The base axis of the chart. 'x' for vertical charts and 'y' for horizontal charts.
/// Supported values are 'x' and 'y'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// </remarks>
public IndexAxis IndexAxis { get; set; } = IndexAxis.X;
public BarChartPlugins Plugins { get; set; } = new();
public ComboBarLineScales Scales { get; set; } = new();
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Plugins;
namespace RobotNet.WebApp.Charts.Models.ComboBarLineChart;
public class ComboBarLinePlugins : ChartPlugins
{
}

View File

@@ -0,0 +1,16 @@
using RobotNet.WebApp.Charts.Models.BarChart.Axes;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.ComboBarLineChart;
public class ComboBarLineScales
{
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxes? X { get; set; } = new();
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxes? Y { get; set; } = new();
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAxes? Y1 { get; set; }
}

View File

@@ -0,0 +1,19 @@
namespace RobotNet.WebApp.Charts.Models.Common;
/// <summary>
/// The animation-subconfig of the options for a radial chart.
/// </summary>
public class ArcAnimation : ChartAnimation
{
/// <summary>
/// Gets or sets a value indicating whether the chart will
/// load in with a rotation animation or not.
/// </summary>
public bool? AnimateRotate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the chart will
/// load in with a scaling animation (from the center outwards) or not.
/// </summary>
public bool? AnimateScale { get; set; }
}

View File

@@ -0,0 +1,28 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common;
public class ChartAnimation
{
/// <summary>
/// Gets or sets the number of milliseconds an animation takes.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public long? Duration { get; set; }
/// <summary>
/// Delay before starting the animations.
/// </summary>
public int Delay { get; set; }
/// <summary>
/// If set to true, the animations loop endlessly.
/// </summary>
public bool Loop { get; set; }
/// <summary>
/// Gets or sets the easing function to use.
/// </summary>
public Easing Easing { get; set; }
}

View File

@@ -0,0 +1,36 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common;
public class ChartFont
{
/// <summary>
/// Default font family for all text, follows CSS font-family options.
/// 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Family { get; set; }
/// <summary>
/// Height of an individual line of text
/// </summary>
public double LineHeight { get; set; } = 1.2;
/// <summary>
/// Default font size (in px) for text. Does not apply to radialLinear scale point labels.
/// </summary>
public int Size { get; set; } = 12;
/// <summary>
/// Default font style. Does not apply to tooltip title or footer. Does not apply to chart title.
/// Follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Style { get; set; }
/// <summary>
/// Default font weight (boldness).
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Weight { get; set; } = "bold";
}

View File

@@ -0,0 +1,17 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common;
public class ChartLayout
{
/// <summary>
/// The padding to add inside the chart
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPadding? Padding { get; set; }
/// <summary>
/// Apply automatic padding so visible elements are completely drawn.
/// </summary>
public bool AutoPadding { get; set; } = true;
}

View File

@@ -0,0 +1,67 @@
using RobotNet.WebApp.Charts.Models.Common.Elements;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common;
public class ChartOptions : IChartOptions
{
/// <summary>
/// Gets or sets the locale.
/// By default, the chart is using the default locale of the platform which is running on.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Locale { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to maintain the original canvas aspect ratio (width / height) when resizing.
/// </summary>
/// <remarks>
/// Default value is <see langword="true" />.
/// </remarks>
public bool MaintainAspectRatio { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether the chart canvas should be resized when its container is.
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public bool Responsive { get; set; }
/// <summary>
/// Gets or sets the canvas aspect ratio (i.e. width / height, a value of 1 representing a square canvas).
/// <para>Note that this option is ignored if the height is explicitly defined either as attribute (of the canvas) or via the style.</para>
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? AspectRatio { get; set; }
/// <summary>
/// Gets or sets the duration in milliseconds it takes to animate to new size after a resize event.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? ResponsiveAnimationDuration { get; set; }
/// <summary>
/// Gets or sets the animation-configuration for this chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartAnimation? Animation { get; set; }
/// <summary>
/// Gets or sets the layout options for this chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartLayout? Layout { get; set; }
/// <summary>
/// Gets or sets the Interaction configuration for this chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Interaction? Interaction { get; set; }
/// <summary>
/// Gets or sets the elements options for this chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartElements? Elements { get; set; }
}

View File

@@ -0,0 +1,24 @@
namespace RobotNet.WebApp.Charts.Models.Common;
public class ChartPadding
{
public ChartPadding() { }
public ChartPadding(int padding)
{
Left = padding;
Right = padding;
Top = padding;
Bottom = padding;
}
public ChartPadding(int left, int top, int right, int bottom)
{
Left = left;
Right = top;
Top = right;
Bottom = bottom;
}
public int Left { get; set; }
public int Right { get; set; }
public int Top { get; set; }
public int Bottom { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Dataset;
public class ChartData
{
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<IChartDataset>? Datasets { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? Labels { get; set; }
}

View File

@@ -0,0 +1,256 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Dataset;
public class ChartDataset<TData> : IChartDataset
{
public ChartDataset()
{
Oid = Guid.NewGuid();
}
/// <summary>
/// How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside
/// chartArea. 0 = clip at chartArea.
/// Clipping can also be configured per side: clip: {left: 5, top: false, right: -2, bottom: 0}
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Clip { get; set; }
/// <summary>
/// Get or sets the Data.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<TData>? Data { get; set; }
/// <summary>
/// Configures the visibility state of the dataset. Set it to <see langword="true" />, to hide the dataset from the chart.
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public bool Hidden { get; set; }
/// <summary>
/// The label for the dataset which appears in the legend and tooltips.
/// </summary>
/// <remarks>
/// Default value is <see cref="string.Empty" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Label { get; set; }
/// <summary>
/// Get unique object id.
/// </summary>
public Guid Oid { get; private set; }
/// <summary>
/// The drawing order of dataset. Also affects order for stacking, tooltip and legend.
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
public int Order { get; set; }
/// <summary>
/// Gets or sets the chart type.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Type { get; set; }
/// <summary>
/// Arc background color.
/// </summary>
/// <remarks>
/// Default value is 'rgba(0, 0, 0, 0.1)'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? BackgroundColor { get; set; }
/// <summary>
/// Supported values are 'center' and 'inner'.
/// When 'center' is set, the borders of arcs next to each other will overlap.
/// When 'inner' is set, it is guaranteed that all borders will not overlap.
/// </summary>
/// <remarks>
/// Default value is 'center'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? BorderAlign { get; set; } // TODO: change this to enum
/// <summary>
/// Arc border color.
/// </summary>
/// <remarks>
/// Default value is '#fff'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? BorderColor { get; set; }
/// <summary>
/// Arc border length and spacing of dashes.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? BorderDash { get; set; }
/// <summary>
/// Arc border offset for line dashes.
/// </summary>
/// <remarks>
/// Default value is 0.0.
/// </remarks>
public double BorderDashOffset { get; set; }
/// <summary>
/// Arc border join style.
/// Supported values are 'round', 'bevel', 'miter'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? BorderJoinStyle { get; set; }
/// <summary>
/// It is applied to all corners of the arc (outerStart, outerEnd, innerStart, innerRight).
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? BorderRadius { get; set; }
/// <summary>
/// Arc border width (in pixels).
/// </summary>
/// <remarks>
/// Default value is 2.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? BorderWidth { get; set; }
/// <summary>
/// Per-dataset override for the sweep that the arcs cover.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Circumference { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartDatasetDataLabels? Datalabels { get; set; }
/// <summary>
/// Arc background color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? HoverBackgroundColor { get; set; }
/// <summary>
/// Arc border color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? HoverBorderColor { get; set; }
/// <summary>
/// Arc border length and spacing of dashes when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? HoverBorderDash { get; set; }
/// <summary>
/// Arc border offset for line dashes when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? HoverBorderDashOffset { get; set; }
/// <summary>
/// Arc border join style when hovered.
/// Supported values are 'round', 'bevel', 'miter'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? HoverBorderJoinStyle { get; set; } // TODO: change this to enum
/// <summary>
/// Arc border width when hovered (in pixels).
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? HoverBorderWidth { get; set; }
/// <summary>
/// Arc offset when hovered (in pixels).
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? HoverOffset { get; set; }
/// <summary>
/// Arc offset (in pixels).
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? Offset { get; set; }
/// <summary>
/// Per-dataset override for the starting angle to draw arcs from.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Rotation { get; set; }
/// <summary>
/// Fixed arc offset (in pixels). Similar to <see cref="Offset" /> but applies to all arcs.
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
public double Spacing { get; set; }
/// <summary>
/// The relative thickness of the dataset.
/// Providing a value for weight will cause the pie or doughnut dataset to be drawn
/// with a thickness relative to the sum of all the dataset weight values.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
public double Weight { get; set; } = 1;
}

View File

@@ -0,0 +1,10 @@
namespace RobotNet.WebApp.Charts.Models.Common.Dataset;
public class ChartDatasetData(string? datasetLabel, object data, string? backgroundColor) : IChartDatasetData
{
public string? DatasetLabel { get; init; } = datasetLabel;
public object Data { get; init; } = data;
public string? BackgroundColor { get; init; } = backgroundColor;
}

View File

@@ -0,0 +1,24 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Dataset;
public class ChartDatasetDataLabels
{
public DataLabelsAlignment Align { get; set; } = DataLabelsAlignment.Center;
public DataLabelsAnchoring Anchor { get; set; } = DataLabelsAnchoring.Center;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BackgroundColor { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
public bool Display { get; set; } = true;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartFont? Font { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPadding? Padding { get; set; } = new(6);
}

View File

@@ -0,0 +1,55 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Elements;
public class Arc
{
/// <summary>
/// Arc angle to cover.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Angle { get; set; }
/// <summary>
/// Arc fill color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BackgroundColor { get; set; }
/// <summary>
/// Arc stroke alignment.
/// </summary>
public BorderAlign BorderAlign { get; set; } = BorderAlign.Center;
/// <summary>
/// Arc stroke color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BorderColor { get; set; }
/// <summary>
/// Arc line dash
/// </summary>
public int[]? BorderDash { get; set; }
/// <summary>
/// Arc line dash offset
/// </summary>
public double BorderDashOffset { get; set; }
/// <summary>
/// Line join style.
/// </summary>
public BorderJoinStyle? BorderJoinStyle { get; set; }
/// <summary>
/// Arc stroke width.
/// </summary>
public int BorderWidth { get; set; } = 2;
/// <summary>
/// By default the Arc is curved. If circular: false the Arc will be flat
/// </summary>
public bool Circular { get; set; } = true;
}

View File

@@ -0,0 +1,46 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Elements;
public class Bar
{
/// <summary>
/// Bar fill color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BackgroundColor { get; set; }
/// <summary>
/// Bar stroke width.
/// </summary>
public int BorderWidth { get; set; } = 1;
/// <summary>
/// Bar stroke color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BorderColor { get; set; }
/// <summary>
/// Skipped (excluded) border.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public BorderSkipped? BorderSkipped { get; set; }
/// <summary>
/// The bar border radius (in pixels).
/// </summary>
public int BorderRadius { get; set; }
/// <summary>
/// The amount of pixels to inflate the bar rectangle(s) when drawing.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? InflateAmount { get; set; }
/// <summary>
/// Style of the point for legend.
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public PointStyle? PointStyle { get; set; }
}

View File

@@ -0,0 +1,30 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Elements;
public class ChartElements
{
/// <summary>
/// Arcs are used in the polar area, doughnut and pie charts.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Arc? Arc { get; set; }
/// <summary>
/// Bar elements are used to represent the bars in a bar chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Bar? Bar { get; set; }
/// <summary>
/// Line elements are used to represent the line in a line chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Line? Line { get; set; }
/// <summary>
/// Point elements are used to represent the points in a line, radar or bubble chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Point? Point { get; set; }
}

View File

@@ -0,0 +1,71 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Elements;
public class Line
{
/// <summary>
/// Bézier curve tension (0 for no Bézier curves).
/// </summary>
public int Tension { get; set; }
/// <summary>
/// Line fill color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BackgroundColor { get; set; }
/// <summary>
/// Line stroke width.
/// </summary>
public int BorderWidth { get; set; } = 1;
/// <summary>
/// Line stroke color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BorderColor { get; set; }
/// <summary>
/// Line cap style.
/// </summary>
public string BorderCapStyle { get; set; } = "butt";
/// <summary>
/// Line dash.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int[]? BorderDash { get; set; }
/// <summary>
/// Line dash offset.
/// </summary>
public double BorderDashOffset { get; set; }
/// <summary>
/// Line join style.
/// </summary>
public BorderJoinStyle BorderJoinStyle { get; set; } = BorderJoinStyle.Miter;
/// <summary>
/// if true to keep Bézier control inside the chart, false for no restriction.
/// </summary>
public bool CapBezierPoints { get; set; } = true;
/// <summary>
/// Interpolation mode to apply.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? CubicInterpolationMode { get; set; }
/// <summary>
/// How to fill the area under the line.
/// </summary>
public bool Fill { get; set; }
/// <summary>
/// if true to show the line as a stepped line (tension will be ignored).
/// </summary>
public bool Stepped { get; set; }
}

View File

@@ -0,0 +1,54 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Elements;
public class Point
{
/// <summary>
/// Point radius.
/// </summary>
public double Radius { get; set; } = 3;
/// <summary>
/// Point style.
/// </summary>
public PointStyle PointStyle { get; set; } = PointStyle.Circle;
/// <summary>
/// Point rotation (in degrees).
/// </summary>
public double Rotation { get; set; }
/// <summary>
/// Point fill color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BackgroundColor { get; set; }
/// <summary>
/// Point stroke width.
/// </summary>
public int BorderWidth { get; set; } = 1;
/// <summary>
/// Point stroke color.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BorderColor { get; set; }
/// <summary>
/// Extra radius added to point radius for hit detection.
/// </summary>
public double HitRadius { get; set; } = 1;
/// <summary>
/// Point radius when hovered.
/// </summary>
public int HhoverRadius { get; set; } = 4;
/// <summary>
/// Stroke width when hovered.
/// </summary>
public int HoverBorderWidth { get; set; } = 1;
}

View File

@@ -0,0 +1,5 @@
namespace RobotNet.WebApp.Charts.Models.Common;
public interface IChartDataset
{
}

View File

@@ -0,0 +1,5 @@
namespace RobotNet.WebApp.Charts.Models.Common;
public interface IChartDatasetData
{
}

View File

@@ -0,0 +1,5 @@
namespace RobotNet.WebApp.Charts.Models.Common;
public interface IChartOptions
{
}

View File

@@ -0,0 +1,67 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common;
public class Interaction
{
private InteractionMode mode;
public Interaction() => Mode = InteractionMode.Nearest;
private void SetMode(InteractionMode interactionMode) =>
ChartInteractionMode = interactionMode switch
{
InteractionMode.Dataset => "dataset",
InteractionMode.Index => "index",
InteractionMode.Nearest => "nearest",
InteractionMode.Point => "point",
InteractionMode.X => "x",
InteractionMode.Y => "y",
_ => ""
};
/// <summary>
/// Sets which elements appear in the interaction.
/// </summary>
[JsonPropertyName("mode")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ChartInteractionMode { get; private set; }
/// <summary>
/// if <see langword="true" />, the interaction mode only applies when the mouse position intersects an item on the chart.
/// </summary>
/// <remarks>
/// Default value is <see langword="true" />.
/// </remarks>
public bool Intersect { get; set; } = true;
/// <summary>
/// Sets which elements appear in the tooltip. See Interaction Modes for details.
/// </summary>
[JsonIgnore]
public InteractionMode Mode
{
get => mode;
set
{
mode = value;
SetMode(value);
}
}
/// <summary>
/// Gets or sets which directions are used in calculating distances.
/// Defaults to <see cref="AxisDirection.X"/> for <see cref="Mode"/> == <see cref="InteractionMode.Index"/>
/// and <see cref="AxisDirection.XY"/> for <see cref="Mode"/> == <see cref="InteractionMode.Dataset"/> or <see cref="InteractionMode.Nearest"/>.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AxisDirection? Axis { get; set; }
/// <summary>
/// if true, the invisible points that are outside of the chart area will also be included when evaluating interactions.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? IncludeInvisible { get; set; }
}

View File

@@ -0,0 +1,35 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Plugins;
public class ChartPlugins
{
/// <summary>
/// The chart legend displays data about the datasets that are appearing on the chart.
/// </summary>
public ChartPluginsLegend Legend { get; set; } = new();
/// <summary>
/// The chart title defines text to draw at the top of the chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPluginsTitle? Title { get; set; }
/// <summary>
/// Tooltip for the element.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPluginsTooltip? Tooltip { get; set; }
/// <summary>
/// DataLabels for the element.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPluginsDataLabels? Datalabels { get; set; }
/// <summary>
/// Subtitle for the element.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPluginsSubtitle? Subtitle { get; set; }
}

View File

@@ -0,0 +1,37 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Plugins;
public class ChartPluginsDataLabels
{
public DataLabelsAlignment Align { get; set; } = DataLabelsAlignment.Center;
public DataLabelsAnchoring Anchor { get; set; } = DataLabelsAnchoring.Center;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BackgroundColor { get; set; }
public string BorderColor { get; set; } = "white";
public double BorderRadius { get; set; } = 25;
public double BorderWidth { get; set; } = 2;
public bool Clamp { get; set; } = false;
public bool Clip { get; set; } = false;
public string Color { get; set; } = "white";
public bool Display { get; set; } = true;
public ChartFont Font { get; set; } = new();
public int Offset { get; set; } = 4;
public double Opacity { get; set; } = 1;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPadding? Padding { get; set; }
public int Rotation { get; set; }
public DataLabelsAlignment TextAlign { get; set; } = DataLabelsAlignment.Center;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TextStrokeColor { get; set; }
public int TextStrokeWidth { get; set; }
public int TextShadowBlur { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TextShadowColor { get; set; }
}

View File

@@ -0,0 +1,67 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Plugins;
public class ChartPluginsLegend
{
/// <summary>
/// Alignment of the legend. Default values is 'center'. Other possible values 'start' and 'end'.
/// </summary>
public LegendAlignment Align { get; set; } = LegendAlignment.Center;
/// <summary>
/// Is the legend shown? Default value is 'true'.
/// </summary>
public bool Display { get; set; } = true;
/// <summary>
/// If <see langword="true" />, Marks that this box should take the full width/height of the canvas (moving other boxes). This is unlikely to need to be changed in day-to-day use.
/// </summary>
public bool FullSize { get; set; } = true;
/// <summary>
/// Label settings for the legend.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPluginsLegendLabels? Labels { get; set; }
/// <summary>
/// Maximum height of the legend, in pixels.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? MaxHeight { get; set; }
/// <summary>
/// Maximum width of the legend, in pixels.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? MaxWidth { get; set; }
/// <summary>
/// Position of the legend. Default value is 'top'. Other possible value is 'bottom'.
/// </summary>
public LegendPosition Position { get; set; } = LegendPosition.Top;
/// <summary>
/// If <see langword="true" />, the Legend will show datasets in reverse order.
/// </summary>
public bool Reverse { get; set; } = false;
/// <summary>
/// If <see langword="true" />, for rendering of the legends will go from right to left.
/// </summary>
public bool Rtl { get; set; } = false;
/// <summary>
/// This will force the text direction 'rtl' or 'ltr' on the canvas for rendering the legend, regardless of the css specified on the canvas
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TextDirection { get; set; }
/// <summary>
/// Title object
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPluginsLegendTitle? Title { get; set; }
}

View File

@@ -0,0 +1,67 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Plugins;
public class ChartPluginsLegendLabels
{
/// <summary>
/// Width of coloured box.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BoxWidth { get; set; }
/// <summary>
/// Height of the coloured box
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BoxHeight { get; set; }
/// <summary>
/// Override the borderRadius to use.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BorderRadius { get; set; }
/// <summary>
/// Color of label and the strikethrough.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartFont? Font { get; set; }
/// <summary>
/// Padding between rows of colored boxes.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Padding { get; set; }
/// <summary>
/// If specified, this style of point is used for the legend. Only used if <see cref="UsePointStyle"/>> is true.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public PointStyle? PointStyle { get; set; }
/// <summary>
/// If <see cref="UsePointStyle"/> is <see langword="true" />, the width of the point style used for the legend.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? PointStyleWidth { get; set; }
/// <summary>
/// Label borderRadius will match corresponding <see cref="BorderRadius"/>.
/// </summary>
public bool UseBorderRadius { get; set; } = false;
/// <summary>
/// If <see langword="true"/>, Label style will match corresponding point style (size is based on pointStyleWidth or the minimum value between <see cref="BoxWidth"/> and <see cref="Font"/> -> Size).
/// </summary>
public bool UsePointStyle { get; set; } = false;
/// <summary>
/// Horizontal alignment of the label text
/// </summary>
public LegendAlignment TextAlign { get; set; } = LegendAlignment.Center;
}

View File

@@ -0,0 +1,35 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Plugins;
public class ChartPluginsLegendTitle
{
/// <summary>
/// Color of the legend. Default value is 'black'.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
/// <summary>
/// Is the legend title displayed.
/// </summary>
public bool Display { get; set; } = true;
/// <summary>
/// Padding around the title.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPadding? Padding { get; set; }
/// <summary>
/// The string title
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Text { get; set; }
/// <summary>
/// Font Legend Title
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartFont? Font { get; set; }
}

View File

@@ -0,0 +1,42 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Plugins;
public class ChartPluginsSubtitle
{
/// <summary>
/// Alignment of the title.
/// Options are: 'start', 'center', and 'end'
/// </summary>
public TitleAlignment Align { get; set; } = TitleAlignment.Center;
/// <summary>
/// Color of text.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
/// <summary>
/// Is the title shown?
/// </summary>
public bool Display { get; set; } = true;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartFont? Font { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Text { get; set; }
public bool FullSize { get; set; } = true;
/// <summary>
/// Gets or sets the position of the title.
/// </summary>
public TitlePosition Position { get; set; } = TitlePosition.Top;
/// <summary>
/// Gets or sets the number of pixels to add above and below the title text.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPadding? Padding { get; set; }
}

View File

@@ -0,0 +1,42 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Plugins;
public class ChartPluginsTitle
{
/// <summary>
/// Alignment of the title.
/// Options are: 'start', 'center', and 'end'
/// </summary>
public TitleAlignment Align { get; set; } = TitleAlignment.Center;
/// <summary>
/// Color of text.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
/// <summary>
/// Is the title shown?
/// </summary>
public bool Display { get; set; } = true;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartFont? Font { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Text { get; set; }
public bool FullSize { get; set; } = true;
/// <summary>
/// Gets or sets the position of the title.
/// </summary>
public TitlePosition Position { get; set; } = TitlePosition.Top;
/// <summary>
/// Gets or sets the number of pixels to add above and below the title text.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPadding? Padding { get; set; }
}

View File

@@ -0,0 +1,176 @@
using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.Common.Plugins;
public class ChartPluginsTooltip
{
/// <summary>
/// Background color of the tooltip.
/// </summary>
public string BackgroundColor { get; set; } = "rgba(0, 0, 0, 0.8)";
/// <summary>
/// Gets or sets which elements appear in the tooltip.
/// </summary>
public InteractionMode Mode { get; set; }
/// <summary>
/// Gets or sets the value indicating if the hover mode only applies when the mouse position intersects an item on the chart.
/// </summary>
public bool? Intersect { get; set; }
/// <summary>
/// The mode for positioning the tooltip.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TooltipPosition? Position { get; set; } = TooltipPosition.Average;
/// <summary>
/// Horizontal alignment of the body text lines. left/right/center.
/// </summary>
public TooltipXAlignment BodyAlign { get; set; } = TooltipXAlignment.Left;
/// <summary>
/// Color of body text.
/// </summary>
public string BodyColor { get; set; } = "#fff";
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartFont? BodyFont { get; set; }
/// <summary>
/// Spacing to add to top and bottom of each tooltip item.
/// </summary>
public int BodySpacing { get; set; } = 2;
/// <summary>
/// Padding for Tooltips
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ChartPadding? Padding { get; set; }
/// <summary>
/// Extra distance to move the end of the tooltip arrow away from the tooltip point.
/// </summary>
public int CaretPadding { get; set; } = 2;
/// <summary>
/// Size, in px, of the tooltip arrow.
/// </summary>
public int CaretSize { get; set; } = 5;
/// <summary>
/// If <see langword="true" />, color boxes are shown in the tooltip.
/// </summary>
public bool DisplayColors { get; set; } = true;
/// <summary>
/// Are on-canvas tooltips enabled?
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// Horizontal alignment of the footer text lines. left/right/center.
/// </summary>
public TooltipXAlignment FooterAlign { get; set; } = TooltipXAlignment.Left;
/// <summary>
/// Color of footer text.
/// </summary>
public string FooterColor { get; set; } = "#fff";
public ChartFont FooterFont { get; set; } = new();
/// <summary>
/// Margin to add before drawing the footer.
/// </summary>
public int FooterMarginTop { get; set; } = 6;
/// <summary>
/// Spacing to add to top and bottom of each footer line.
/// </summary>
public int FooterSpacing { get; set; } = 2;
/// <summary>
/// Horizontal alignment of the title text lines. left/right/center.
/// </summary>
public TooltipXAlignment TitleAlign { get; set; } = TooltipXAlignment.Left;
/// <summary>
/// Color of title text.
/// </summary>
public string TitleColor { get; set; } = "#fff";
public ChartFont TitleFont { get; set; } = new();
/// <summary>
/// Margin to add on bottom of title section.
/// </summary>
public int TitleMarginBottom { get; set; } = 6;
/// <summary>
/// Spacing to add to top and bottom of each title line.
/// </summary>
public int TitleSpacing { get; set; } = 2;
/// <summary>
/// Position of the tooltip caret in the X direction. left/center/right.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TooltipXAlignment? XAlign { get; set; }
/// <summary>
/// Position of the tooltip caret in the Y direction. top/center/bottom.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TooltipYAlignment? YAlign { get; set; }
/// <summary>
/// Width of the color box if displayColors is true.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BoxWidth { get; set; }
/// <summary>
/// Height of the color box if displayColors is true.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BoxHeight { get; set; }
/// <summary>
/// Padding between the color box and the text.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BoxPadding { get; set; }
/// <summary>
/// Size of the border.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BorderWidth { get; set; }
/// <summary>
/// Color of the border.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BorderColor { get; set; }
/// <summary>
/// Use the corresponding point style (from dataset options) instead of color boxes, ex: star, triangle etc. (size is based on the minimum value between boxWidth and boxHeight).
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? UsePointStyle { get; set; } = false;
/// <summary>
/// true for rendering the tooltip from right to left.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Rtl { get; set; }
/// <summary>
/// This will force the text direction 'rtl' or 'ltr' on the canvas for rendering the tooltips, regardless of the css specified on the canvas
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TextDirection { get; set; }
}

View File

@@ -0,0 +1,216 @@
using RobotNet.WebApp.Charts.Enums;
using RobotNet.WebApp.Charts.Models.Common.Dataset;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.LineChart;
public class LineChartDataset : ChartDataset<double>
{
/// <summary>
/// Cap style of the line.
/// Supported values are 'butt', 'round', and 'square'.
/// </summary>
/// <remarks>
/// Default value is 'butt'.
/// </remarks>
public string BorderCapStyle { get; set; } = "butt";
/// <summary>
/// Draw the active points of a dataset over the other points of the dataset.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<bool>? DrawActiveElementsOnTop { get; set; }
/// <summary>
/// How to fill the area under the line.
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public object Fill { get; set; } = false;
/// <summary>
/// Cap style of the line when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? HoverBorderCapStyle { get; set; }
/// <summary>
/// The base axis of the dataset. 'x' for horizontal lines and 'y' for vertical lines.
/// </summary>
/// <remarks>
/// Default value is 'x'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IndexAxis? IndexAxis { get; set; }
/// <summary>
/// The fill color for points.
/// </summary>
/// <remarks>
/// Default value is 'rgba(0, 0, 0, 0.1)'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointBackgroundColor { get; set; }
/// <summary>
/// The border color for points.
/// </summary>
/// <remarks>
/// Default value is 'rgba(0, 0, 0, 0.1)'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointBorderColor { get; set; }
/// <summary>
/// The width of the point border in pixels.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointBorderWidth { get; set; }
/// <summary>
/// The pixel size of the non-displayed point that reacts to mouse events.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointHitRadius { get; set; }
/// <summary>
/// Point background color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointHoverBackgroundColor { get; set; }
/// <summary>
/// Point border color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointHoverBorderColor { get; set; }
/// <summary>
/// Border width of point when hovered.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointHoverBorderWidth { get; set; }
/// <summary>
/// The radius of the point when hovered.
/// </summary>
/// <remarks>
/// Default value is 4.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointHoverRadius { get; set; }
/// <summary>
/// The radius of the point shape. If set to 0, the point is not rendered.
/// </summary>
/// <remarks>
/// Default value is 3.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointRadius { get; set; }
/// <summary>
/// The rotation of the point in degrees.
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointRotation { get; set; }
/// <summary>
/// Style of the point.
/// Supported values are 'circle', 'cross', 'crossRot', 'dash', 'line', 'rect', 'rectRounded', 'rectRot', 'star', and
/// 'triangle' to style.
/// the point.
/// </summary>
/// <remarks>
/// Default value is 'circle'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointStyle { get; set; }
//segment
//https://www.chartjs.org/docs/latest/charts/line.html#segment
/// <summary>
/// If <see langword="false" />, the lines between points are not drawn.
/// </summary>
/// <remarks>
/// Default value is <see langword="true" />.
/// </remarks>
public bool ShowLine { get; set; } = true;
/// <summary>
/// If <see langword="true" />, lines will be drawn between points with no or null data.
/// If <see langword="false" />, points with null data will create a break in the line.
/// Can also be a number specifying the maximum gap length to span.
/// The unit of the value depends on the scale used.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? SpanGaps { get; set; }
//stack
//https://www.chartjs.org/docs/latest/charts/line.html#general
/// <summary>
/// true to show the line as a stepped line (tension will be ignored).
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public bool Stepped { get; set; }
/// <summary>
/// Bezier curve tension of the line. Set to 0 to draw straight lines.
/// This option is ignored if monotone cubic interpolation is used.
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
public double Tension { get; set; }
/// <summary>
/// The ID of the x axis to plot this dataset on.
/// </summary>
/// <remarks>
/// Default value is 'first x axis'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? XAxisID { get; set; }
/// <summary>
/// The ID of the y axis to plot this dataset on.
/// </summary>
/// <remarks>
/// Default value is 'first y axis'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? YAxisID { get; set; }
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.LineChart;
public class LineChartDatasetData(string? datasetLabel, object data, string? backgroundColor) : ChartDatasetData(datasetLabel, data, backgroundColor)
{
}

View File

@@ -0,0 +1,21 @@
using RobotNet.WebApp.Charts.Enums;
using RobotNet.WebApp.Charts.Models.BarChart;
using RobotNet.WebApp.Charts.Models.Common;
namespace RobotNet.WebApp.Charts.Models.LineChart;
public class LineChartOptions : ChartOptions
{
/// <summary>
/// The base axis of the chart. 'x' for vertical charts and 'y' for horizontal charts.
/// Supported values are 'x' and 'y'.
/// </summary>
/// <remarks>
/// Default value is <see langword="null"/>.
/// </remarks>
public IndexAxis IndexAxis { get; set; } = IndexAxis.X;
public LineChartPlugins Plugins { get; set; } = new();
public BarScales Scales { get; set; } = new();
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Plugins;
namespace RobotNet.WebApp.Charts.Models.LineChart;
public class LineChartPlugins : ChartPlugins
{
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.PieChart;
public class PieChartDataset : ChartDataset<double>
{
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.PieChart;
public class PieChartDatasetData(string? datasetLabel, double data, string? backgroundColor) : ChartDatasetData(datasetLabel, data, backgroundColor)
{
}

View File

@@ -0,0 +1,40 @@
using RobotNet.WebApp.Charts.Models.Common;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.PieChart;
public class PieChartOptions : ChartOptions
{
public PieChartPlugins Plugins { get; set; } = new();
/// <summary>
/// Gets or sets the percentage of the chart that is cut out of the middle.
/// <para>Default for Pie is 0, Default for Doughnut is 50. This will be filled in by Chart.js unless you specify a non-null value.</para>
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Cutout { get; set; }
/// <summary>
/// Gets or sets the animation-configuration for this chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public new ArcAnimation? Animation { get; set; }
/// <summary>
/// Gets or sets the starting angle to draw arcs from.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Rotation { get; set; }
/// <summary>
/// The outer radius of the chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Radius { get; set; }
/// <summary>
/// Gets or sets the sweep to allow arcs to cover.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Circumference { get; set; }
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Plugins;
namespace RobotNet.WebApp.Charts.Models.PieChart;
public class PieChartPlugins : ChartPlugins
{
}

View File

@@ -0,0 +1,8 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.PolarAreaChart;
public class PolarAreaChartDataset : ChartDataset<double>
{
public bool Circular { get; set; } = true;
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.PolarAreaChart;
public class PolarAreaChartDatasetData(string? datasetLabel, double data, string? backgroundColor) : ChartDatasetData(datasetLabel, data, backgroundColor)
{
}

View File

@@ -0,0 +1,12 @@
using RobotNet.WebApp.Charts.Models.Common;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.PolarAreaChart;
public class PolarAreaChartOptions : ChartOptions
{
public PolarAreaChartPlugins Plugins { get; set; } = new();
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public new ArcAnimation? Animation { get; set; }
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Plugins;
namespace RobotNet.WebApp.Charts.Models.PolarAreaChart;
public class PolarAreaChartPlugins : ChartPlugins
{
}

View File

@@ -0,0 +1,36 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.RadarChart.Axis;
public class AngleLines
{
/// <summary>
/// Gets or sets the value indicating whether the angle line is displayed or not.
/// </summary>
public bool Display { get; set; } = true;
/// <summary>
/// Gets or sets the color of the angled lines.
/// <para>See <see cref="ColorUtil"/> for working with colors.</para>
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
/// <summary>
/// Gets or sets the width of the angled lines.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? LineWidth { get; set; }
/// <summary>
/// Gets or sets the length and spacing of dashes of the angled lines.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int[]? BorderDash { get; set; }
/// <summary>
/// Gets or sets the offset for line dashes.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? BorderDashOffset { get; set; }
}

View File

@@ -0,0 +1,90 @@
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.RadarChart.Axis;
public class GridLines
{
/// <summary>
/// If false, do not display grid lines for this axis.
/// </summary>
public bool Display { get; set; } = true;
/// <summary>
/// If true, gridlines are circular (on radar chart only).
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Circular { get; set; }
/// <summary>
/// The color of the grid lines. If specified as an array, the first color applies to the first grid line, the second to the second grid line and so on.
/// <para>See <see cref="ColorUtil"/> for working with colors.</para>
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Color { get; set; }
/// <summary>
/// Length and spacing of dashes on grid lines
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double[]? BorderDash { get; set; }
/// <summary>
/// Stroke width of grid lines.
/// </summary>
public double LineWidth { get; set; } = 1;
/// <summary>
/// If true, draw border at the edge between the axis and the chart area.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? DrawBorder { get; set; }
/// <summary>
/// If true, draw lines on the chart area inside the axis lines. This is useful when there are multiple axes and you need to control which grid lines are drawn.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? DrawOnChartArea { get; set; }
/// <summary>
/// If true, draw lines beside the ticks in the axis area beside the chart.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? DrawTicks { get; set; }
/// <summary>
/// Length in pixels that the grid lines will draw into the axis area.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? TickMarkLength { get; set; }
/// <summary>
/// Stroke width of the grid line for the first index (index 0).
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? ZeroLineWidth { get; set; }
/// <summary>
/// Stroke color of the grid line for the first index (index 0).
/// <para>See <see cref="ColorUtil"/> for working with colors.</para>
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ZeroLineColor { get; set; }
/// <summary>
/// Length and spacing of dashes of the grid line for the first index (index 0).
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double[]? ZeroLineBorderDash { get; set; }
/// <summary>
/// Offset for line dashes of the grid line for the first index (index 0).
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? ZeroLineBorderDashOffset { get; set; }
/// <summary>
/// If true, grid lines will be shifted to be between labels. This is set to true for a category scale in a bar chart by default.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? OffsetGridLines { get; set; }
}

View File

@@ -0,0 +1,47 @@
using RobotNet.WebApp.Charts.Models.Common;
namespace RobotNet.WebApp.Charts.Models.RadarChart.Axis;
public class PointLabels
{
/// <summary>
/// Gets or sets the font color for a point label.
/// <para>See <see cref="ColorUtil"/> for working with colors.</para>
/// </summary>
public string? Color { get; set; }
/// <summary>
/// If true, point labels are shown. When display: 'auto', the label is hidden if it overlaps with another label
/// </summary>
public bool Display { get; set; }
/// <summary>
/// Background color of the point label.
/// </summary>
public string? BackdropColor { get; set; }
/// <summary>
/// Border radius of the point label
/// </summary>
public double? BorderRadius { get; set; }
/// <summary>
/// Padding of label backdrop.
/// </summary>
public ChartPadding? BackdropPadding { get; set; }
/// <summary>
/// Padding between chart and point labels.
/// </summary>
public ChartPadding? Padding { get; set; }
/// <summary>
/// Font of the point label
/// </summary>
public ChartFont? Font { get; set; }
/// <summary>
/// If true, point labels are centered.
/// </summary>
public bool? CenterPointLabels { get; set; }
}

View File

@@ -0,0 +1,41 @@
using RobotNet.WebApp.Charts.Models.BarChart.Axes;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.RadarChart.Axis;
public class RadarAxis : ChartAxes
{
/// <summary>
/// Gets or sets the angle lines configuration.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AngleLines? AngleLines { get; set; }
/// <summary>
/// Gets or sets the grid lines configuration.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public GridLines? GridLines { get; set; }
/// <summary>
/// Gets or sets the point labels configuration.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public PointLabels? PointLabels { get; set; }
/// <summary>
/// Gets or sets the ticks configuration.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public new RadialTicks? Ticks { get; set; }
/// <summary>
/// Whether to animate scaling the chart from the centre
/// </summary>
public bool Animate { get; set; } = true;
/// <summary>
/// Starting angle of the scale. In degrees, 0 is at top
/// </summary>
public double StartAngle { get; set; }
}

View File

@@ -0,0 +1,6 @@
namespace RobotNet.WebApp.Charts.Models.RadarChart.Axis;
public class RadarScale
{
public RadarAxis X { get; set; } = new();
}

View File

@@ -0,0 +1,67 @@
using RobotNet.WebApp.Charts.Models.BarChart.Axes;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.RadarChart.Axis;
public class RadialTicks : ChartAxesTicks
{
/// <summary>
/// Gets or sets the horizontal padding of label backdrop.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BackdropPaddingX { get; set; }
/// <summary>
/// Gets or sets the vertical padding of label backdrop.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? BackdropPaddingY { get; set; }
/// <summary>
/// Gets or sets the value indicating whether the scale will include 0 if it is not already included.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? BeginAtZero { get; set; }
/// <summary>
/// Gets or sets the user defined minimum number for the scale, overrides minimum value from data.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Min { get; set; }
/// <summary>
/// Gets or sets the user defined maximum number for the scale, overrides minimum value from data.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Max { get; set; }
/// <summary>
/// Gets or sets the maximum number of ticks and gridlines to show.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? MaxTicksLimit { get; set; }
/// <summary>
/// If defined and <see cref="StepSize"/> is not specified, the step size will be rounded to this many decimal places.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Precision { get; set; }
/// <summary>
/// Gets or sets the user defined fixed step size for the scale.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? StepSize { get; set; }
/// <summary>
/// Gets or sets the adjustment used when calculating the maximum data value.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? SuggestedMax { get; set; }
/// <summary>
/// Gets or sets the adjustment used when calculating the minimum data value.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? SuggestedMin { get; set; }
}

View File

@@ -0,0 +1,156 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.RadarChart;
public class RadarChartDataset : ChartDataset<double>
{
/// <summary>
/// Cap style of the line.
/// Supported values are 'butt', 'round', and 'square'.
/// </summary>
/// <remarks>
/// Default value is 'butt'.
/// </remarks>
public string BorderCapStyle { get; set; } = "butt";
/// <summary>
/// How to fill the area under the line.
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public bool Fill { get; set; }
/// <summary>
/// Cap style of the line when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? HoverBorderCapStyle { get; set; }
/// <summary>
/// The fill color for points.
/// </summary>
/// <remarks>
/// Default value is 'rgba(0, 0, 0, 0.1)'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointBackgroundColor { get; set; }
/// <summary>
/// The border color for points.
/// </summary>
/// <remarks>
/// Default value is 'rgba(0, 0, 0, 0.1)'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointBorderColor { get; set; }
/// <summary>
/// The width of the point border in pixels.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointBorderWidth { get; set; }
/// <summary>
/// The pixel size of the non-displayed point that reacts to mouse events.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointHitRadius { get; set; }
/// <summary>
/// Point background color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointHoverBackgroundColor { get; set; }
/// <summary>
/// Point border color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointHoverBorderColor { get; set; }
/// <summary>
/// Border width of point when hovered.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointHoverBorderWidth { get; set; }
/// <summary>
/// The radius of the point when hovered.
/// </summary>
/// <remarks>
/// Default value is 4.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointHoverRadius { get; set; }
/// <summary>
/// The radius of the point shape. If set to 0, the point is not rendered.
/// </summary>
/// <remarks>
/// Default value is 3.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointRadius { get; set; }
/// <summary>
/// The rotation of the point in degrees.
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointRotation { get; set; }
/// <summary>
/// Style of the point.
/// Supported values are 'circle', 'cross', 'crossRot', 'dash', 'line', 'rect', 'rectRounded', 'rectRot', 'star', and
/// 'triangle' to style.
/// the point.
/// </summary>
/// <remarks>
/// Default value is 'circle'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointStyle { get; set; }
/// <summary>
/// If <see langword="true" />, lines will be drawn between points with no or null data.
/// If <see langword="false" />, points with null data will create a break in the line.
/// Can also be a number specifying the maximum gap length to span.
/// The unit of the value depends on the scale used.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? SpanGaps { get; set; }
/// <summary>
/// Bezier curve tension of the line. Set to 0 to draw straight lines.
/// This option is ignored if monotone cubic interpolation is used.
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
public double Tension { get; set; }
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.RadarChart;
public class RadarChartDatasetData(string? datasetLabel, double data, string? backgroundColor) : ChartDatasetData(datasetLabel, data, backgroundColor)
{
}

View File

@@ -0,0 +1,20 @@
using RobotNet.WebApp.Charts.Models.RadarChart.Axis;
using RobotNet.WebApp.Charts.Models.Common;
namespace RobotNet.WebApp.Charts.Models.RadarChart;
public class RadarChartOptions : ChartOptions
{
/// <summary>
/// Gets or sets the scale configuration for this chart.
/// </summary>
public RadarScale Scales { get; set; } = new();
/// <summary>
/// Gets or sets a value indicating whether or not line gaps (by NaN data) will be spanned.
/// If <see langword="false"/>, NaN data causes a break in the line.
/// </summary>
public bool? SpanGaps { get; set; }
public RadarChartPlugins Plugins { get; set; } = new();
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Plugins;
namespace RobotNet.WebApp.Charts.Models.RadarChart;
public class RadarChartPlugins : ChartPlugins
{
}

View File

@@ -0,0 +1,4 @@
namespace RobotNet.WebApp.Charts.Models.ScatterChart;
public record ScatterChartDataPoint(double X, double Y);

View File

@@ -0,0 +1,222 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
using System.Text.Json.Serialization;
namespace RobotNet.WebApp.Charts.Models.ScatterChart;
public class ScatterChartDataset : ChartDataset<ScatterChartDataPoint>
{
/// <summary>
/// Cap style of the line.
/// Supported values are 'butt', 'round', and 'square'.
/// </summary>
/// <remarks>
/// Default value is 'butt'.
/// </remarks>
public string BorderCapStyle { get; set; } = "butt";
/// <summary>
/// Supported values are 'default', and 'monotone'.
/// </summary>
/// <remarks>
/// Default value is 'default'.
/// </remarks>
public string CubicInterpolationMode { get; set; } = "default";
/// <summary>
/// Draw the active points of a dataset over the other points of the dataset.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<bool>? DrawActiveElementsOnTop { get; set; }
/// <summary>
/// How to fill the area under the line.
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public bool Fill { get; set; }
/// <summary>
/// Cap style of the line when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? HoverBorderCapStyle { get; set; }
/// <summary>
/// The base axis of the dataset. 'x' for horizontal lines and 'y' for vertical lines.
/// </summary>
/// <remarks>
/// Default value is 'x'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? IndexAxis { get; set; }
/// <summary>
/// The fill color for points.
/// </summary>
/// <remarks>
/// Default value is 'rgba(0, 0, 0, 0.1)'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointBackgroundColor { get; set; }
/// <summary>
/// The border color for points.
/// </summary>
/// <remarks>
/// Default value is 'rgba(0, 0, 0, 0.1)'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointBorderColor { get; set; }
/// <summary>
/// The width of the point border in pixels.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointBorderWidth { get; set; }
/// <summary>
/// The pixel size of the non-displayed point that reacts to mouse events.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointHitRadius { get; set; }
/// <summary>
/// Point background color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointHoverBackgroundColor { get; set; }
/// <summary>
/// Point border color when hovered.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointHoverBorderColor { get; set; }
/// <summary>
/// Border width of point when hovered.
/// </summary>
/// <remarks>
/// Default value is 1.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointHoverBorderWidth { get; set; }
/// <summary>
/// The radius of the point when hovered.
/// </summary>
/// <remarks>
/// Default value is 4.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointHoverRadius { get; set; }
/// <summary>
/// The radius of the point shape. If set to 0, the point is not rendered.
/// </summary>
/// <remarks>
/// Default value is 3.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointRadius { get; set; }
/// <summary>
/// The rotation of the point in degrees.
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? PointRotation { get; set; }
/// <summary>
/// Style of the point.
/// Supported values are 'circle', 'cross', 'crossRot', 'dash', 'line', 'rect', 'rectRounded', 'rectRot', 'star', and
/// 'triangle' to style.
/// the point.
/// </summary>
/// <remarks>
/// Default value is 'circle'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? PointStyle { get; set; }
//segment
//https://www.chartjs.org/docs/latest/charts/line.html#segment
/// <summary>
/// If <see langword="false" />, the lines between points are not drawn.
/// By default, the scatter chart will override the showLine property of the line chart to false.
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public bool ShowLine { get; } = false;
/// <summary>
/// If <see langword="true" />, lines will be drawn between points with no or null data.
/// If <see langword="false" />, points with null data will create a break in the line.
/// Can also be a number specifying the maximum gap length to span.
/// The unit of the value depends on the scale used.
/// </summary>
/// <remarks>
/// Default value is <see langword="null" />.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? SpanGaps { get; set; }
/// <summary>
/// true to show the line as a stepped line (tension will be ignored).
/// </summary>
/// <remarks>
/// Default value is <see langword="false" />.
/// </remarks>
public bool Stepped { get; set; }
/// <summary>
/// Bezier curve tension of the line. Set to 0 to draw straight lines.
/// This option is ignored if monotone cubic interpolation is used.
/// </summary>
/// <remarks>
/// Default value is 0.
/// </remarks>
public double Tension { get; set; }
/// <summary>
/// The ID of the x axis to plot this dataset on.
/// </summary>
/// <remarks>
/// Default value is 'first x axis'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? XAxisID { get; set; }
/// <summary>
/// The ID of the y axis to plot this dataset on.
/// </summary>
/// <remarks>
/// Default value is 'first y axis'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? YAxisID { get; set; }
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Dataset;
namespace RobotNet.WebApp.Charts.Models.ScatterChart;
public class ScatterChartDatasetData(string? datasetLabel, double data, string? backgroundColor) : ChartDatasetData(datasetLabel, data, backgroundColor)
{
}

View File

@@ -0,0 +1,22 @@
using RobotNet.WebApp.Charts.Enums;
using RobotNet.WebApp.Charts.Models.BarChart;
using System.Text.Json.Serialization;
using RobotNet.WebApp.Charts.Models.Common;
namespace RobotNet.WebApp.Charts.Models.ScatterChart;
public class ScatterChartOptions : ChartOptions
{
/// <summary>
/// The base axis of the dataset. 'x' for horizontal lines and 'y' for vertical lines.
/// </summary>
/// <remarks>
/// Default value is 'x'.
/// </remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IndexAxis? IndexAxis { get; set; }
public ScatterChartPlugins Plugins { get; set; } = new();
public BarScales Scales { get; set; } = new();
}

View File

@@ -0,0 +1,7 @@
using RobotNet.WebApp.Charts.Models.Common.Plugins;
namespace RobotNet.WebApp.Charts.Models.ScatterChart;
public class ScatterChartPlugins : ChartPlugins
{
}