This commit is contained in:
2026-03-10 18:34:47 -03:00
parent 0754466359
commit b32415212f
165 changed files with 14613 additions and 2352 deletions
@@ -0,0 +1,19 @@
application.type=widget
application.code=dashgrafico
application.title=dashgrafico
application.description=dashgrafico
application.fluig.version=null
application.category=SYSTEM
application.renderer=freemarker
developer.code=G-ALES1NT-TEC09
developer.name=andrey.cunha
developer.url=http://www.fluig.com
application.uiwidget=true
application.mobileapp=false
application.version=${build.version}-${build.revision}
view.file=view.ftl
edit.file=edit.ftl
locale.file.base.name=dashgrafico
application.resource.js.1=/resources/js/dashgrafico.js
application.resource.css.2=/resources/css/dashgrafico.css
hash=4a16315e9e66fa7d797b3f6b1fb365b69f9a4ce2
@@ -0,0 +1,4 @@
<div id="MyWidget_${instanceId}" class="super-widget wcm-widget-class fluig-style-guide" data-params="MyWidget.instance()">
</div>
@@ -0,0 +1,9 @@
<div id="dashGrafico_${instanceId}"
class="super-widget wcm-widget-class fluig-style-guide"
data-params="DashGrafico.instance()">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<div style="height:260px; max-width:360px; margin:0 auto;">
<canvas id="grafico_${instanceId}"></canvas>
</div>
</div>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/dashgrafico</context-root>
<disable-cross-context>false</disable-cross-context>
</jboss-web>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
@@ -0,0 +1 @@
/* Coloque aqui seu codigo CSS */
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

@@ -0,0 +1,91 @@
var DashGrafico = SuperWidget.extend({
chart:null,
init:function(){
var self=this;
this.renderAmostra();
window.addEventListener("dashboardData",function(e){
self.render(e.detail);
});
},
render:function(dados){
var conforme=dados.filter(function(i){
return normalizaStatus(i)=="CONFORME";
}).length;
var nao=dados.filter(function(i){
return normalizaStatus(i)=="NAO_CONFORME";
}).length;
var ctx=document.getElementById("grafico_"+this.instanceId);
if(this.chart){
this.chart.destroy();
}
this.chart=new Chart(ctx,{
type:'doughnut',
data:{
labels:["Conforme ("+conforme+")","Não Conforme ("+nao+")"],
datasets:[{
data:[conforme,nao],
backgroundColor:["#2ecc71","#e74c3c"]
}]
},
options:{
responsive:true,
maintainAspectRatio:false,
cutout:"48%"
}
});
function normalizaStatus(item){
var raw = item.saidaAnalise || item.status || "";
return String(raw).trim().toUpperCase();
}
},
renderAmostra:function(){
var ctx=document.getElementById("grafico_"+this.instanceId);
if(!ctx){
return;
}
if(this.chart){
this.chart.destroy();
}
this.chart=new Chart(ctx,{
type:'doughnut',
data:{
labels:["Conforme (0)","Não Conforme (0)"],
datasets:[{
data:[1,0],
backgroundColor:["#cfd8dc","#eceff1"]
}]
},
options:{
responsive:true,
maintainAspectRatio:false,
cutout:"48%",
plugins:{
tooltip:{enabled:false}
}
}
});
}
});