Update chart UI, update Jquery

This commit is contained in:
2016-12-16 22:46:21 -05:00
parent 8dc1e0422c
commit 75d01a197d
17 changed files with 2773 additions and 2019 deletions
+19 -14
View File
@@ -16,32 +16,37 @@
};
var baseUrl = "/umbraco/surface/Chart/ChartCurve";
var $chart = $("#chart");
var $chartError = $('#chart-error');
$('#CurveId')
.change(function () {
$('#chart-error').removeClass('text-danger').text('');
var $chart = $("#chart");
$chart.removeAttr('src');
$chartError.removeClass('text-danger').text('');
// this is the "Select CurveId" instruction
if (this.selectedIndex === 0) {
$chart.removeAttr('src');
return;
}
var curveId = $("option:selected", this).text();
var $spinner = $chart.after('<span class="glyphicon glyphicon-refresh gly-spin" style="font-size: 3em"></span>').next('span');
$chart.after('<span class="glyphicon glyphicon-refresh gly-spin" style="font-size: 3em"></span>');
var leafInputId = getUrlParameter("leafInputId");
var url = baseUrl + "?leafInputId=" + leafInputId + "&curveId=" + curveId;
$chart.load(function () {
$spinner.remove();
})
.error(function () {
//$chart.removeAttr('src');
$spinner.remove();
$('#chart-error').addClass('text-danger').text('A problem was encountered loading this chart.');
return;
})
.attr('src', url);
$chart.attr('src', url);
});
$chart.load(function () {
$chart.next('span.gly-spin').remove(); // remove spinner
})
.error(function () {
$chart.next('span.gly-spin').remove(); // remove spinner
if ($chart.attr('src') != undefined) {
$chart.removeAttr('src');
$chartError.addClass('text-danger').text('A problem was encountered loading this chart.');
}
});
});