Bozza chart

This commit is contained in:
Samuele E. Locatelli
2020-09-03 10:28:53 +02:00
parent 8e5ec21efd
commit cd9045e074
4 changed files with 169 additions and 1 deletions
+1 -1
View File
@@ -75,9 +75,9 @@ namespace GPW_Smart.WS
valori.Add(0);
}
}
#endif
allData.Add(etichette);
allData.Add(valori);
#endif
// restituisco oggetto!
return allData;
}
+116
View File
@@ -0,0 +1,116 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_chart.ascx.cs" Inherits="GPW_Smart.WebUserControls.cmp_chart" %>
<canvas id="myChart" width="300" height="150"></canvas>
<asp:HiddenField runat="server" ID="hfIdxPaziente" />
<asp:HiddenField runat="server" ID="hfData" />
<%--<script>
// funzione eseguita se successo al caricamento
function OnSuccess_(reponse) {
// recupero obj chart
var ctx = document.getElementById("myChart");
var aData = reponse.d;
var titolo = aData[0];
var maxVal = aData[1];
var aLabels = aData[2];
var aDatasets1 = aData[3];
var options = {
responsive: true,
maintainAspectRatio: true,
scale: {
ticks: {
beginAtZero: true,
max: maxVal,
min: -0.5
}
},
animation: {
duration: 0
},
legend: {
display: false
}
};
var data = {
labels: aLabels,
datasets: [
// valori effettivi!
{
label: titolo,
backgroundColor: "rgba(54, 162, 235, 0.4)",
borderColor: "rgba(54, 162, 235, 1)",
borderWidth: 4,
pointBackgroundColor: "rgba(54, 100, 165, 1)",
pointRadius: 8,
data: aDatasets1
},
// verde scuro
{
backgroundColor: "rgba(34, 255, 34, 0.35)",
borderColor: "rgba(34, 255, 34, 1)",
borderWidth: 1,
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
// verde
{
backgroundColor: "rgba(54, 255, 54, 0.35)",
borderColor: "rgba(54, 255, 54, 1)",
borderWidth: 1,
data: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
},
// giallo
{
backgroundColor: "rgba(255, 255, 54, 0.25)",
borderColor: "rgba(255, 255, 54, 1)",
borderWidth: 1,
data: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
},
// arancione
{
backgroundColor: "rgba(255, 135, 54, 0.15)",
borderColor: "rgba(255, 135, 54, 1)",
borderWidth: 1,
data: [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
},
// rosso esterno
{
backgroundColor: "rgba(255, 54, 54, 0.05)",
borderColor: "rgba(255, 54, 54, 1)",
borderWidth: 1,
data: [4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
}
]
};
var myChart = new Chart(ctx, {
type: 'radar',
data: data,
options: options
});
}
// errore in reload!
function OnErrorCall_(repo) {
alert("Errore recupero dati grafico!");
}
// effettuo plotting grafico!
function plotRadar() {
// caricamento pagina
$.ajax({
type: "POST",
url: "Services/WS_data.asmx/userScoreData",
data: "{ idxUser: <%=hfIdxPaziente.Value %>, dataRif: '<%=hfData.Value%>' }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess_,
error: OnErrorCall_
});
//alert("Loaded 01!");
}
// funzione di drawing ad OGNI pageload!
function pageLoad() {
plotRadar();
}
</script>--%>
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GPW_Smart.WebUserControls
{
public partial class cmp_chart : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
+35
View File
@@ -0,0 +1,35 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace GPW_Smart.WebUserControls
{
public partial class cmp_chart
{
/// <summary>
/// Controllo hfIdxPaziente.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfIdxPaziente;
/// <summary>
/// Controllo hfData.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfData;
}
}