Pen Settings



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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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.


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.


    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <link rel="stylesheet" type="text/css" href="">
    <script src=""></script>
    <script src=""></script>  
    <div ng-app="nvd3_timeseries">
      <div ng-controller="demo">
        <nvd3 options="options" data="data"></nvd3>
      <div><a href="" class="twitter-mention-button" data-show-count="false">Tweet to @cagomez805</a><script async src="//" charset="utf-8"></script></div>




                // 1) Declare app
var nvd3_timeseries = angular.module('nvd3_timeseries', ['nvd3']);

// 2) Declare controller
nvd3_timeseries.controller('demo', ['$scope', function($scope) {
  // 3) Chart configuration
  $scope.options = {
    chart: {
      type: 'lineChart',
      height: 450,
      margin: {
        top: 20,
        right: 20,
        bottom: 40,
        left: 55
      x: function(d) {
        /* Moment.js will attempt to parse the x coordinate 
                and return a value in milliseconds
        return moment.utc(d.x).valueOf();
      y: function(d) {
        return d.y;
      useInteractiveGuideline: true,
      xAxis: {
        axisLabel: 'Date',
        tickFormat: (function(d) {
          // 3.1) Format the x ticks
          return d3.time.format('%-m/%-d/%-Y')(new Date(d));
      yAxis: {
        axisLabel: 'Cats',
        axisLabelDistance: -10
      callback: function(chart) {}
    title: {
      enable: true,
      text: 'Time Series graph'
  $scope.dateRange = function dateRange(startDate, endDate) {
    var dates = [];
    var currDate = startDate.clone().startOf('day');
    var lastDate = endDate.clone().startOf('day');
    while (currDate.add(1, 'days').diff(lastDate) <= 0) {
    return dates;
  // 4) Chart data
  $ = generateTimeSeries();
  function generateTimeSeries() {
    // Generate an array of dates for plotting
    var dateRange = $scope.dateRange(moment().subtract(7, 'days'), moment());
    // Plottable will be an array of (x, y) objects
    var plottable = dateRange;
    plottable.forEach(function to_utc(date, index) {
      console.log('a[' + index + '] = ' + date);
      // set x value to date and y to a random value
      var rand = Math.round((Math.random() * (100 - 1) + 1));
      var point = {
        x: date,
        y: rand
      // Replace original element
      plottable[index] = point;
    // Return the plottable array for plotting
    return [{
      values: plottable,
      key: 'Cats',
      color: '#1b75ba'