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

              
                <!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <script src="//www.amcharts.com/lib/4/core.js"></script>
    <script src="//www.amcharts.com/lib/4/charts.js"></script>
    <script src="https://www.amcharts.com/lib/4/themes/kelly.js"></script>
    <script src="//www.amcharts.com/lib/4/themes/animated.js"></script>
    <title>Peak Hour according to Weekdays</title>
    <link rel="stylesheet" href="index.css" />
  </head>
    
<script>
am4core.useTheme(am4themes_kelly);
am4core.useTheme(am4themes_animated);
</script>
    
  <body>
    <div id="chartdiv"></div>
    <script src="//www.amcharts.com/lib/4/core.js"></script>
    <script src="//www.amcharts.com/lib/4/charts.js"></script>
    <script src="https://www.amcharts.com/lib/4/themes/kelly.js"></script>
    <script src="//www.amcharts.com/lib/4/themes/animated.js"></script>
    <script src="index.js"></script>
  </body>
</html>
              
            
!

CSS

              
                body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  background-color: #30303d;
  color: #fff;
  overflow: hidden;
  margin: 0;
}

#chartdiv {
  width: 100%;
  height: 100vh;
}
              
            
!

JS

              
                am4core.addLicense("CH211653105"); 
/* Chart code */
// Themes begin
am4core.useTheme(am4themes_kelly);
am4core.useTheme(am4themes_animated);
// Themes end

var chart = am4core.create("chartdiv", am4charts.RadarChart);
chart.innerRadius = am4core.percent(30);

var xAxis = chart.xAxes.push(new am4charts.CategoryAxis());
var yAxis = chart.yAxes.push(new am4charts.CategoryAxis());

xAxis.renderer.labels.template.location = 0.5;
xAxis.renderer.labels.template.bent = true;
xAxis.renderer.labels.template.radius = 10;
xAxis.renderer.labels.template.fill=am4core.color("#FDFEFE");
xAxis.renderer.labels.template.fontSize=12;

xAxis.dataFields.category = "hour";
yAxis.dataFields.category = "weekday";

xAxis.renderer.grid.template.disabled = true;
xAxis.renderer.minGridDistance = 10;

yAxis.renderer.grid.template.disabled = true;
yAxis.renderer.inversed = true;
yAxis.renderer.minGridDistance = 30;
yAxis.renderer.labels.template.fontSize=10;

// this makes the y axis labels to be bent. By default y Axis labels are regular AxisLabels, so we replace them with AxisLabelCircular
// and call fixPosition for them to be bent
var yAxisLabel = new am4charts.AxisLabelCircular();
yAxisLabel.bent = true;
yAxisLabel.events.on("validated", function(event){  
  event.target.fixPosition(-90, am4core.math.getDistance({x:event.target.pixelX, y:event.target.pixelY}) - 5);
  event.target.dx = -event.target.pixelX;
  event.target.dy = -event.target.pixelY;
})
yAxis.renderer.labels.template = yAxisLabel;
yAxisLabel.fill=am4core.color("#FDFEFE");

var series = chart.series.push(new am4charts.RadarColumnSeries());
series.dataFields.categoryX = "hour";
series.dataFields.categoryY = "weekday";
series.dataFields.value = "value";
series.sequencedInterpolation = true;

var columnTemplate = series.columns.template;
columnTemplate.strokeWidth = 1;
columnTemplate.strokeOpacity = 0.5;
columnTemplate.stroke = am4core.color("#30303d");
columnTemplate.tooltipText = "{weekday}, {hour}: {value.workingValue.formatNumber('#.')}";
columnTemplate.width = am4core.percent(100);
columnTemplate.height = am4core.percent(100);

chart.seriesContainer.zIndex = -5;

columnTemplate.hiddenState.properties.opacity = 0;

// heat rule, this makes columns to change color depending on value
series.heatRules.push({ target: columnTemplate, property: "fill", min: am4core.color("#F2D7D5"), max: am4core.color("#A93226") });

// heat legend

var heatLegend = chart.bottomAxesContainer.createChild(am4charts.HeatLegend);
heatLegend.width = am4core.percent(100);
heatLegend.series = series;
heatLegend.valueAxis.renderer.labels.template.fontSize = 9;
heatLegend.valueAxis.renderer.labels.template.fill=am4core.color("#FDFEFE");
heatLegend.valueAxis.renderer.minGridDistance = 10;

// heat legend behavior
series.columns.template.events.on("over", function (event) {
  handleHover(event.target);
})

series.columns.template.events.on("hit", function (event) {
  handleHover(event.target);
})

function handleHover(column) {
  if (!isNaN(column.dataItem.value)) {
    heatLegend.valueAxis.showTooltipAt(column.dataItem.value)
  }
  else {
    heatLegend.valueAxis.hideTooltip();
  }
}

series.columns.template.events.on("out", function (event) {
  heatLegend.valueAxis.hideTooltip();
})

chart.data = [
  {
    "hour": "12pm-1am",
    "weekday": "Sunday",
    "value": 0
  },
  {
    "hour": "1am-2am",
    "weekday": "Sunday",
    "value": 0
  },
  {
    "hour": "2am-3am",
    "weekday": "Sunday",
    "value": 0
  },
  {
    "hour": "3am-4am",
    "weekday": "Sunday",
    "value": 1
  },
  {
    "hour": "4am-5am",
    "weekday": "Sunday",
    "value": 3
  },
  {
    "hour": "5am-6am",
    "weekday": "Sunday",
    "value": 20
  },
  {
    "hour": "6am-7am",
    "weekday": "Sunday",
    "value": 14
  },
  {
    "hour": "7am-8am",
    "weekday": "Sunday",
    "value": 4
  },
  {
    "hour": "8am-9am",
    "weekday": "Sunday",
    "value": 3
  },
  {
    "hour": "9am-10am",
    "weekday": "Sunday",
    "value": 4
  },
  {
    "hour": "10am-11am",
    "weekday": "Sunday",
    "value": 4
  },
  {
    "hour": "11am-12am",
    "weekday": "Sunday",
    "value": 8
  },
  {
    "hour": "12am-1pm",
    "weekday": "Sunday",
    "value": 17
  },
  {
    "hour": "1pm-2pm",
    "weekday": "Sunday",
    "value": 10
  },
  {
    "hour": "2pm-3pm",
    "weekday": "Sunday",
    "value": 13
  },
  {
    "hour": "3pm-4pm",
    "weekday": "Sunday",
    "value": 7
  },
  {
    "hour": "4pm-5pm",
    "weekday": "Sunday",
    "value": 16
  },
  {
    "hour": "5pm-6pm",
    "weekday": "Sunday",
    "value": 12
  },
  {
    "hour": "6pm-7pm",
    "weekday": "Sunday",
    "value": 11
  },
  {
    "hour": "7pm-8pm",
    "weekday": "Sunday",
    "value": 14
  },
  {
    "hour": "8pm-9pm",
    "weekday": "Sunday",
    "value": 13
  },
  {
    "hour": "9pm-10pm",
    "weekday": "Sunday",
    "value": 0
  },
  {
    "hour": "10pm-11pm",
    "weekday": "Sunday",
    "value": 1
  },
  {
    "hour": "11pm-12pm",
    "weekday": "Sunday",
    "value": 0
  },
  {
    "hour": "12pm-1am",
    "weekday": "Monday",
    "value": 0
  },
  {
    "hour": "1am-2am",
    "weekday": "Monday",
    "value": 0
  },
  {
    "hour": "2am-3am",
    "weekday": "Monday",
    "value": 0
  },
  {
    "hour": "3am-4am",
    "weekday": "Monday",
    "value": 0
  },
  {
    "hour": "4am-5am",
    "weekday": "Monday",
    "value": 2
  },
  {
    "hour": "5am-6am",
    "weekday": "Monday",
    "value": 21
  },
  {
    "hour": "6am-7am",
    "weekday": "Monday",
    "value": 21
  },
  {
    "hour": "7am-8am",
    "weekday": "Monday",
    "value": 27
  },
  {
    "hour": "8am-9am",
    "weekday": "Monday",
    "value": 47
  },
  {
    "hour": "9am-10am",
    "weekday": "Monday",
    "value": 31
  },
  {
    "hour": "10am-11am",
    "weekday": "Monday",
    "value": 24
  },
  {
    "hour": "11am-12am",
    "weekday": "Monday",
    "value": 19
  },
  {
    "hour": "12am-1pm",
    "weekday": "Monday",
    "value": 15
  },
  {
    "hour": "1pm-2pm",
    "weekday": "Monday",
    "value": 14
  },
  {
    "hour": "2pm-3pm",
    "weekday": "Monday",
    "value": 11
  },
  {
    "hour": "3pm-4pm",
    "weekday": "Monday",
    "value": 21
  },
  {
    "hour": "4pm-5pm",
    "weekday": "Monday",
    "value": 20
  },
  {
    "hour": "5pm-6pm",
    "weekday": "Monday",
    "value": 26
  },
  {
    "hour": "6pm-7pm",
    "weekday": "Monday",
    "value": 30
  },
  {
    "hour": "7pm-8pm",
    "weekday": "Monday",
    "value": 30
  },
  {
    "hour": "8pm-9pm",
    "weekday": "Monday",
    "value": 18
  },
  {
    "hour": "9pm-10pm",
    "weekday": "Monday",
    "value": 0
  },
  {
    "hour": "10pm-11pm",
    "weekday": "Monday",
    "value": 1
  },
  {
    "hour": "11pm-12pm",
    "weekday": "Monday",
    "value": 27
  },
  {
    "hour": "12pm-1am",
    "weekday": "Tuesday",
    "value": 0
  },
  {
    "hour": "1am-2am",
    "weekday": "Tuesday",
    "value": 0
  },
  {
    "hour": "2am-3am",
    "weekday": "Tuesday",
    "value": 0
  },
  {
    "hour": "3am-4am",
    "weekday": "Tuesday",
    "value": 0
  },
  {
    "hour": "4am-5am",
    "weekday": "Tuesday",
    "value": 2
  },
  {
    "hour": "5am-6am",
    "weekday": "Tuesday",
    "value": 35
  },
  {
    "hour": "6am-7am",
    "weekday": "Tuesday",
    "value": 22
  },
  {
    "hour": "7am-8am",
    "weekday": "Tuesday",
    "value": 33
  },
  {
    "hour": "8am-9am",
    "weekday": "Tuesday",
    "value": 33
  },
  {
    "hour": "9am-10am",
    "weekday": "Tuesday",
    "value": 46
  },
  {
    "hour": "10am-11am",
    "weekday": "Tuesday",
    "value": 16
  },
  {
    "hour": "11am-12am",
    "weekday": "Tuesday",
    "value": 15
  },
  {
    "hour": "12am-1pm",
    "weekday": "Tuesday",
    "value": 16
  },
  {
    "hour": "1pm-2pm",
    "weekday": "Tuesday",
    "value": 13
  },
  {
    "hour": "2pm-3pm",
    "weekday": "Tuesday",
    "value": 23
  },
  {
    "hour": "3pm-4pm",
    "weekday": "Tuesday",
    "value": 23
  },
  {
    "hour": "4pm-5pm",
    "weekday": "Tuesday",
    "value": 23
  },
  {
    "hour": "5pm-6pm",
    "weekday": "Tuesday",
    "value": 42
  },
  {
    "hour": "6pm-7pm",
    "weekday": "Tuesday",
    "value": 41
  },
  {
    "hour": "7pm-8pm",
    "weekday": "Tuesday",
    "value": 31
  },
  {
    "hour": "8pm-9pm",
    "weekday": "Tuesday",
    "value": 21
  },
  {
    "hour": "9pm-10pm",
    "weekday": "Tuesday",
    "value": 0
  },
  {
    "hour": "10pm-11pm",
    "weekday": "Tuesday",
    "value": 2
  },
  {
    "hour": "11pm-12pm",
    "weekday": "Tuesday",
    "value": 2
  },
  {
    "hour": "12pm-1am",
    "weekday": "Wednesday",
    "value": 1
  },
  {
    "hour": "1am-2am",
    "weekday": "Wednesday",
    "value": 0
  },
  {
    "hour": "2am-3am",
    "weekday": "Wednesday",
    "value": 0
  },
  {
    "hour": "3am-4am",
    "weekday": "Wednesday",
    "value": 0
  },
  {
    "hour": "4am-5am",
    "weekday": "Wednesday",
    "value": 1
  },
  {
    "hour": "5am-6am",
    "weekday": "Wednesday",
    "value": 32
  },
  {
    "hour": "6am-7am",
    "weekday": "Wednesday",
    "value": 24
  },
  {
    "hour": "7am-8am",
    "weekday": "Wednesday",
    "value": 30
  },
  {
    "hour": "8am-9am",
    "weekday": "Wednesday",
    "value": 36
  },
  {
    "hour": "9am-10am",
    "weekday": "Wednesday",
    "value": 37
  },
  {
    "hour": "10am-11am",
    "weekday": "Wednesday",
    "value": 10
  },
  {
    "hour": "11am-12am",
    "weekday": "Wednesday",
    "value": 29
  },
  {
    "hour": "12am-1pm",
    "weekday": "Wednesday",
    "value": 13
  },
  {
    "hour": "1pm-2pm",
    "weekday": "Wednesday",
    "value": 18
  },
  {
    "hour": "2pm-3pm",
    "weekday": "Wednesday",
    "value": 23
  },
  {
    "hour": "3pm-4pm",
    "weekday": "Wednesday",
    "value": 18
  },
  {
    "hour": "4pm-5pm",
    "weekday": "Wednesday",
    "value": 22
  },
  {
    "hour": "5pm-6pm",
    "weekday": "Wednesday",
    "value": 28
  },
  {
    "hour": "6pm-7pm",
    "weekday": "Wednesday",
    "value": 41
  },
  {
    "hour": "7pm-8pm",
    "weekday": "Wednesday",
    "value": 22
  },
  {
    "hour": "8pm-9pm",
    "weekday": "Wednesday",
    "value": 12
  },
  {
    "hour": "9pm-10pm",
    "weekday": "Wednesday",
    "value": 0
  },
  {
    "hour": "10pm-11pm",
    "weekday": "Wednesday",
    "value": 0
  },
  {
    "hour": "11pm-12pm",
    "weekday": "Wednesday",
    "value": 1
  },
  {
    "hour": "12pm-1am",
    "weekday": "Thursday",
    "value": 0
  },
  {
    "hour": "1am-2am",
    "weekday": "Thursday",
    "value": 0
  },
  {
    "hour": "2am-3am",
    "weekday": "Thursday",
    "value": 0
  },
  {
    "hour": "3am-4am",
    "weekday": "Thursday",
    "value": 0
  },
  {
    "hour": "4am-5am",
    "weekday": "Thursday",
    "value": 3
  },
  {
    "hour": "5am-6am",
    "weekday": "Thursday",
    "value": 40
  },
  {
    "hour": "6am-7am",
    "weekday": "Thursday",
    "value": 25
  },
  {
    "hour": "7am-8am",
    "weekday": "Thursday",
    "value": 35
  },
  {
    "hour": "8am-9am",
    "weekday": "Thursday",
    "value": 32
  },
  {
    "hour": "9am-10am",
    "weekday": "Thursday",
    "value": 38
  },
  {
    "hour": "10am-11am",
    "weekday": "Thursday",
    "value": 31
  },
  {
    "hour": "11am-12am",
    "weekday": "Thursday",
    "value": 18
  },
  {
    "hour": "12am-1pm",
    "weekday": "Thursday",
    "value": 29
  },
  {
    "hour": "1pm-2pm",
    "weekday": "Thursday",
    "value": 19
  },
  {
    "hour": "2pm-3pm",
    "weekday": "Thursday",
    "value": 27
  },
  {
    "hour": "3pm-4pm",
    "weekday": "Thursday",
    "value": 20
  },
  {
    "hour": "4pm-5pm",
    "weekday": "Thursday",
    "value": 32
  },
  {
    "hour": "5pm-6pm",
    "weekday": "Thursday",
    "value": 45
  },
  {
    "hour": "6pm-7pm",
    "weekday": "Thursday",
    "value": 41
  },
  {
    "hour": "7pm-8pm",
    "weekday": "Thursday",
    "value": 22
  },
  {
    "hour": "8pm-9pm",
    "weekday": "Thursday",
    "value": 20
  },
  {
    "hour": "9pm-10pm",
    "weekday": "Thursday",
    "value": 0
  },
  {
    "hour": "10pm-11pm",
    "weekday": "Thursday",
    "value": 2
  },
  {
    "hour": "11pm-12pm",
    "weekday": "Thursday",
    "value": 2
  },
  {
    "hour": "12pm-1am",
    "weekday": "Friday",
    "value": 0
  },
  {
    "hour": "1am-2am",
    "weekday": "Friday",
    "value": 0
  },
  {
    "hour": "2am-3am",
    "weekday": "Friday",
    "value": 0
  },
  {
    "hour": "3am-4am",
    "weekday": "Friday",
    "value": 0
  },
  {
    "hour": "4am-5am",
    "weekday": "Friday",
    "value": 1
  },
  {
    "hour": "5am-6am",
    "weekday": "Friday",
    "value": 25
  },
  {
    "hour": "6am-7am",
    "weekday": "Friday",
    "value": 28
  },
  {
    "hour": "7am-8am",
    "weekday": "Friday",
    "value": 17
  },
  {
    "hour": "8am-9am",
    "weekday": "Friday",
    "value": 45
  },
  {
    "hour": "9am-10am",
    "weekday": "Friday",
    "value": 29
  },
  {
    "hour": "10am-11am",
    "weekday": "Friday",
    "value": 30
  },
  {
    "hour": "11am-12am",
    "weekday": "Friday",
    "value": 25
  },
  {
    "hour": "12am-1pm",
    "weekday": "Friday",
    "value": 17
  },
  {
    "hour": "1pm-2pm",
    "weekday": "Friday",
    "value": 19
  },
  {
    "hour": "2pm-3pm",
    "weekday": "Friday",
    "value": 22
  },
  {
    "hour": "3pm-4pm",
    "weekday": "Friday",
    "value": 20
  },
  {
    "hour": "4pm-5pm",
    "weekday": "Friday",
    "value": 30
  },
  {
    "hour": "5pm-6pm",
    "weekday": "Friday",
    "value": 37
  },
  {
    "hour": "6pm-7pm",
    "weekday": "Friday",
    "value": 42
  },
  {
    "hour": "7pm-8pm",
    "weekday": "Friday",
    "value": 21
  },
  {
    "hour": "8pm-9pm",
    "weekday": "Friday",
    "value": 25
  },
  {
    "hour": "9pm-10pm",
    "weekday": "Friday",
    "value": 2
  },
  {
    "hour": "10pm-11pm",
    "weekday": "Friday",
    "value": 2
  },
  {
    "hour": "11pm-12pm",
    "weekday": "Friday",
    "value": 0
  },
  {
    "hour": "12pm-1am",
    "weekday": "Saturday",
    "value": 0
  },
  {
    "hour": "1am-2am",
    "weekday": "Saturday",
    "value": 0
  },
  {
    "hour": "2am-3am",
    "weekday": "Saturday",
    "value": 0
  },
  {
    "hour": "3am-4am",
    "weekday": "Saturday",
    "value": 0
  },
  {
    "hour": "4am-5am",
    "weekday": "Saturday",
    "value": 4
  },
  {
    "hour": "5am-6am",
    "weekday": "Saturday",
    "value": 21
  },
  {
    "hour": "6am-7am",
    "weekday": "Saturday",
    "value": 21
  },
  {
    "hour": "7am-8am",
    "weekday": "Saturday",
    "value": 11
  },
  {
    "hour": "8am-9am",
    "weekday": "Saturday",
    "value": 7
  },
  {
    "hour": "9am-10am",
    "weekday": "Saturday",
    "value": 5
  },
  {
    "hour": "10am-11am",
    "weekday": "Saturday",
    "value": 25
  },
  {
    "hour": "11am-12am",
    "weekday": "Saturday",
    "value": 12
  },
  {
    "hour": "12am-1pm",
    "weekday": "Saturday",
    "value": 14
  },
  {
    "hour": "1pm-2pm",
    "weekday": "Saturday",
    "value": 11
  },
  {
    "hour": "2pm-3pm",
    "weekday": "Saturday",
    "value": 10
  },
  {
    "hour": "3pm-4pm",
    "weekday": "Saturday",
    "value": 13
  },
  {
    "hour": "4pm-5pm",
    "weekday": "Saturday",
    "value": 25
  },
  {
    "hour": "5pm-6pm",
    "weekday": "Saturday",
    "value": 12
  },
  {
    "hour": "6pm-7pm",
    "weekday": "Saturday",
    "value": 19
  },
  {
    "hour": "7pm-8pm",
    "weekday": "Saturday",
    "value": 16
  },
  {
    "hour": "8pm-9pm",
    "weekday": "Saturday",
    "value": 12
  },
  {
    "hour": "9pm-10pm",
    "weekday": "Saturday",
    "value": 0
  },
  {
    "hour": "10pm-11pm",
    "weekday": "Saturday",
    "value": 0
  },
  {
    "hour": "11pm-12pm",
    "weekday": "Saturday",
    "value": 2
  }

];
              
            
!
999px

Console