sparqapi/api/application/views/welcome_message.php
2020-01-28 20:11:56 +05:30

143 lines
3.2 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
//echo $_SERVER['REQUEST_URI'];
$score = substr($_SERVER['REQUEST_URI'],(strripos($_SERVER['REQUEST_URI'],"?")+1));
//$score = 25.3;
?><!DOCTYPE html>
<html>
<title>PDSCORE CHART</title>
<head>
<script src="https://cdn.zingchart.com/2.8.4/zingchart.min.js"></script>
<script>
zingchart.MODULESDIR = "https://cdn.zingchart.com/modules/";
ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "ee6b7db5b51705a13dc2339db3edaf6d"];
</script>
<style>
html,
body {
height: 100%;
width: 100%;
}
#myChart {
height: 100%;
width: 100%;
min-height: 150px;
}
.zc-ref {
display: none;
}
</style>
</head>
<body>
<div id='myChart'><a class="zc-ref" href="https://www.zingchart.com/">Charts by ZingChart</a></div>
<script>
<!-- window.feed = function(callback) { -->
<!-- var tick = {}; -->
<!-- tick.plot0 = Math.ceil(350 + (Math.random() * 500)); -->
<!-- callback(JSON.stringify(tick)); -->
<!-- }; -->
var myConfig = {
type: "gauge",
globals: {
fontSize: 25
},
plotarea: {
marginTop: 80
},
plot: {
size: '100%',
valueBox: {
placement: 'center',
text: '%v', //default
fontSize: 26,
rules: [{
rule: '%v >= 80',
text: '%v<br>EXCELLENT'
}, {
rule: '%v < 80 && %v >= 65',
text: '%v<br>Good'
}, {
rule: '%v < 65 && %v >= 50',
text: '%v<br>Fair'
}, {
rule: '%v <= 49',
text: '%v<br>Poor'
}]
}
},
tooltip: {
borderRadius: 20
},
scaleR: {
aperture: 180,
minValue: 0,
maxValue: 100,
//step: 20,
center: {
visible: false
},
tick: {
visible: false
},
item: {
offsetR: 0,
rules: [{
rule: '%i == 9',
offsetX: 15
}]
},
//labels: ['0', '10', '20','30', '40', '50', '60', '70', '80', '90', '100'],
// labels: ['0', '10', '10','30', '20', '50', '30', '70', '40', '90', '50'],
ring: {
size: 65,
rules: [{
rule: '%v <= 49',
backgroundColor: '#E53935',
}, {
rule: '%v < 65 && %v >= 50',
backgroundColor: '#ff9900'
}, {
rule: '%v < 80 && %v >= 65',
backgroundColor: '#99ff66'
}, {
rule: '%v >= 80',
backgroundColor: '#33cc33'
}]
}
},
refresh: {
type: "feed",
transport: "js",
url: "feed()",
interval: 1500,
resetTimeout: 1000
},
series: [{
values: [<?php echo $score;?>], // starting value
backgroundColor: 'black',
indicator: [10, 1, 20, 50, 0.24],
animation: {
effect: 1,
method: 1,
sequence: 1,
speed: 500
},
}]
};
zingchart.render({
id: 'myChart',
data: myConfig,
height: 500,
width: '100%'
});
</script>
</body>
</html>