Primva versione con inclusione chart in pagina Test

This commit is contained in:
Samuele Locatelli
2022-01-14 15:30:31 +01:00
parent c5a94efa21
commit 46326944b1
20 changed files with 24061 additions and 20 deletions
+59
View File
@@ -0,0 +1,59 @@
@inject IJSRuntime JSRuntime
<canvas id="@Id"></canvas>
@code {
public enum ChartType
{
Pie,
Bar
}
[Parameter]
public string Id { get; set; } = "MyChart";
[Parameter]
public ChartType Type { get; set; }
[Parameter]
public string[] Data { get; set; }
[Parameter]
public string[] BackgroundColor { get; set; }
[Parameter]
public string[] Labels { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender)
{
// Here we create an anonymous type with all the options
// that need to be sent to Chart.js
var config = new
{
Type = Type.ToString().ToLower(),
Options = new
{
Responsive = true,
//Scales = new
//{
// YAxes = new[]
// {
// new { Ticks = new {
// BeginAtZero=true
// } }
// }
//}
},
Data = new
{
Datasets = new[]
{
new { Data = Data, BackgroundColor = BackgroundColor}
},
Labels = Labels
}
};
await JSRuntime.InvokeVoidAsync("setup", Id, config);
}
}
@@ -0,0 +1,46 @@
@using CORE.Data.DbModels
@using UI.Data
@inject MessageService AppMServ
<div class="card">
<div class="card-header bg-dark text-light py-1">
<div class="row">
<div class="col-8">
<h4>Daily Cheks</h4>
</div>
<div class="col-4 py-1">
<button type="button" class="btn btn-block btn-warning py-1" @onclick="DoClose"><i class="fas fa-times"></i> Chiudi</button>
</div>
</div>
</div>
<div class="card-body text-center">
<div class="row">
<div class="col-6">
gestione temperature rilevate + insert quotidiano <b>@TargetDate.ToShortDateString()</b>
</div>
<div class="col-6">
elenco ultimi check VC19...
</div>
</div>
</div>
</div>
@code {
[Parameter]
public EventCallback<bool> CloseReq { get; set; }
[Parameter]
public DateTime TargetDate { get; set; } = DateTime.Today;
/// <summary>
/// Indico item selezionato
/// </summary>
protected async void DoClose()
{
await CloseReq.InvokeAsync(true);
}
}
@@ -42,9 +42,6 @@
[Parameter]
public EventCallback<bool> WeekSelected { get; set; }
//private int Anno = DateTime.Today.Year;
//private int Week = 1;
/// <summary>
/// Indico item selezionato
/// </summary>
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2201.1409</Version>
<Version>3.0.2201.1415</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
+1 -2
View File
@@ -16,8 +16,7 @@ else if (showTemp)
<dialog class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog">
<div class="modal-dialog modal-xl">
<div class="modal-content">
gestione temperature rilevate + insert quotidiano + elenco check VC19... <b>@DtRifTempRil</b>
<WeekSelector CloseReq="ResetSelPeriodo" WeekSelected="ReloadPeriodo"></WeekSelector>
<DayCheckEditor TargetDate="@DtRifTempRil" CloseReq="ResetDayCheck"></DayCheckEditor>
</div>
</div>
</dialog>
+10
View File
@@ -384,6 +384,16 @@ namespace GPW.CORE.UI.Pages
await ReloadData();
}
protected async Task ResetDayCheck()
{
selPeriod = false;
showTemp = false;
currRecord = null;
ListTimbr = null;
await InitData(true);
await ReloadData();
}
protected async Task ResetTimbData()
{
currRecord = null;
+12 -4
View File
@@ -5,6 +5,14 @@
<PageTitle>Test - Fasi</PageTitle>
<div class="row">
<div class="col-4">
<Chart Id="pie1" Type="@Chart.ChartType.Pie" Data="@(new[] { "1", "2" })" BackgroundColor="@(new[] { "blue","green"})" Labels="@(new[] { "Fail","Ok"})"></Chart>
</div>
<div class="col-4">
<Chart Id="bar1" Type="@Chart.ChartType.Bar" Data="@(new[] { "10", "9" })" BackgroundColor="@(new[] { "yellow","red"})" Labels="@(new[] { "Fail","Ok"})"></Chart>
</div>
</div>
<div class="p-1 flex-fill text-left">
<div class="d-flex justify-content-between text-center">
@@ -301,10 +309,10 @@
z-index: 5;
}
.overlay:hover {
z-index: +100;
opacity: 1;
}
.overlay:hover {
z-index: +100;
opacity: 1;
}
</style>
+3 -1
View File
@@ -13,7 +13,7 @@
<link href="css/site.css" rel="stylesheet" />
<link href="lib/font-awesome/css/all.css" rel="stylesheet" />
<link href="GPW.CORE.UI.styles.css" rel="stylesheet" />
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
<component type="typeof(HeadOutlet)" render-mode="Server" />
</head>
<body>
@RenderBody()
@@ -30,5 +30,7 @@
</div>
<script src="_framework/blazor.server.js"></script>
<script src="lib/Chart.js/chart.js"></script>
<script src="lib/chartBoot.js"></script>
</body>
</html>
+1
View File
@@ -8,3 +8,4 @@
@using Microsoft.JSInterop
@using GPW.CORE.UI
@using GPW.CORE.UI.Shared
@using GPW.CORE.UI.Components
+9 -6
View File
@@ -5,11 +5,14 @@
{
"library": "font-awesome@5.15.4",
"destination": "wwwroot/lib/font-awesome/"
},
{
"library": "bootstrap@4.6.1",
"destination": "wwwroot/lib/bootstrap/"
},
{
"library": "Chart.js@3.7.0",
"destination": "wwwroot/lib/Chart.js/"
}
,
{
"library": "bootstrap@4.6.1",
"destination": "wwwroot/lib/bootstrap/"
}
]
]
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
/*!
* Chart.js v3.7.0
* https://www.chartjs.org
* (c) 2021 Chart.js Contributors
* Released under the MIT License
*/
export { H as HALF_PI, aX as INFINITY, P as PI, aW as PITAU, aZ as QUARTER_PI, aY as RAD_PER_DEG, T as TAU, a_ as TWO_THIRDS_PI, Q as _addGrace, V as _alignPixel, a0 as _alignStartEnd, p as _angleBetween, a$ as _angleDiff, _ as _arrayUnique, a6 as _attachContext, aq as _bezierCurveTo, an as _bezierInterpolation, av as _boundSegment, al as _boundSegments, a3 as _capitalize, ak as _computeSegments, a7 as _createResolver, aH as _decimalPlaces, aP as _deprecated, a8 as _descriptors, af as _elementsEqual, M as _factorize, aJ as _filterBetween, F as _getParentNode, U as _int16Range, ah as _isBetween, ag as _isClickEvent, K as _isDomSupported, z as _isPointInArea, w as _limitValue, aI as _longestText, aK as _lookup, x as _lookupByKey, S as _measureText, aN as _merger, aO as _mergerIf, aw as _normalizeAngle, ao as _pointInLine, ai as _readValueToProps, A as _rlookupByKey, aD as _setMinAndMaxByKey, am as _steppedInterpolation, ap as _steppedLineTo, az as _textX, $ as _toLeftRightCenter, aj as _updateBezierControlPoints, as as addRoundedRectPath, aG as almostEquals, aF as almostWhole, O as callback, ad as clearCanvas, W as clipArea, aM as clone, c as color, h as createContext, ab as debounce, j as defined, aC as distanceBetweenPoints, ar as drawPoint, D as each, e as easingEffects, N as finiteOrDefault, aU as fontString, o as formatNumber, B as getAngleFromPoint, aL as getHoverColor, E as getMaximumSize, y as getRelativePosition, ax as getRtlAdapter, aT as getStyle, b as isArray, g as isFinite, a5 as isFunction, k as isNullOrUndef, q as isNumber, i as isObject, l as listenArrayEvents, L as log10, a2 as merge, a9 as mergeIf, aE as niceNum, aB as noop, ay as overrideTextDirection, G as readUsedSize, X as renderText, r as requestAnimFrame, a as resolve, f as resolveObjectKey, aA as restoreTextDirection, ac as retinaScale, ae as setsEqual, s as sign, aR as splineCurve, aS as splineCurveMonotone, J as supportsEventListenerOptions, I as throttled, R as toDegrees, n as toDimension, Z as toFont, aQ as toFontString, aV as toLineHeight, C as toPadding, m as toPercentage, t as toRadians, at as toTRBL, au as toTRBLCorners, aa as uid, Y as unclipArea, u as unlistenArrayEvents, v as valueOrDefault } from './chunks/helpers.segment.js';
+1
View File
@@ -0,0 +1 @@
export{H as HALF_PI,aX as INFINITY,P as PI,aW as PITAU,aZ as QUARTER_PI,aY as RAD_PER_DEG,T as TAU,a_ as TWO_THIRDS_PI,Q as _addGrace,V as _alignPixel,a0 as _alignStartEnd,p as _angleBetween,a$ as _angleDiff,_ as _arrayUnique,a6 as _attachContext,aq as _bezierCurveTo,an as _bezierInterpolation,av as _boundSegment,al as _boundSegments,a3 as _capitalize,ak as _computeSegments,a7 as _createResolver,aH as _decimalPlaces,aP as _deprecated,a8 as _descriptors,af as _elementsEqual,M as _factorize,aJ as _filterBetween,F as _getParentNode,U as _int16Range,ah as _isBetween,ag as _isClickEvent,K as _isDomSupported,z as _isPointInArea,w as _limitValue,aI as _longestText,aK as _lookup,x as _lookupByKey,S as _measureText,aN as _merger,aO as _mergerIf,aw as _normalizeAngle,ao as _pointInLine,ai as _readValueToProps,A as _rlookupByKey,aD as _setMinAndMaxByKey,am as _steppedInterpolation,ap as _steppedLineTo,az as _textX,$ as _toLeftRightCenter,aj as _updateBezierControlPoints,as as addRoundedRectPath,aG as almostEquals,aF as almostWhole,O as callback,ad as clearCanvas,W as clipArea,aM as clone,c as color,h as createContext,ab as debounce,j as defined,aC as distanceBetweenPoints,ar as drawPoint,D as each,e as easingEffects,N as finiteOrDefault,aU as fontString,o as formatNumber,B as getAngleFromPoint,aL as getHoverColor,E as getMaximumSize,y as getRelativePosition,ax as getRtlAdapter,aT as getStyle,b as isArray,g as isFinite,a5 as isFunction,k as isNullOrUndef,q as isNumber,i as isObject,l as listenArrayEvents,L as log10,a2 as merge,a9 as mergeIf,aE as niceNum,aB as noop,ay as overrideTextDirection,G as readUsedSize,X as renderText,r as requestAnimFrame,a as resolve,f as resolveObjectKey,aA as restoreTextDirection,ac as retinaScale,ae as setsEqual,s as sign,aR as splineCurve,aS as splineCurveMonotone,J as supportsEventListenerOptions,I as throttled,R as toDegrees,n as toDimension,Z as toFont,aQ as toFontString,aV as toLineHeight,C as toPadding,m as toPercentage,t as toRadians,at as toTRBL,au as toTRBLCorners,aa as uid,Y as unclipArea,u as unlistenArrayEvents,v as valueOrDefault}from"./chunks/helpers.segment.js";
+36
View File
@@ -0,0 +1,36 @@

///Setup del chart desiderato con id univoco
window.setup = (id, config) => {
var ctx = document.getElementById(id).getContext('2d');
//console.log("Calling setup...");
//console.log(id);
if (window['chart-' + id] instanceof Chart) {
//window.myChart.destroy();
//console.log("Chart destroyed!");
window['chart-' + id].update();
console.log("Chart " + id + " updated!");
}
else {
window['chart-' + id] = new Chart(ctx, config);
console.log("Chart " + id + " created!");
}
//console.log(window['chart-' + id]);
}
//window.setup = (id, config) => {
// var ctx = document.getElementById(id).getContext('2d');
// //console.log("Calling setup...");
// //console.log(id);
// if (window.myChart instanceof Chart) {
// //window.myChart.destroy();
// //console.log("Chart destroyed!");
// window.myChart.update();
// console.log("Chart " + id + " updated!");
// }
// else {
// window.myChart = new Chart(ctx, config);
// console.log("Chart " + id + " created!");
// }
// console.log(window.myChart);
//}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 3.0.2201.1409</h4>
<h4>Versione: 3.0.2201.1415</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
3.0.2201.1409
3.0.2201.1415
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>3.0.2201.1409</version>
<version>3.0.2201.1415</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>