Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to insert xmlns and xlink attributes into svg element/tag generated by c3 charts?

I am planning to export c3 charts using https://github.com/Xportability/css-to-pdf. But CSS2PDF requires the SVG tags to contain attributes xmlns="http://www.w3.org/2000/svg" and xmlns:xlink="http://www.w3.org/1999/xlink" to be a valid for export.

How to add these two attributes to svg element generated by c3 chart ?

like image 541
yogi Avatar asked Sep 13 '25 22:09

yogi


1 Answers

$(document).ready(function () {
        var svg = $('#chart').find('svg')[0];
    svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
    svg.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');

     });    
like image 106
yogi Avatar answered Sep 17 '25 20:09

yogi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!