<script type="text/javascript" src="https://www.google.com/jsapi"
charset="utf-8"></script>
<script>
function _ShowLoading() {
var loading = $('<div id="loadingicon"><div></div></div>');
$("body").append($(loading));
};
function _HideLoading() {
if ($("#loadingicon").length > 0)
$("#loadingicon").remove();
};
google.load("visualization", "1", { packages: ["corechart"] });
_ShowLoading();
google.setOnLoadCallback(drawAmountLineChart);
google.setOnLoadCallback(drawChannelAmountChart);
setTimeout(_HideLoading, 1000);
function drawAmountLineChart() {
var sTitle = '@ViewBag.LineChartTitle';
$.ajax({
type: "GET",
url: "GetJsonLineData_All",
dataType: "json",
cache: false,
contentType: "application/json",
success: function (response) {
if (response.length > 0) {
var data = new google.visualization.DataTable();
data.addColumn('string', 'title');
data.addColumn('number', 'Transactions');
data.addColumn('number', 'Completed');
data.addRows(response.length);
for (var i = 0; i < response.length; i++) {
data.setValue(i, 0, response[i].DayString);
data.setValue(i, 1, response[i].Line1);
data.setValue(i, 2, response[i].Line2);
}
var options = {
width: 940, height: 350,
legend: 'top',
hAxis: { title: sTitle, minValue: 0 },
vAxis: { minValue: 40 },
chartArea: { left: 95, top: 50, width: '85%' },
Title: 'none',
curveType: 'function',
type: 'area',
colors: ['#71C2F5', 'green'], pointSize: 0
};
var amountChart = new
google.visualization.LineChart(document.getElementById('completeAmountChart'));
amountChart.draw(data, options);
}
else {
$("#completeAmountChart").html("<label
style='margin-left:5px;'>There has no data to display.</label>");
}
}
});
};
function drawChannelAmountChart() {
$.ajax({
type: "GET",
url: "GetJsonTop5Channels",
dataType: "json",
cache: false,
contentType: "application/json",
success: function (response) {
if (response.length > 0) {
var color = [];
var data = new google.visualization.DataTable();
data.addColumn('string', 'Channel');
data.addColumn('number', 'Value');
data.addRows(response.length);
for (var i = 0; i < response.length; i++) {
data.setValue(i, 0, response[i].Channel);
data.setValue(i, 1, response[i].Total);
color.push(response[i].ChartColor);
}
var chart = new
google.visualization.PieChart(document.getElementById('channelAmountChart'));
chart.draw(data, { width: 470, height: 300, is3D:
false, title: '',colors:color, legend: 'none', chartArea: { left: 50, top:
40, width: "80%", height: "80%" } });
}
else {
$("#channelAmountChart").html("<label
style='margin-left:5px;'>There has no data to display.</label>");
}
}
});
};
</script>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.