working in pmGauge and dashboards
This commit is contained in:
@@ -56,25 +56,57 @@
|
|||||||
$arrowBody = ImageColorAllocate($im, 228, 114, 86);
|
$arrowBody = ImageColorAllocate($im, 228, 114, 86);
|
||||||
$arrowLine = ImageColorAllocate($im, 207, 74, 42);
|
$arrowLine = ImageColorAllocate($im, 207, 74, 42);
|
||||||
$redArc = ImageColorAllocate($im, 220, 57, 18);
|
$redArc = ImageColorAllocate($im, 220, 57, 18);
|
||||||
$yellowArc = ImageColorAllocate($im, 255, 153, 0);
|
$yellowArc = ImageColorAllocate($im, 255, 153, 0);
|
||||||
|
|
||||||
$black = ImageColorAllocate($im, 0,0,0);
|
$black = ImageColorAllocate($im, 0,0,0);
|
||||||
$white = ImageColorAllocate($im, 255, 255, 255);
|
$white = ImageColorAllocate($im, 255, 255, 255);
|
||||||
$gray = ImageColorAllocate($im, 190, 190, 190);
|
$gray = ImageColorAllocate($im, 190, 190, 190);
|
||||||
|
|
||||||
$fontArial = PATH_THIRDPARTY . 'html2ps_pdf/fonts/arial.ttf';
|
$fontArial = PATH_THIRDPARTY . 'html2ps_pdf/fonts/arial.ttf';
|
||||||
$fontCourier = PATH_THIRDPARTY . 'html2ps_pdf/fonts/cour.ttf';
|
|
||||||
$fontCourbd = PATH_THIRDPARTY . 'html2ps_pdf/fonts/courbd.ttf';
|
|
||||||
|
|
||||||
ImageFilledRectangle($im, 0, 0, $width-1, $height-1, $white);
|
ImageFilledRectangle($im, 0, 0, $width-1, $height-1, $white);
|
||||||
ImageRectangle ($im, 0, 0, $width-1, $height-1, $gray);
|
ImageRectangle ($im, 0, 0, $width-1, $height-1, $gray);
|
||||||
|
|
||||||
//center coords
|
//center coords
|
||||||
$cX = intval($this->w /2);
|
$cX = intval($this->w /4);
|
||||||
$cY = intval($this->h /2);
|
$cY = intval($this->h /2);
|
||||||
|
|
||||||
//diameter for gauge
|
//diameter for gauge
|
||||||
$diameter = intval( $this->h * 4/5 );
|
$diameter = intval( $this->h * 4/5 );
|
||||||
|
|
||||||
|
$this->renderGauge($im, $cX, $cY, $diameter);
|
||||||
|
|
||||||
|
//center coords
|
||||||
|
$cX = intval($this->w * 3/4);
|
||||||
|
$cY = intval($this->h /2);
|
||||||
|
|
||||||
|
//diameter for gauge
|
||||||
|
$diameter = intval( $this->h * 4/5 );
|
||||||
|
|
||||||
|
$this->renderGauge($im, $cX, $cY, $diameter);
|
||||||
|
|
||||||
|
Header("Content-type: image/png");
|
||||||
|
ImagePng($im);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderGauge($im, $cX, $cY, $diameter) {
|
||||||
|
//gauge color
|
||||||
|
$bgcolor = ImageColorAllocate($im, 247, 247, 247);
|
||||||
|
$extRing = ImageColorAllocate($im, 214, 214, 214);
|
||||||
|
$blueRing = ImageColorAllocate($im, 70, 132, 238);
|
||||||
|
$blueRingLine = ImageColorAllocate($im, 106, 114, 127);
|
||||||
|
$arrowBody = ImageColorAllocate($im, 228, 114, 86);
|
||||||
|
$arrowLine = ImageColorAllocate($im, 207, 74, 42);
|
||||||
|
$redArc = ImageColorAllocate($im, 220, 57, 18);
|
||||||
|
$yellowArc = ImageColorAllocate($im, 255, 153, 0);
|
||||||
|
|
||||||
|
$black = ImageColorAllocate($im, 0,0,0);
|
||||||
|
$white = ImageColorAllocate($im, 255, 255, 255);
|
||||||
|
$gray = ImageColorAllocate($im, 190, 190, 190);
|
||||||
|
|
||||||
|
$fontArial = PATH_THIRDPARTY . 'html2ps_pdf/fonts/arial.ttf';
|
||||||
|
|
||||||
$dX = intval($diameter *8/7 ); //for now ratio aspect is 8:7
|
$dX = intval($diameter *8/7 ); //for now ratio aspect is 8:7
|
||||||
$dY = intval($diameter);
|
$dY = intval($diameter);
|
||||||
$dXRing = intval($dX * 0.90);
|
$dXRing = intval($dX * 0.90);
|
||||||
@@ -194,8 +226,6 @@
|
|||||||
$centerY = $cY+$dYRing/2+3-abs($bbox[5]);
|
$centerY = $cY+$dYRing/2+3-abs($bbox[5]);
|
||||||
imagettftext ( $im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay );
|
imagettftext ( $im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay );
|
||||||
|
|
||||||
Header("Content-type: image/png");
|
|
||||||
ImagePng($im);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Dashboard extends Controller {
|
|||||||
$width = 300;
|
$width = 300;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$width = $_REQUEST['w'];
|
$width = $_REQUEST['w']-10;
|
||||||
}
|
}
|
||||||
$this->pmDashlet->render( $width);
|
$this->pmDashlet->render( $width);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,5 +132,35 @@ Ext.onReady(function(){
|
|||||||
// }
|
// }
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//var dashletsInstances = [{"DAS_INS_UID":"00000000000000000000000000000001","DAS_TITLE":"Open Cases VS Complete Cases"}];
|
||||||
|
|
||||||
|
var pd = Ext.getCmp('portalDashboard');
|
||||||
|
for ( var i = 0; i < dashletsInstances.length; i++ ) {
|
||||||
|
var np = new Ext.ux.Portlet ( {
|
||||||
|
title: dashletsInstances[i].DAS_TITLE,
|
||||||
|
dasInsUid : dashletsInstances[i].DAS_INS_UID,
|
||||||
|
html: 'gauge placeholder',
|
||||||
|
listeners: {
|
||||||
|
'render': function(p){
|
||||||
|
p.html = 'hello ' + p.getWidth();
|
||||||
|
},
|
||||||
|
'move' : function(p){
|
||||||
|
Ext.Msg.alert('Portlet ', 'move ' + p.getWidth() );
|
||||||
|
p.html = 'show ' + p.getWidth();
|
||||||
|
},
|
||||||
|
'resize' : function(p,w,h){
|
||||||
|
var randomnumber=Math.floor(Math.random()*1000000)
|
||||||
|
var img = new Ext.XTemplate("<img src='{page}?w={width}&r={random}&DAS_INS_UID={id}'>").apply({
|
||||||
|
page: 'dashboard/renderDashletInstance', width:w, random: randomnumber, id: p.dasInsUid })
|
||||||
|
p.update(img );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
pd.items.items[0].add( np );
|
||||||
|
} //for
|
||||||
|
pd.doLayout();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user