Skip to content

Instantly share code, notes, and snippets.

@MoisesTedeschi
Created August 3, 2021 13:15
Show Gist options
  • Save MoisesTedeschi/a8c713963ae8cd3e300c6d7d1bd23e4f to your computer and use it in GitHub Desktop.
Save MoisesTedeschi/a8c713963ae8cd3e300c6d7d1bd23e4f to your computer and use it in GitHub Desktop.
Credit Score
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<style>
#credit-score {
max-width: 235px;
width: 100%;
display: flex;
align-items: center;
margin: 0 auto;
}
#credit-score .sub_title {
color: #8883C5 ;
font-size: 10px;
}
</style>
</head>
<body>
<div id='credit-score'></div>
<script src="https://cdn.zingchart.com/zingchart.min.js"></script>
<script>
//Random de Valores
//window.feed = function(callback) {
// var tick = {};
// tick.plot0 = Math.ceil(5 + (Math.random() * 95));
// callback(JSON.stringify(tick));
//};
var creditScoreConfig = {
type: "gauge",
globals: {
fontSize: 25,
},
plotarea:{
margin: '0 5 0 5',
},
plot:{
size:'60%',
valueBox: {
placement: 'center',
text:'%v',
fontSize:18,
fontWeight: 'normal',
color: "#0C00A0",
paddingTop:-30,
rules:[
{
rule: '%v > 75',
text: '%v<br>de 100'
},
{
rule: '%v >= 50 && %v <= 75',
text: '%v<br>de 100'
},
{
rule: '%v >= 25 && %v <= 50',
text: '%v<br>de 100'
},
{
rule: '%v < 26',
text: '%v<br>de 100'
}
],
}
},
tooltip:{
borderRadius:2,
fontSize:10,
},
scaleR:{
aperture:180,
minValue:0,
maxValue:100,
step:25,
center:{
visible:false,
},
tick:{
visible:false,
size: 35,
},
item:{
offsetR:0,
visible:false,
},
//labels:['','','','',''],
ring:{
size:35,
backgroundColor:'#F7F7F7',
borderColor: '#F7F7F7',
borderWidth: 4,
rules:[
{
rule: '%v < 26',
backgroundColor:'#FD4C54',
},
{
rule: '%v >= 25 && %v <= 50',
backgroundColor:'#FDE600',
},
{
rule: '%v >= 50 && %v <= 75',
backgroundColor:'#B5F7B8',
},
{
rule: '%v >= 75',
backgroundColor:'#7EF483',
}
],
}
},
//Random de Valores
//refresh:{
// type:"feed",
// transport:"js",
// url:"feed()",
// interval:1500,
// resetTimeout:1000
//},
series : [
{
values : [71], //Valor do ponteiro
backgroundColor:'#0C00A0',
indicator:[14, 1, -65, -50, 0.60],
"border-radius": 4,
animation:{
effect:2,
method:2,
sequence:4,
speed: 2500
},
},
]
};
zingchart.render({
id : 'credit-score',
data : creditScoreConfig,
height: '500',
width: '100%',
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment