Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <html lang="en">
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Chart in Modal</title>
        <link rel="stylesheet" href="">
        <!--[if lt IE 9]>
        <script src=""></script>
        <script src=""></script>
        <div class="container-fluid">
            <div class="row">
                <div class="col-xs-10 col-xs-offset-1 col-md-8 col-md-offset-2">
                    <div class="table-responsive">
                        <table id="business_ratio" class="table table-condensed table-bordered table-striped table-hover table-charts">
                                    <th>Business ratio</th>
                                    <th class="text-center">Jan.</th>
                                    <th class="text-center">Feb.</th>
                                    <th class="text-center">Mar.</th>
                                    <th class="text-center">Apr.</th>
                                    <th class="text-center">May</th>
                                    <th class="text-center">June</th>
                                    <th class="text-center">July</th>
                                    <th class="text-center">Aug.</th>
                                    <th class="text-center">Sept.</th>
                                    <th class="text-center">Oct.</th>
                                    <th class="text-center">Nov.</th>
                                    <th class="text-center">Dec.</th>
                                        <a href="#" data-toggle="modal" data-target="#modChart" data-source="65.1,59.47,80.00,81.11,56.67,55.45,40.88,20.45,40.98,80.66,88.34,61.01" data-target-source="50">
                                            <span class="glyphicon glyphicon-signal"></span> Example
                                    <td class="text-right">65.10</td>
                                    <td class="text-right">59.47</td>
                                    <td class="text-right">80.00</td>
                                    <td class="text-right">81.11</td>
                                    <td class="text-right">56.67</td>
                                    <td class="text-right">55.45</td>
                                    <td class="text-right">40.88</td>
                                    <td class="text-right">20.45</td>
                                    <td class="text-right">40.98</td>
                                    <td class="text-right">80.66</td>
                                    <td class="text-right">88.34</td>
                                    <td class="text-right">61.01</td>
                                        <a href="#" data-toggle="modal" data-target="#modChart" data-source="70,13,20,90,44,12,30,30,30,10,5,0" data-target-source="34">
                                            <span class="glyphicon glyphicon-signal"></span> Foobar
                                    <td class="text-right">70</td>
                                    <td class="text-right">13</td>
                                    <td class="text-right">20</td>
                                    <td class="text-right">90</td>
                                    <td class="text-right">44</td>
                                    <td class="text-right">12</td>
                                    <td class="text-right">30</td>
                                    <td class="text-right">30</td>
                                    <td class="text-right">30</td>
                                    <td class="text-right">10</td>
                                    <td class="text-right">5</td>
                                    <td class="text-right">0</td>
        <div class="modal fade" id="modChart" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">
                            <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
                        <h4 class="modal-title" id="exampleModalLabel">Linechart</h4>
                    <div class="modal-body">
                        <canvas id="canvas" width="568" height="300"></canvas>
        <script src=""></script>
        <script src=""></script>
        <script src=""></script>




    var link = $(event.relatedTarget);
    // get data source
    var source = link.attr('data-source').split(',');
    // get title
    var title = link.html();
    // get labels
    var table = link.parents('table');
    var labels = [];
        // without first column
    // get target source
    var target = [];
    $.each(labels, function(index,value){
    // Chart initialisieren
    var modal = $(this);
    var canvas = modal.find('.modal-body canvas');
    var ctx = canvas[0].getContext("2d");
    var chart = new Chart(ctx).Line({        
        responsive: true,
        labels: labels,
        datasets: [{
            fillColor: "rgba(151,187,205,0.2)",
            strokeColor: "rgba(151,187,205,1)",
            pointColor: "rgba(151,187,205,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(151,187,205,1)",
            data: source
            fillColor: "rgba(220,220,220,0.2)",
            strokeColor: "#F7464A",
            pointColor: "#FF5A5E",
            pointStrokeColor: "#FF5A5E",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "red",
            data: target
    // reset canvas size
    var modal = $(this);
    var canvas = modal.find('.modal-body canvas');
    // destroy modal
    $(this).data('bs.modal', null);