using Microsoft.AspNetCore.Components;
using RobotNet.WebApp.Charts.Enums;
using System.Globalization;
namespace RobotNet.WebApp.Charts.Core;
public class RobotNetChart : BlazorComponentBase, IDisposable, IAsyncDisposable
{
internal ChartType chartType;
///
public new virtual void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
///
public new virtual async ValueTask DisposeAsync()
{
await DisposeAsyncCore(true);
Dispose(false);
GC.SuppressFinalize(this);
}
private string GetChartContainerSizeAsStyle()
{
var style = "";
if (Width > 0)
style += $"width:{Width.Value.ToString(CultureInfo.InvariantCulture)}{WidthUnit.ToCssString()};";
if (Height > 0)
style += $"height:{Height.Value.ToString(CultureInfo.InvariantCulture)}{HeightUnit.ToCssString()};";
return style;
}
internal string ContainerStyle => GetChartContainerSizeAsStyle();
///
/// Gets or sets chart container height.
/// The default unit of measure is .
/// To change the unit of measure see .
///
///
/// Default value is null.
///
[Parameter]
public int? Height { get; set; }
///
/// Gets or sets chart container height unit of measure.
///
///
/// Default value is .
///
[Parameter]
public Unit HeightUnit { get; set; } = Unit.Px;
///
/// Get or sets chart container width.
/// The default unit of measure is .
/// To change the unit of measure see .
///
///
/// Default value is null.
///
[Parameter]
public int? Width { get; set; }
///
/// Gets or sets chart container width unit of measure.
///
///
/// Default value is .
///
[Parameter]
public Unit WidthUnit { get; set; } = Unit.Px;
}