Files
GPW/GPW_Smart/WebUserControls/cmp_chart.ascx
T
Samuele E. Locatelli cd9045e074 Bozza chart
2020-09-03 10:28:53 +02:00

116 lines
3.0 KiB
Plaintext

<%@ 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>--%>