Radial Gauge

Linear Gauge

Bullet Graph

Segmented Display


This sample demonstrates how to specify linear gauge live data.

For detailed implementation, please take a look at the HTML code tab.
 
<!DOCTYPE html>
<html>
<head>
	<title>
	Live Data Example - HTML5 jQuery Linear Gauge JavaScript Plugin
</title>
	<link rel="stylesheet" type="text/css" href="../../css/dataviz.gauges.css" />
	<script src="../../js/dataviz.gauges.min.js" type="text/javascript"></script>
	
	<script lang="javascript" type="text/javascript">
		var gradient1 = {
			type: 'linearGradient',
			x0: 0,
			y0: 0.5,
			x1: 1,
			y1: 0.5,
			colorStops: [{ offset: 0, color: '#C5F80B' },
						 { offset: 1, color: '#6B8901'}]
		};

		var gradient2 = {
			type: 'linearGradient',
			x0: 0,
			y0: 0.5,
			x1: 1,
			y1: 0.5,
			colorStops: [{ offset: 0, color: '#FF3366' },
						 { offset: 1, color: '#B2183E'}]
		};

		var gradient3 = {
			type: 'linearGradient',
			x0: 0,
			y0: 0.5,
			x1: 1,
			y1: 0.5,
			colorStops: [{ offset: 0, color: '#339CFF' },
						 { offset: 1, color: '#1F66A8'}]
		};

		var state = {
			orientation: 'vertical',
			background: '#F7F7F7',
			border: {
				lineWidth: 4,
				strokeStyle: '#76786A',
				padding: 8
			},
			scales: [
				{
					minimum: 0,
					maximum: 100,
					interval: 10,
					labels: {
						offset: 0.03
					},
					majorTickMarks: {
						offset: 0.20,
						lineWidth: 2
					},
					minorTickMarks: {
						visible: true,
						offset: 0.24,
						interval: 2,
						lineWidth: 2
					},
					barMarkers: [
						{
							value: 90,
							fillStyle: gradient1,
							innerOffset: 0.40,
							outerOffset: 0.56
						},
						{
							value: 70,
							fillStyle: gradient2,
							innerOffset: 0.60,
							outerOffset: 0.76
						},
						{
							value: 90,
							fillStyle: gradient3,
							innerOffset: 0.80,
							outerOffset: 0.96
						}
					]
				}
			]
		};

		var linearGauge = new DataViz.LinearGauge(state);

		updateGauge();

		function updateGauge() {

			state.scales[0].barMarkers[0].value = Math.round(20 + Math.random() * 80);
			state.scales[0].barMarkers[1].value = Math.round(20 + Math.random() * 80);
			state.scales[0].barMarkers[2].value = Math.round(20 + Math.random() * 80);

			linearGauge.setState(state);

			setTimeout('updateGauge()', 400);
		}

		linearGauge.write('container');
	</script>

</head>
<body>
	<div>
		<div id="container" style="width: 110px; height: 400px;">
		</div>
	</div>
</body>
</html>