(function () {
  //Inject code v3.0

  var highcharts = document.createElement('script');

  var cdn = 'https://code.highcharts.com/';
  var loaded = 0;  
  var encodedUrl = encodeURI('https://https://app.everviz.com//show/ojyapRq1V');
  var chartCreated = false;
  var scripts = [
    "highcharts.js",
    "modules/stock.js",
    "highcharts-more.js",
    "highcharts-3d.js",
    "modules/data.js",
    "modules/exporting.js",
    "modules/funnel.js",
    "modules/solid-gauge.js",
    "modules/export-data.js",
    "modules/accessibility.js"
    /* "modules/series-label.js" */
  ];

  var externalCSS = [
      ];

  var extraScripts = [
  "modules/annotations.js"
  ,"modules/annotations-advanced.js"
  ];

  var options = {"title":{"text":"Average Daily Household Spending in 2020","align":"left","x":10,"style":{"fontFamily":"Default","color":"#333333","fontSize":"20px","fontWeight":"bold","fontStyle":"normal"},"margin":20,"floating":false},"subtitle":{"text":"","align":"left","x":10},"colors":["#155F83"],"legend":{"align":"left","verticalAlign":"top","itemMarginBottom":10,"x":0,"symbolRadius":2,"enabled":false,"bubbleLegend":{"labels":{"allowOverlap":false},"ranges":[]}},"plotOptions":{"series":{"marker":{"enabled":false},"lineWidth":3,"allowPointSelect":true,"states":{"select":{"color":"#EFFFEF","borderColor":"black","dashStyle":"dot"}},"dataLabels":{"enabled":true,"format":"{point.label}"}}},"chart":{"polar":false,"plotBorderWidth":0,"backgroundColor":"#ffffff","plotBackgroundColor":"#ffffff","scrollablePlotArea":{"opacity":0.5},"displayErrors":true,"height":null,"reflow":true,"plotShadow":false,"shadow":false,"showAxes":false,"style":{"fontFamily":"\"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, Arial, Helvetica, sans-serif","fontSize":"12px"},"styledMode":false,"width":null,"panning":true,"alignTicks":true,"borderWidth":0,"borderRadius":10,"spacingLeft":10},"credits":{"text":"Becker Friedman Institute for Economics at UChicago","href":"https://bfi.uchicago.edu","enabled":true},"series":[{"data":[],"turboThreshold":0,"type":"area","marker":{"symbol":"circle","enabled":true},"colorByPoint":false,"color":"#155F83","label":{"style":{"font-weight":"bold","fontFamily":"\"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, Arial, Helvetica, sans-serif","fontSize":"12px"}},"clip":true,"name":"Mean Spending","showInLegend":false,"allowPointSelect":false,"lineWidth":3,"visible":true}],"xAxis":[{"type":"category","title":{"text":""},"alignTicks":true,"allowDecimals":true,"showFirstLabel":true,"showLastLabel":true,"showEmpty":true,"uniqueNames":true,"visible":false,"zoomEnabled":false,"labels":{"style":{"fontSize":"11"},"format":"{value}"}}],"yAxis":[{"title":{"text":"null","enabled":false,"textAlign":"","useHTML":false,"reserveSpace":true},"labels":{"format":"${value}","align":"","autoRotation":["[-45]"],"autoRotationLimit":80,"skew3d":false,"useHTML":false},"visible":true,"startOfWeek":17,"showFirstLabel":true,"showLastLabel":true,"alignTicks":true,"allowDecimals":true,"type":"linear","opposite":false,"reversed":false,"zoomEnabled":false,"uniqueNames":true}],"tooltip":{"shared":false,"valueSuffix":"","borderRadius":3,"enabled":true,"animation":true,"outside":false,"headerFormat":"<span style=\"font-size: 10px\">{point.key}</span><br/>","pointFormat":"<span style=\"color:{point.color}\">●</span> {series.name}: <b>${point.y}</b><br/>"},"stockTools":{"gui":{"enabled":false}},"navigation":{"bindingsClassName":"tools-container","events":{}},"labels":{"items":[],"style":{"color":"#212121","position":"absolute","fontFamily":"\"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, Arial, Helvetica, sans-serif","fontSize":"16px"}},"responsive":{"rules":[{"condition":{"maxWidth":{},"minWidth":0,"minHeight":0}}]},"caption":{"text":"This graph displays how household spending changed by week in 2020. Spending is measured in daily dollars. Months are split into four periods equal in size across months. Individual fixed effects are removed prior to collapsing across individuals. Source: Non-Profit Fintech.","margin":26},"annotations":[{"visible":true,"draggable":null,"labelOptions":{"align":"center","allowOverlap":false,"backgroundColor":"rgba(0, 0, 0, 0.75)","borderColor":"black","borderRadius":3,"borderWidth":1,"className":"","crop":false,"overflow":"justify","padding":5,"shadow":false,"shape":"callout","style":{"fontSize":"11px","fontWeight":"normal","color":"contrast"},"useHTML":false,"verticalAlign":"bottom","x":0,"y":-16,"format":"{y:.2f}"},"shapeOptions":{"stroke":"rgba(0, 0, 0, 0.75)","strokeWidth":1,"fill":"rgba(0, 0, 0, 0.75)","r":0,"snap":2},"controlPointOptions":{"symbol":"circle","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false},"events":{},"zIndex":6,"langKey":"label","labels":[{"point":{"x":0.9944598337950138,"y":55.78947368421053,"xAxis":0,"yAxis":0},"controlPoints":[{"symbol":"triangle-down","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false,"events":{},"index":0},{"symbol":"circle","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false,"events":{},"index":1}],"overflow":"none","crop":true,"format":"<strong>Jan 10</strong>","style":{"color":"#212121","fontSize":"15","fontWeight":"normal"},"backgroundColor":"#ffffff","borderColor":"#ffffff","shape":"connector","x":30,"y":4,"align":"center","allowOverlap":false,"borderRadius":3,"borderWidth":1,"className":"","padding":5,"shadow":false,"useHTML":false,"verticalAlign":"bottom","controlPointOptions":{"symbol":"circle","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false}}]},{"visible":true,"draggable":null,"labelOptions":{"align":"center","allowOverlap":false,"backgroundColor":"rgba(0, 0, 0, 0.75)","borderColor":"black","borderRadius":3,"borderWidth":1,"className":"","crop":false,"overflow":"justify","padding":5,"shadow":false,"shape":"callout","style":{"fontSize":"11px","fontWeight":"normal","color":"contrast"},"useHTML":false,"verticalAlign":"bottom","x":0,"y":-16,"format":"{y:.2f}"},"shapeOptions":{"stroke":"rgba(0, 0, 0, 0.75)","strokeWidth":1,"fill":"rgba(0, 0, 0, 0.75)","r":0,"snap":2},"controlPointOptions":{"symbol":"circle","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false},"events":{},"zIndex":6,"langKey":"label","labels":[{"point":{"x":4.991689750692521,"y":55.26315789473684,"xAxis":0,"yAxis":0},"controlPoints":[{"symbol":"triangle-down","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false,"events":{},"index":0},{"symbol":"circle","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false,"events":{},"index":1}],"overflow":"none","crop":true,"format":"<strong>Feb 10</strong>","style":{"color":"#212121","fontSize":"15","fontWeight":"normal"},"backgroundColor":"#eceff1","borderColor":"#eceff1","shape":"connector","x":29,"y":5,"align":"center","allowOverlap":false,"borderRadius":3,"borderWidth":1,"className":"","padding":5,"shadow":false,"useHTML":false,"verticalAlign":"bottom","controlPointOptions":{"symbol":"circle","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false}}]},{"visible":true,"draggable":null,"labelOptions":{"align":"center","allowOverlap":false,"backgroundColor":"rgba(0, 0, 0, 0.75)","borderColor":"black","borderRadius":3,"borderWidth":1,"className":"","crop":false,"overflow":"justify","padding":5,"shadow":false,"shape":"callout","style":{"fontSize":"11px","fontWeight":"normal","color":"contrast"},"useHTML":false,"verticalAlign":"bottom","x":0,"y":-16,"format":"{y:.2f}"},"shapeOptions":{"stroke":"rgba(0, 0, 0, 0.75)","strokeWidth":1,"fill":"rgba(0, 0, 0, 0.75)","r":0,"snap":2},"controlPointOptions":{"symbol":"circle","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false},"events":{},"zIndex":6,"langKey":"label","labels":[{"point":{"x":8.988919667590027,"y":73.6842105263158,"xAxis":0,"yAxis":0},"controlPoints":[{"symbol":"triangle-down","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false,"events":{},"index":0},{"symbol":"circle","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false,"events":{},"index":1}],"overflow":"none","crop":true,"x":35,"y":12,"format":"<strong>Mar 10</strong>","style":{"color":"#212121contra#212121st","fontSize":"15","fontWeight":"normal"},"backgroundColor":"#ffffff","borderColor":"#ffffff","shape":"connector","align":"center","allowOverlap":false,"borderRadius":3,"borderWidth":1,"className":"","padding":5,"shadow":false,"useHTML":false,"verticalAlign":"bottom","controlPointOptions":{"symbol":"circle","width":10,"height":10,"style":{"stroke":"black","stroke-width":2,"fill":"white"},"visible":false}}]}],"data":{"csv":"woy;Mean Spending;label\nWeek 1;88.4;\nJan 10 2020;54.5;\nWeek 3;50;\nWeek 4;50.6;\nWeek 5;64.9;\nFeb 10 2020;54.7;\nWeek 7;49.3;\nWeek 8;53.2;\nWeek 9;102.7;\nMar 10 2020;73.2;\nWeek 11;55.8;\nWeek 12;43.7;\nWeek 13;24.1;","seriesMapping":[{"x":0,"y":1,"label":2}]}};

  function isScriptAlreadyIncluded(src){
    var scripts = document.getElementsByTagName("script");
    for (var i = 0; i < scripts.length; i++) {
      if (scripts[i].hasAttribute('src')) {
        const scriptTag = scripts[i].getAttribute('src') || '';
        if ((scriptTag.indexOf(src) >= 0) || 
            (scriptTag.indexOf('highcharts.src.js') > -1 && src === 'highcharts.js') ||
            ((scriptTag.indexOf('stock/highstock.js') > -1) && src === 'modules/highstock.js')) {
          return true;
        }
      }
    }
    return false;
  }

  function loadCSS() {
    var cssLength = externalCSS.length;
    for(var i=0; i < cssLength; i++) {
      var css = document.createElement('link');
      css.rel  = 'stylesheet';
      css.type = "text/css";
      css.href = externalCSS[i];
      document.body.appendChild(css);
    }
  }

  function createChart() {
    if(chartCreated) return;

    if (typeof window['Highcharts'] !== 'undefined') {


    if (options.yAxis && options.yAxis.length === 1) options.yAxis = options.yAxis[0];
    if (options.xAxis && options.xAxis.length === 1) options.xAxis = options.xAxis[0];
    if (options.zAxis && options.zAxis.length === 1) options.zAxis = options.zAxis[0];

    /*
// Sample of extending options:
Highcharts.merge(true, options, {
    chart: {
        backgroundColor: "#bada55"
    },
    plotOptions: {
        series: {
            cursor: "pointer",
            events: {
                click: function(event) {
                    alert(this.name + " clicked\n" +
                          "Alt: " + event.altKey + "\n" +
                          "Control: " + event.ctrlKey + "\n" +
                          "Shift: " + event.shiftKey + "\n");
                }
            }
        }
    }
});
*/


      if (options && (options.lang || options.global)) {
        Highcharts.setOptions({
          global: options.global || {},
          lang: options.lang || {}
        });
      }

      if (Highcharts.Annotation) {
        Highcharts.Annotation.ControlPoint.prototype.redraw = function (animation) {
          this.graphic[animation ? 'animate' : 'attr'](
              this.options.positioner ? this.options.positioner.call(this, this.target) : null
          );
        };
      }
      
      chartCreated = true;
      window.HighchartsCloud.hasLoaded = true;
      new Highcharts.Chart('highcharts-ojyapRq1V', options);
    }
  }

  function check(scripts, cb) {
    if (loaded === scripts.length) {
      if (cb) {
        cb();
      } else {
        for (var i = 0; i < window.HighchartsCloud.ondone.length; i++) {
          try {
            window.HighchartsCloud.ondone[i]();
          } catch(e) {
            console.error(e);
          }
        }
      }
    }
  }

  function loadScript(s, scripts, cb) {
    if (!s) next();
    
    function next() {
      ++loaded;
      if (loaded < scripts.length) {
        loadScript(scripts[loaded], scripts, cb);
      }
      check(scripts, cb);
    }

    if (isScriptAlreadyIncluded(s)) {
      return next();
    }

    var n = document.createElement('script');

    n.onload = function () {
      next();
    };

    if (s.indexOf('https') >= 0) {
      n.src = s;
    } else {
      n.src = cdn + s;
    }
    document.body.appendChild(n);
  }

  function loadExtraScripts(){
    if (extraScripts.length > 0) {
      loaded = 0;
      loadScript(extraScripts[0], extraScripts);
    } else {
      check(scripts);
    }
  }

  function loadExtraScriptsAndMakeChart(){
    loaded = 0;
    if (extraScripts.length > 0) {
      loadScript(extraScripts[0], extraScripts, createChart);
    } else {
      check(extraScripts);
    }
  }

  if (typeof window['HighchartsCloud'] === 'undefined') {
    window.HighchartsCloud = {
      ondone: [createChart],
      hasWrapped: false,
      hasLoaded: false
    };

    loadScript(scripts[0], scripts, loadExtraScripts);
    loadCSS();

  } else {
    if (!window.HighchartsCloud.hasLoaded) window.HighchartsCloud.ondone.push(loadExtraScriptsAndMakeChart);
    else loadExtraScriptsAndMakeChart();
  }

}());
