Python to generate nice looking SVG graph http://pygal.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

function resend() {
var $fig = $('figure'),
// $embed = $fig.find('embed'),
type = $('#type').val(),
data = $('#data').val(),
style = $('#style').val(),
opts = {};
$('.c-opts').each(function() {
var $this = $(this),
val = $this.val();
12 years ago
if($this.attr('type') == 'checkbox') {
opts[$this.attr('id').replace('c-', '')] = $this.is(":checked");
} else if(val) {
opts[$this.attr('id').replace('c-', '')] = val;
}
});
$.ajax({
url: '/svg',
type: 'POST',
data: {
type: type,
style: style,
vals: '{' + data + '}',
opts: JSON.stringify(opts)
},
dataType: 'html'
}).done(function (data) {
12 years ago
// $fig.find('div').get(0).innerHTML = data;
$fig.find('div').html(data);
init_svg($fig.find('svg').get(0));
$('.nav a').css({color: ''});
}).fail(function () {
$('.nav a').css({color: 'red'});
});
}
$(function () {
$('#type').on('change', resend);
$('#data').on('input', resend);
$('#style').on('change', resend);
12 years ago
$('.c-opts:not([type=checkbox])').on('input', resend);
$('.c-opts[type=checkbox]').on('change', resend);
$('div.tt').tooltip();
resend();
});