Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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

              
                

	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css"/>
  <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"/>
 
	<link rel="stylesheet" type="text/css" href="http://caucasusoffline.com/t/style.css"/>

 
<!-- css -->


<!-- js  -->
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script> 
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>

<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>




<body>

    <div class="row">
        <div class="col-12">
            <div class="card-box table-responsive">
                <h4 class="m-t-0 header-title"></h4>
                <p class="text-muted font-14 m-b-30">

                </p>



                <table id="selection-datatable"    class="table table-bordered" cellspacing="0" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Company</th>
                            <th>Jan</th>
                            <th>Feb</th>
                            <th>Mar</th>
                            <th>Apr</th>
                            <th>May</th>
                            <th>Jun</th>
                            <th>Jul</th>
                            <th>Aug</th>
                            <th>Sep</th>
                            <th>Oct</th>
                            <th>Nov</th>
                            <th>Dec</th>





                        </tr>
                    </thead>











                </table>

            </div>
        </div>
    </div>
    </div>
    </div>


    <footer class="footer">
        <div class="container">
            <div class="row">
                <div class="col-12 text-center">
                    = © Monty
                </div>
            </div>
        </div>
    </footer>

</body>

              
            
!

CSS

              
                table.DTFC_Cloned tr {
    background-color: #008cba;
    margin-bottom: 0;
    border-top: none;
}

div.DTFC_LeftHeadWrapper table,
div.DTFC_RightHeadWrapper table {
    border-bottom: none !important;
    margin-bottom: 0 !important;
}

div.DTFC_LeftBodyWrapper table,
div.DTFC_RightBodyWrapper table {
    border-top: none;
    margin: 0 !important;
}

div.DTFC_LeftFootWrapper table,
div.DTFC_RightFootWrapper table {
    border-top: none;
    margin-top: 0 !important;
}

table.dataTable thead tr {
    background-color: #008cba;
}

table tbody tr:nth-child(4) {
    background-color: #5fbeaa;
}

table tbody tr:nth-child(2) {
    background-color: #5fbeaa;
}

table tbody tr:nth-child(6) {
    background-color: #5fbeaa;
}

table tbody tr:nth-child(8) {
    background-color: #5fbeaa;
}

table tbody tr:nth-child(10) {
    background-color: #5fbeaa;
}

table tbody tr:nth-child(12) {
    background-color: #5fbeaa;
}

table tbody td:nth-child(2) {
    background-color: #5fbeaa;
}

table tbody th:nth-child(2) {
    background-color: #5fbeaa;
}

div.slider {
    display: none;
}

td.details-control {
    background: url('https://datatables.net/examples/resources/details_open.png') no-repeat center center;
    cursor: pointer;
}

tr.shown td.details-control {
    background: url('https://datatables.net/examples/resources/details_close.png') no-repeat center center;
}

tr.shown {
    background-color: #f7897b !important;
}

              
            
!

JS

              
                $(document).ready(function() {
    var results = [];
    var categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
    var url = "https://spreadsheets.google.com/feeds/list/1f8Ji80Qv3PX3mcUbHs5MeVHmTdC1lxBoPu72XInckaA/od6/public/values?alt=json";

    var jqxhr = $.getJSON(url, function() {
            console.log("success");
        })
        .done(function(data) {
            console.log("second success");
            var entry = data.feed.entry;
            var rowCount = 0; //row counter
            var rowData = []; //data array for each row
            console.log(data)
            $(entry).each(function() {

                if (rowCount % 2 === 0) {
                    // if rowCount mod 2 is 0 then start new row data
                    rowData = [
                        this.gsx$_cn6ca.$t,
                        this.gsx$company.$t,
                        this.gsx$jan.$t,
                        this.gsx$feb.$t,
                        this.gsx$mar.$t,
                        this.gsx$apr.$t,
                        this.gsx$may.$t,
                        this.gsx$jun.$t,
                        this.gsx$jul.$t,
                        this.gsx$aug.$t,
                        this.gsx$sep.$t,
                        this.gsx$oct.$t,
                        this.gsx$nov.$t,
                        this.gsx$dec.$t,



                    ];
                } else {
                    // Otherwise append second row to the first

                    rowData = rowData.concat([
                        this.gsx$_cn6ca.$t,
                        this.gsx$company.$t,
                        this.gsx$jan.$t,
                        this.gsx$feb.$t,
                        this.gsx$mar.$t,
                        this.gsx$apr.$t,
                        this.gsx$may.$t,
                        this.gsx$jun.$t,
                        this.gsx$jul.$t,
                        this.gsx$aug.$t,
                        this.gsx$sep.$t,
                        this.gsx$oct.$t,
                        this.gsx$nov.$t,
                        this.gsx$dec.$t

                    ])

                    // and push onto the row data
                    results.push(rowData);
                }
                rowCount++;
            });
            var table = $('#selection-datatable').DataTable({
                data: results,
                deferRender: true,
                "processing": true,
                paging: false,
              


                columnDefs: [{
                    className: "details-control",
                    "targets": [0]
                }]
            });



            function format(title) {
                return '<div class="slider" name>' +
                    '<table class=table  table hover     border="0"     class="details-table">' +
                    '<thead> ' +
                    '<td>' + [title[14]].join(', ') + '</td>' +
                    '<td>' + [title[15]].join(', ') + '</td>' +
                    '<td>' + [title[16]].join(', ') + '</td>' +
                    '<td>' + [title[17]].join(', ') + '</td>' +
                    '<td>' + [title[18]].join(', ') + '</td>' +
                    '<td>' + [title[19]].join(', ') + '</td>' +
                    '<td>' + [title[20]].join(', ') + '</td>' +
                    '<td>' + [title[21]].join(', ') + '</td>' +
                    '<td>' + [title[22]].join(', ') + '</td>' +
                    '<td>' + [title[23]].join(', ') + '</td>' +
                    '<td>' + [title[24]].join(', ') + '</td>' +
                    '<td>' + [title[25]].join(', ') + '</td>' +
                    '<td>' + [title[26]].join(', ') + '</td>' +
                    '<td>' + [title[27]].join(', ') + '</td>' +

                    '</thead> ' +

                    '<div id="chart' + title[14] + '"></div>' +
                    '</div>'
            }



            $('#selection-datatable tbody').on('click', 'td.details-control', function() {
                var tr = $(this).closest('tr');
                var row = table.row(tr);

                if (row.child.isShown()) {
                    // This row is already open - close it
                    $('div.slider', row.child()).slideUp(function() {
                        row.child.hide();
                        tr.removeClass('shown');
                    });
                } else {
                    // Open this row
                    row.child(format(row.data()), 'no-padding').show();
                    tr.addClass('shown');
                    createChart('chart' + row.data()[14], row.data().slice(16));
                    $('div.slider', row.child()).slideDown();
                }
            });


        });

    
function createChart(container, data) {
 
    Highcharts.chart(container, {
      
      

     

       
            series: [{
           
      data: (function() {
                    data.forEach(function(el, i) {
                        data[i] = Number(el);
                          
                    });
                   
 
                    return data;
                   
                })()
          
            }],
      
    
           chart: {
        zoomType: 'xy',
        type: 'area',
         backgroundColor: '#253138', 
       },
      
    plotOptions: {
        series: { neWidth: 2, fillColor: "#0099cc", lineColor: "#f7897b",
            marker: { enabled: true, symbol: 'circle',  radius: 4,
                states: {  hover: { enabled: true, illColor: '#000000' } } }
        }  },
    title: { style: {  color: '#E0E0E3',  fontSize: '20px' } },
   
  yAxis: {  labels: {  style: { color: 'white' } }},
    legend: { itemStyle: {  color: 'white'  },  },
     
             
        
            xAxis: {
                categories: categories,
 labels: { style: {  color: 'white' } }
            },
      
          
        })
    }
  
});
  
              
            
!
999px

Console