Skip to content

Instantly share code, notes, and snippets.

@bsatrom
Created March 14, 2012 17:49
Show Gist options
  • Save bsatrom/2038193 to your computer and use it in GitHub Desktop.
Save bsatrom/2038193 to your computer and use it in GitHub Desktop.
Example of script for Kendo UI DataViz Gauge
$('#add').bind('click', function() {
var amt, intakeRecord, grid, gauge;
amt = parseInt($('#dailyIntake').val()) || 0;
intakeRecord = { date: getDate(), amount: amt }
intakeData.add(intakeRecord);
gauge = $("#srirachaGauge").data("kendoGauge");
gauge.value(avgIntake());
});​
var srirachaMax = 20;
$('#srirachaGauge').kendoGauge({
theme: "blueopal",
pointer: {
value: avgIntake()
},
scale: {
majorUnit: 2,
minorUnit: .25,
startAngle: -30,
endAngle: 210,
max: srirachaMax,
labels: {
font: "10px arial, Helvetica, sans-serif",
template: "#=value# tsp."
},
ranges: [
{
from: 0,
to: 10,
color: "#00ab00" //green
}, {
from: 10,
to: 16,
color: "#d3ce37" //yellow
}, {
from: 16,
to: srirachaMax,
color: "#ae130f" //red
}
]
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment