Files
egwcorelib/EgwCoreLib.Razor/CircleGaugeMulti.razor.cs
T
2023-10-13 12:15:04 +02:00

78 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
namespace EgwCoreLib.Razor
{
public partial class CircleGaugeMulti
{
[Parameter]
public string Titolo { get; set; } = "Titolo";
[Parameter]
public string Testo { get; set; } = "Testo";
[Parameter]
public string StyleTitolo { get; set; } = "font-size: 3em; font-weight:bold; fill: white;";
[Parameter]
public string StyleTesto { get; set; } = "font-size: 1em; fill: gray;";
[Parameter]
public List<CircSegm> ListInner { get; set; } = new List<CircSegm>();
[Parameter]
public List<CircSegm> ListOuter { get; set; } = new List<CircSegm>();
/// <summary>
/// Indica se mostrare o meno il btn centrale
/// </summary>
[Parameter]
public bool ShowCircleBtn { get; set; } = false;
/// <summary>
/// Valore MASSIMO da rappresentare (=100%)
/// </summary>
[Parameter]
public int maxVal { get; set; } = 0;
/// <summary>
/// Spessore dei cerchi da disegnare
/// </summary>
[Parameter]
public int sWidth { get; set; } = 10;
/// <summary>
/// Raggio cerchio interno (0..100)
/// </summary>
[Parameter]
public int innRad { get; set; } = 70;
/// <summary>
/// Raggio cerchio esterno (0..100)
/// </summary>
[Parameter]
public int outRad { get; set; } = 85;
private bool showOuter
{
get => ListOuter.Count > 0;
}
protected string calcDash(int currRad, int currVal)
{
string answ = $"{currRad * 6.2832 * currVal / maxVal:N0} {currRad * 6.2832 * (maxVal - currVal) / maxVal:N0}";
return answ;
}
/// <summary>
/// Parametri per disegno segmento circolare
/// </summary>
public class CircSegm
{
public int Value { get; set; } = 0;
public string Color { get; set; } = "#00FF66";
}
}
}