Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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

Save Automatically?

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

              
                header
main
  section#dashboard
    #map
    #availability
      #overall
      #net
      #cloud
      #site
      #mobile
    #utilization
      #ucloud
      #usite
      #umobile
      #dataC
footer
              
            
!

CSS

              
                body
  background-color: #E1F5FE
  
header
  background-color: #03A9F4
  width: 100%
  height: 100px
  
footer
  width: 100%
  height: 50px
  background-color: #03A9F4
  
#map
  margin: 20px auto
  width: 90%
  height: 300px
  border: 2px solid black
  
#availability, #utilization
  display: inline-flex
  flex-wrap: wrap
  margin: 25px 16px
.c3
  text
    font-size: 11px
              
            
!

JS

              
                function gauge(target, data, label) {
  return c3.generate({
    bindto: target,
    data: {
      columns: [
        data
      ],
      type: 'gauge',
      onclick: function(d, i) {
        console.log("onclick", d, i);
      }
    },
    gauge: {
      label: {
        format: function(value, ratio) {
          return value+'%';
        },
        show: true // to turn off the min/max labels.
      },
      min: 0, // 0 is default, //can handle negative min e.g. vacuum / voltage / current flow / rate of change
      max: 100, // 100 is default
      units: label,
      width: 25 // for adjusting arc thickness
    },
    color: {
      pattern: ['#FF0000', '#F97600', '#F6C600', '#60B044'],
      threshold: {
        values: [25, 50, 75, 100]
      }
    },
    size: {
      height: 100,
      width: 150
    }
  });
};

function pie(target, data, label) {
  return c3.generate({
    bindto: target,
    onrendered: function() {
        d3.selectAll('.c3-text').each(function(v) {
            console.log(v);
        });
    },
    data: {
        columns: data,
        type : 'pie',
        onclick: function (d, i) { console.log("onclick", d, i); },
        names: {
          data1: 'Data Name 1',
          data2: 'Data Name 2',
        }
    },
    pie: {
      label: {
        format: function (value, ratio, id) {
          return value + 'mb';
        }
      },
      units: label,
    },
    color: {
      pattern: ['#03A9F4', '#D9D9D9'],
    },
    size: {
      width: 150
    }
});
}

function hbar(target, data, label) {
  return c3.generate({
    bindto: target,
    data: {
        columns: data,
        type: 'bar'
    },
    bar: {
      width: 10
    },
    axis: {
        rotated: true
    },
    color: {
      pattern: ['#03A9F4', '#4CAF50', '#FFC107'],
    },
    size: {
      width: 300,
      //height: 200
    }
});
}

var net = gauge('#net', ['Uptime %', 0], 'Networks (1)');
var cloud = gauge('#cloud', ['Uptime %', 0], 'Clouds (2)');
var site = gauge('#site', ['Uptime %', 0], 'Sites (4)');
var mobile = gauge('#mobile', ['Uptime %', 0], 'Mobile (0)');
var avg = gauge('#overall', ['Uptime %', 0], 'Overall');

var ucloud = pie('#ucloud', [['Data In', 0], ['Data Out', 0]], 'Clouds (2)');
var usite = pie('#usite', [['Data In', 0], ['Data Out', 0]], 'Sites (4)');
var umobile = pie('#umobile', [['Data In', 0], ['Data Out', 0]], 'Mobile (0)');

var dcomp = hbar('#dataC', [['Data Out', 0], ['Included', 0], ['Overage', 0]], 'Data Out Comparison');


setTimeout(function () {
    avg.load({
        columns: [['Uptime %', 99.99]]
    });
    net.load({
        columns: [['Uptime %', 70]]
    });
    cloud.load({
        columns: [['Uptime %', 25]]
    });
    site.load({
        columns: [['Uptime %', 10]]
    });
    mobile.load({
        columns: [['Uptime %', 0]]
    });
  
    ucloud.load({
        columns: [['Data In', 204.8], ['Data Out', 166.4]]
    });
    usite.load({
        columns: [['Data In', 211.3], ['Data Out', 153.6]]
    });
    umobile.load({
        columns: [['Data In', 0], ['Data Out', 0]]
    });
    dcomp.load({
        columns: [['Data Out', 166.4], ['Included', 200], ['Overage', 10]]
    });
}, 500);

// map stuff

mapboxgl.accessToken = 'pk.eyJ1IjoicmFmYXNlMjgyIiwiYSI6ImNpdXBwNDljczAxd2wydm13b3Y4bW5zMW4ifQ.nvLmAq0zERu0jGco49BzZQ';
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/rafase282/ciuppnnqx009z2jodjoh2bgay',
    zoom: 1,
    center: [0, 0]
});
              
            
!
999px

Console