64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace GPW.WebUserControls
|
|
{
|
|
public partial class mod_barPlot : System.Web.UI.UserControl
|
|
{
|
|
protected SteamWare.DataType.DatoBarPlot[] _elencoValori;
|
|
public double resolution { get; set; }
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
//doPlot();
|
|
}
|
|
|
|
public SteamWare.DataType.DatoBarPlot[] elencoValori
|
|
{
|
|
get
|
|
{
|
|
return _elencoValori;
|
|
}
|
|
set
|
|
{
|
|
_elencoValori = value;
|
|
doPlot();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// esegue plotting, creando tante celle quanti i valori dell'array passato
|
|
/// </summary>
|
|
private void doPlot()
|
|
{
|
|
try
|
|
{
|
|
TableRow riga = new TableRow();
|
|
TableCell cell;
|
|
for (int i = 0; i < _elencoValori.Length; i++)
|
|
{
|
|
// solo se >0 aggiungo cella...
|
|
if (_elencoValori[i].valore > 0)
|
|
{
|
|
cell = new TableCell();
|
|
cell.CssClass = _elencoValori[i].css;
|
|
// se il valore è sotto 10px NON metto il testo...
|
|
if ((_elencoValori[i].valore / resolution) > 20)
|
|
{
|
|
cell.Text = _elencoValori[i].label;
|
|
}
|
|
cell.Width = Convert.ToInt32(Math.Ceiling((double)_elencoValori[i].valore / resolution));
|
|
cell.ToolTip = _elencoValori[i].tooltip;
|
|
riga.Cells.Add(cell);
|
|
}
|
|
}
|
|
tblData.Rows.Add(riga);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
}
|
|
} |