Rank: Newbie
Groups: Registered
Joined: 1/31/2013(UTC) Posts: 4
Thanks: 0 times Was thanked: 0 time(s) in 0 post(s)
|
Hi Ivan Here is the source code. Thanks in advamce Code: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Project.Models.Employee>" %> <%@ Import Namespace="Project.Models" %> <div id="rChart" style="width: 430px; height: 300px;"> </div> <script lang="javascript" type="text/javascript"> function initChart(fullnames, orbitsSelf) {
var background = { type: 'linearGradient', x0: 0, y0: 0, x1: 0, y1: 1, colorStops: [{ offset: 0, color: '#d2e6c9' }, { offset: 1, color: 'white'}] };
$('#rChart').jqChart({ title: { text: 'Team Latest Orbits' }, border: { strokeStyle: '#6ba851' }, background: background, axes: [ { type: 'categoryAngle', majorGridLines: { lineWidth: 20, strokeStyle: 'red', interval: 1 }, minorGridLines: { lineWidth: 20, strokeStyle: 'green', interval: 0.5 }, minimum: 0, maximum: 2.1, interval: 0.1, categories: fullnames } ], series: [ { title: 'Self', type: 'radarLine', data: orbitsSelf } ] }); }
function getSelfOrbits() { $.ajax( { type: "POST", url: '<%= Url.Action("LatestTeamOrbitsForManager") %>', data: { id: <%= Model.Id %>, type: 'self' }, dataType: 'json', success: function (msg) { var data = msg; var employeeIds = []; var orbitsSelfValues = []; var orbitsManager = []; for (var i = 0; i< data.length ; i++) { employeeIds[i] = (data[i].id); orbitsSelfValues[i] = (data[i].value); } initChart(employeeIds, orbitsSelfValues); getManagerOrbits(); } }); }
function getManagerOrbits() { $.ajax( { type: "POST", url: '<%= Url.Action("LatestTeamOrbitsForManager") %>', data: { id: <%= Model.Id %>, type: 'manager' }, dataType: 'json', success: function (data) { var orbitsManager = []; for (var i = 0; i< data.length ; i++) { orbitsManager[i] = (data[i].value); } updateChart('manager', orbitsManager); getCulturalOrbits(); } }); }
function getCulturalOrbits() { $.ajax( { type: "POST", url: '<%= Url.Action("LatestTeamOrbitsForManager") %>', data: { id: <%= Model.Id %>, type: 'cultural' }, dataType: 'json', success: function (data) { var orbitsCultural = []; for (var i = 0; i< data.length ; i++) { orbitsCultural[i] = (data[i].value); } updateChart('cultural', orbitsCultural); } }); }
function updateChart(type, data) { // Get data from self orbits var series = $('#rChart').jqChart('option', 'series'); var author; if (type == 'manager') { author = 'Manager'; } else { author = 'Cultural Leader'; }
var newSeries = { title: author, type: 'radarLine', data: data }; series.push(newSeries); $('#rChart').jqChart('update');
}
$(document).ready( function () { getSelfOrbits(); } );
</script>
|