yannstatic/_includes/chart.html

15 lines
520 B
HTML
Raw Permalink Normal View History

2024-10-31 20:18:37 +01:00
<script>
window.Lazyload.js(['/assets/js/jquery.min.js', 'https://cdn.jsdelivr.net/npm/chart.js'], function() {
var $canvas = null, $this = null, _ctx = null, _text = '';
$('.language-chart').each(function(){
$this = $(this);
$canvas = $('<canvas></canvas>');
_text = $this.text();
$this.text('').append($canvas);
_ctx = $canvas.get(0).getContext('2d');
(_ctx && _text) && (new Chart(_ctx, JSON.parse(_text)) && $this.attr('data-processed', true));
});
});
</script>