Hi dharmander sir,
i want to display the x and y axis name on my google line chart.
like i am displying time in x axis and average in y axis. so i want that time and average should be writen show on x and y axis.
javascript:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(drawChart);
function drawChart() {
MakeAjaxCall("192.168.15.167", $("#chart1")[0])
}
function MakeAjaxCall(ipAddress, dvElement) {
$.ajax({
type: "POST",
url: "Default.aspx/GetChartData",
data: '{ipAddress:"' + ipAddress + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (r) {
var data = new google.visualization.DataTable();
data.addColumn('date', 'pingtime');
data.addColumn('number', 'average');
for (var i = 0; i < r.d.length; i++) {
data.addRow([new Date(parseInt(r.d[i][0].substr(6))), parseInt(r.d[i][1])]);
}
var maxValue = Math.max.apply(Math, r.d.map(function (x) { return x[1]; }));
var tick = [];
for (var i = 0; i <= (maxValue / 25) + 1; i++) {
tick.push(i * 25);
}
var chart = new google.visualization.LineChart(dvElement);
var options = {
title: 'ipaddress : ' + ipAddress,
width: 700,
height: 400,
bar: { groupWidth: "95%" },
legend: { position: "none" },
isStacked: true,
vAxis: {
viewWindow: {
min: 0,
max: maxValue
},
ticks: tick
},
};
google.visualization.events.addListener(chart, 'select', function () {
window.location.href = 'Detail.aspx';
});
chart.draw(data, options);
},
failure: function (r) {
alert(r.responsetext);
},
error: function (r) {
alert(r.responsetext);
}
});
}
</script>
<div class="chart" id="chart1" style="width: 900px; height: 400px;"></div>
please help me.