Commit 4aab208d by aa.gusti

prod

1 parent b501404b
No preview for this file type
...@@ -137,6 +137,8 @@ class Views(BaseView): ...@@ -137,6 +137,8 @@ class Views(BaseView):
ar_rows = row2dict(ar_qry.all()) ar_rows = row2dict(ar_qry.all())
ap_rows = row2dict(ap_qry.all()) ap_rows = row2dict(ap_qry.all())
print('*******************************************')
print(ap_rows)
pb_rows = row2dict(pb_qry.all()) pb_rows = row2dict(pb_qry.all())
for row in ar_rows: for row in ar_rows:
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
mode: 'single', mode: 'single',
callbacks: { callbacks: {
label: function(tooltipItems, data) { label: function(tooltipItems, data) {
console.log(tooltipItems);
return tooltipItems.yLabel.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");; return tooltipItems.yLabel.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");;
} }
} }
...@@ -43,10 +42,14 @@ ...@@ -43,10 +42,14 @@
mode: 'single', mode: 'single',
callbacks: { callbacks: {
label: function(p1, data) { label: function(p1, data) {
console.log(p1, data); var dataset = data.datasets[p1.datasetIndex];
console.log(p1.datasetIndex, p1.index); var total = dataset.data.reduce(function(prevVal, curVal, curIndex, array){
return prevVal+curVal;
return data.datasets[p1.datasetIndex].data[p1.index].toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."); });
var curVal = dataset.data[p1.index];
var pers = Math.floor(((curVal/total)*100)+0.5)
var txtlabel = data.labelx[p1.index] +' ('+pers+'%):';
return txtlabel+curVal.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
//return data.datasets[p1.datasetindex].data[p1.index].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");; //return data.datasets[p1.datasetindex].data[p1.index].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");;
} }
...@@ -90,7 +93,7 @@ ...@@ -90,7 +93,7 @@
</div> </div>
<div class="col-md-10 col-xs-8 judul"> <div class="col-md-10 col-xs-8 judul">
EKSEKUTIF SUMMARY KEUANGAN DAERAH<br> EKSEKUTIF SUMMARY KEUANGAN DAERAH<br>
Tahun ${request.session['tahun']} TAHUN ${request.session['tahun']} (DALAM JUTA)
</div> </div>
</div> </div>
...@@ -134,7 +137,7 @@ ...@@ -134,7 +137,7 @@
label: "Belanja", label: "Belanja",
borderColor:"rgb(215, 196, 255)", borderColor:"rgb(215, 196, 255)",
//lineTension: 0.2, //lineTension: 0.2,
fill:false, fill:true,
data : [], data : [],
borderWidth:1, borderWidth:1,
} }
...@@ -196,14 +199,14 @@ ...@@ -196,14 +199,14 @@
datasets : [ datasets : [
{ {
label: "Pendapatan", label: "Pendapatan",
backgroundColor: "rgba(255, 99, 132,0.2)", backgroundColor: "rgba(255, 99, 132,1)",
borderColor:"rgb(255, 99, 132)", borderColor:"rgb(255, 99, 132)",
borderWidth:1, borderWidth:1,
data : [] data : []
}, },
{ {
label: "Belanja", label: "Belanja",
backgroundColor: "rgba(215, 196, 255,0.2)", backgroundColor: "rgba(215, 196, 255,1)",
borderColor:"rgb(215, 196, 255)", borderColor:"rgb(215, 196, 255)",
borderWidth:1, borderWidth:1,
data : [] data : []
...@@ -272,6 +275,7 @@ ...@@ -272,6 +275,7 @@
backgroundColor: [] backgroundColor: []
}], }],
labels: [], labels: [],
labelx: []
} }
$(function(){ $(function(){
...@@ -286,7 +290,8 @@ ...@@ -286,7 +290,8 @@
jQuery.each(html.rows, function(i, val) { jQuery.each(html.rows, function(i, val) {
pieData_103.datasets[0].data.push(val.value); pieData_103.datasets[0].data.push(val.value);
pieData_103.datasets[0].backgroundColor.push("#"+val.color); pieData_103.datasets[0].backgroundColor.push("#"+val.color);
pieData_103.labels.push(val.nama); //pieData_103.labels.push(val.nama);
pieData_103.labelx.push(val.nama);
}); });
window.myPie_103 = new Chart(ctx_103, { window.myPie_103 = new Chart(ctx_103, {
type: 'pie', type: 'pie',
...@@ -327,12 +332,12 @@ ...@@ -327,12 +332,12 @@
backgroundColor: [] backgroundColor: []
}], }],
labels: [], labels: [],
labelx:[]
} }
$(function(){ $(function(){
/*GET DATA PIE*/ /*GET DATA PIE*/
var ctx_104 = document.getElementById("canvas_104").getContext("2d"); var ctx_104 = document.getElementById("canvas_104").getContext("2d");
//window.myPie_103 = new Chart(ctx_103).Pie(pieData_103);
var npie = 0 ; var npie = 0 ;
//GET DATA FROM SERVER //GET DATA FROM SERVER
...@@ -341,11 +346,13 @@ ...@@ -341,11 +346,13 @@
url: "/eis/sipkd/grafik/pie/act", url: "/eis/sipkd/grafik/pie/act",
data: "id=104", data: "id=104",
success: function (html) { success: function (html) {
labelx = [];
if (html.success == true) { if (html.success == true) {
jQuery.each(html.rows, function(i, val) { jQuery.each(html.rows, function(i, val) {
pieData_104.datasets[0].data.push(val.value); pieData_104.datasets[0].data.push(val.value);
pieData_104.datasets[0].backgroundColor.push("#"+val.color); pieData_104.datasets[0].backgroundColor.push("#"+val.color);
pieData_104.labels.push(val.nama); //pieData_104.labels.push(val.nama);
pieData_104.labelx.push(val.nama)
}); });
window.myPie_104 = new Chart(ctx_104, { window.myPie_104 = new Chart(ctx_104, {
type: 'pie', type: 'pie',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!