Chart Data

Performance !!!

Bar and Column Charts

Line and Area Charts

Pie and Funnel Charts

Scatter and Bubble Charts

Radar and Polar Charts

Financial Charts

Gantt Charts

Combinational Charts

Dynamic Charts

Working with Chart Axes

Chart Features

Customizing Chart

Client-Side Events


This sample demonstrates how to bind jqChart to Json Data Source.

For detailed implementation, please take a look at the HTML code tab.
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>
	Binding to Data Source Example - HTML5 Chart for OpenUI5 by jqChart
</title>
	<link rel="stylesheet" type="text/css" href="../../css/jquery.jqChart.css" />
	<link rel="stylesheet" type="text/css" href="../../css/jquery.jqRangeSlider.css" />
	<link rel="stylesheet" type="text/css" href="../../themes/smoothness/jquery-ui-1.10.4.css" />
	<script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
			type="text/javascript"
			data-sap-ui-theme="sap_bluecrystal"
			data-sap-ui-libs="sap.m"></script>
	<script src="../../js/jquery.mousewheel.js" type="text/javascript"></script>
	<script src="../../js/jquery.jqRangeSlider.min.js" type="text/javascript"></script>
	<script src="../../js/jquery.jqChart.min.js" type="text/javascript"></script>
	<script src="../../js/jquery.jqChart.OpenUI5.min.js" type="text/javascript"></script>
	<!--[if IE]><script lang="javascript" type="text/javascript" src="../../js/excanvas.js"></script><![endif]-->
	
	<script lang="javascript" type="text/javascript">
		function addDays(date, value) {
			var newDate = new Date(date.getTime());
			newDate.setDate(date.getDate() + value);
			return newDate;
		}

		function round(d) {
			return Math.round(100 * d) / 100;
		}

		var xValues = [];
		var yValues1 = [];
		var yValues2 = [];

		var yValue1 = 50;
		var yValue2 = 200;

		var date = new Date(2010, 0, 1);

		for (var i = 0; i < 200; i++) {

			xValues.push(date);

			yValue1 += Math.random() * 10 - 5;
			yValues1.push(round(yValue1));

			yValue2 += Math.random() * 10 - 5;
			yValues2.push(round(yValue2));

			date = addDays(date, 1);
		}

		var data = {
			xValues: xValues,
			yValues1: yValues1,
			yValues2: yValues2
		};

		var model = new sap.ui.model.json.JSONModel(data);
		sap.ui.getCore().setModel(model);

		var background = {
			type: 'linearGradient',
			x0: 0,
			y0: 0,
			x1: 0,
			y1: 1,
			colorStops: [
				{
					offset: 0,
					color: '#d2e6c9'
				},
				{
					offset: 1,
					color: 'white'
				}
			]
		};

		var chart = new jqchart.ui.Chart({
			width: "500px",
			height: "300px",
			title: new jqchart.ui.Title({
				text: 'Binding to a Model'
			}),
			legend: new jqchart.ui.Legend({
				title: new jqchart.ui.Title({
					text: 'Legend'
				})
			}),
			background: background,
			border: new jqchart.ui.Border({
				strokeStyle: '#6ba851'
			}),
			animation: new jqchart.ui.Animation({
				duration: 1
			}),
			shadows: new jqchart.ui.Shadows({
				enabled: true
			}),
			tooltips: new jqchart.ui.Tooltips({
				type: 'shared'
			}),
			crosshairs: new jqchart.ui.Crosshairs({
				enabled: true,
				hLine: new jqchart.ui.Line({
					visible: false
				}),
				vLine: new jqchart.ui.Line({
					strokeStyle: '#cc0a0c'
				})
			}),
			axes: [
				new jqchart.ui.DateTimeAxis({
					location: 'bottom',
					zoomEnabled: true
				})
			],
			series: [
                new jqchart.ui.LineSeries({
					title: 'Series 1',
                	xValues: "{/xValues}",
                	yValues: "{/yValues1}",
                	markers: new jqchart.ui.Markers({
                		visible: false
                	})
                }),
                new jqchart.ui.LineSeries({
                	title: 'Series 2',
                	xValues: "{/xValues}",
                	yValues: "{/yValues2}",
                	markers: new jqchart.ui.Markers({
                		visible: false
                	})
                })
			]
		});
		chart.placeAt("jqChart");
	</script>

</head>
<body>
	
	<div>
		<div id="jqChart" style="width: 500px; height: 300px;">
		</div>
	</div>

</body>
</html>