att
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
application.type=widget
|
||||
application.code=dashregional
|
||||
application.title=dashregional
|
||||
application.description=dashregional
|
||||
application.fluig.version=null
|
||||
application.category=SYSTEM
|
||||
application.renderer=freemarker
|
||||
developer.code=andrey.cunha
|
||||
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=dashregional
|
||||
application.resource.js.1=/resources/js/dashregional.js
|
||||
application.resource.css.2=/resources/css/dashregional.css
|
||||
hash=4a16315e9e66fa7d797b3f6b1fb365b69f9a4ce2
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -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,18 @@
|
||||
<div id="dashRegional_${instanceId}"
|
||||
class="super-widget wcm-widget-class fluig-style-guide"
|
||||
data-params="DashRegional.instance()">
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Não Conformes por Regional</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<canvas id="graficoRegional_${instanceId}" height="120"></canvas>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jboss-web>
|
||||
<context-root>/dashregional</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>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
div[id^="dashRegional_"] {
|
||||
position: relative !important;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
div[id^="dashRegional_"] .panel {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div[id^="dashRegional_"] canvas {
|
||||
max-height: 260px;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
+102
@@ -0,0 +1,102 @@
|
||||
var DashRegional = SuperWidget.extend({
|
||||
|
||||
chart:null,
|
||||
|
||||
init:function(){
|
||||
|
||||
var self=this;
|
||||
this.renderAmostra();
|
||||
|
||||
window.addEventListener("dashboardData",function(e){
|
||||
|
||||
self.render(e.detail);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
render:function(dados){
|
||||
|
||||
var mapa={};
|
||||
|
||||
// soma nao conformes por regional
|
||||
dados.forEach(function(i){
|
||||
|
||||
var regional=i.regional || "Sem regional";
|
||||
|
||||
if(!mapa[regional]) mapa[regional]=0;
|
||||
|
||||
mapa[regional]+=parseInt(i.qtdNaoConforme||0,10) || 0;
|
||||
|
||||
});
|
||||
|
||||
// transformar em arrays
|
||||
var labels=Object.keys(mapa);
|
||||
var valores=Object.values(mapa);
|
||||
|
||||
if(!labels.length){
|
||||
labels=["Aguardando filtro"];
|
||||
valores=[0];
|
||||
}
|
||||
|
||||
// canvas
|
||||
var ctx=document.getElementById("graficoRegional_"+this.instanceId);
|
||||
|
||||
if(this.chart){
|
||||
this.chart.destroy();
|
||||
}
|
||||
|
||||
// criar gráfico
|
||||
this.chart=new Chart(ctx,{
|
||||
|
||||
type:'bar',
|
||||
|
||||
data:{
|
||||
labels:labels,
|
||||
datasets:[{
|
||||
label:"Não conformes",
|
||||
data:valores,
|
||||
backgroundColor:"#e74c3c"
|
||||
}]
|
||||
},
|
||||
|
||||
options:{
|
||||
responsive:true,
|
||||
plugins:{
|
||||
legend:{display:false}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
renderAmostra:function(){
|
||||
var ctx=document.getElementById("graficoRegional_"+this.instanceId);
|
||||
if(!ctx){
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.chart){
|
||||
this.chart.destroy();
|
||||
}
|
||||
|
||||
this.chart=new Chart(ctx,{
|
||||
type:'bar',
|
||||
data:{
|
||||
labels:["Aguardando filtro"],
|
||||
datasets:[{
|
||||
label:"Não conformes",
|
||||
data:[0],
|
||||
backgroundColor:"#cfd8dc"
|
||||
}]
|
||||
},
|
||||
options:{
|
||||
responsive:true,
|
||||
plugins:{legend:{display:false}}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
Binary file not shown.
Reference in New Issue
Block a user