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

              
                <script src="https://code.highcharts.com/js/highcharts.js"></script>

<div class="t-container">
	<h2>Gender distribution in the IT field in Sweden</h2>
	<h3 class="t-subtitle">Number (rounded at thousands) / Year</h3>
	<article id="it-field"></article>
</div>

              
            
!

CSS

              
                // FONTS, VARS AND MIXINS ARE BEING IMPORTED
// They are private for security reasons

// VARIABLES

$grid-color: $grey-mid;

// Colors for data series and points
$colors: $teal $teal-mid $teal-light $nex-green $nex-green-mid $nex-green-light;

// Chart background, point stroke for markers and columns, etc...
$background-color: $white;

// Neutral colors, grayscale by default. The default colors are defined by mixing the background-color
// with neutral, with a weight corresponding to the number in the name.

// Axis labels, axis title, connector fallback
$neutral-color-60: $grid-color;

// Credits text, export menu stroke
$neutral-color-40: $text-color;

// Disabled texts, button strokes, crosshair etc
$neutral-color-20: $grey-light;

// Grid lines etc. */
$neutral-color-10: $grid-color;

// Minor grid lines etc
$neutral-color-5: $grid-color;

// Tooltip backgroud, button fills, map null points
$neutral-color-3: $white;

// COLORED

// Drilldown clickable labels, color axis max color
$highlight-color-100: $teal;

// Selection marker, menu hover, button hover, chart border, navigator series
$highlight-color-80: $teal-mid;

// Navigator mask fill
$highlight-color-60: $teal-light;

// Ticks and axis line
$highlight-color-20: $grey-mid;

// Pressed button, color axis min color
$highlight-color-10: #e6ebf5;


// CHART SPECIFIC COLOR OVERRIDE
$colors: $grey, $teal, $cerise;


body {
	display: flex;
	justify-content: center;
	align-items: center;
	width: auto;
	height: 100vh;
	margin: 0;
	padding: $space-large;
	background: $grey-bg;
}

.t-container {
	display: block;
	width: $max-width;
	// Just for demo purposes
	max-width: -webkit-fill-available;
	max-width: -moz-available;
	padding: $space-large;
	background: $white;
	
	.t-subtitle {
		// Compensate for default .t-container h1 margin
		margin-top: -$space-related;
		color: $grey-mid;
	}
}

.highcharts-container {
	position: relative;
	overflow: hidden;
	width: 100%;
	height: 100%;
	// Negative margin to compensate for chart padding
	margin: -10px;
	line-height: normal;
	z-index: 0;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
	font-family: $font-main;
    font-size: 13px;
}

.highcharts-root text { stroke-width: 0; }

.highcharts-background { fill: $background-color; }

.highcharts-plot-background,
.highcharts-plot-border { fill: none; }

.highcharts-label-box { fill: none; }

.highcharts-button-box { fill: inherit; }

// TITLES

.highcharts-title {
	fill: $header-color;
	font-family: $font-nex;
	font-size: 22px;
}

.highcharts-subtitle {
	fill: $grey;
	font-size: 12px;
}

// AXES

.highcharts-axis-line {
	fill: none;
	stroke: $grid-color;
	stroke-dasharray: 1px, 4px;
}

.highcharts-yaxis .highcharts-axis-line { stroke-width: 0; }

.highcharts-axis-title {
	fill: $grey;
	font-size: 10px;
}

.highcharts-axis-labels {
	fill: $grey;
	font-size: 10px;
	cursor: default;
}

.highcharts-grid-line {
	fill: none;
	stroke: $grid-color;
	stroke-dasharray: 1px, 4px;
}

.highcharts-xaxis-grid .highcharts-grid-line { stroke-width: 0; }

.highcharts-tick { stroke: $grid-color; }

.highcharts-yaxis .highcharts-tick { stroke-width: 0; }

.highcharts-minor-grid-line { stroke: $grid-color; }

.highcharts-crosshair-thin {
	stroke-width: 1px;
	stroke: $neutral-color-20;
}

.highcharts-crosshair-category {
	stroke: $highlight-color-20;
	stroke-opacity: 0.25;
}

// CREDITS

.highcharts-credits { 
	fill: $grey;
	font-size: 10px;
	cursor: pointer;
}

// TOOLTIPS

.highcharts-tooltip {
	font-size: 12px;
	pointer-events: none;
	white-space: nowrap;
	cursor: default;
	transition: stroke $speed;
}

.highcharts-tooltip text { fill: $text-color; }

.highcharts-tooltip .highcharts-header {
	font-size: 14px;
	font-weight: bold;
}

.highcharts-tooltip-box {
	stroke: $grey;
	stroke-width: 1px;
	fill: $white;
	fill-opacity: 1;
}

.highcharts-selection-marker {
	fill: $highlight-color-80;
	fill-opacity: 0.25;
}

.highcharts-graph {
	fill: none;
	stroke-width: 2px;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.highcharts-state-hover .highcharts-graph { stroke-width: 4px; }

.highcharts-state-hover path {
	// Quick in
	transition: stroke-width $speed-fast;
}

.highcharts-state-normal path {
	// Slow out
	transition: stroke-width $speed;
}

// Legend hover affects points and series

.highcharts-point,
g.highcharts-series { transition: opacity $speed; }

.highcharts-legend-point-active .highcharts-point:not(.highcharts-point-hover),
.highcharts-legend-series-active g.highcharts-series:not(.highcharts-series-hover) {
	opacity: 0.2;
}

// SERIES OPTIONS

// Default colors

@for $i from 1 through length($colors) {
	$color: nth($colors, $i);

	.highcharts-color-#{$i - 1} {
		fill: transparent;
		stroke: $color;
	}
}

.highcharts-area {
	fill-opacity: 0.75;
	stroke-width: 0;
}

.highcharts-markers {
	stroke-width: 2px;
	fill: $background-color;
}

.highcharts-point { stroke-width: 2px; }

.highcharts-point-hover {
	stroke-width: 2px;
	fill: $background-color;
}

.highcharts-dense-data .highcharts-point { stroke-width: 0; }

.highcharts-data-label {
	font-size: 10px;
	font-weight: normal;
}

.highcharts-data-label-box {
	fill: none;
	stroke-width: 0;
}

.highcharts-data-label text { fill: $text-color; }

.highcharts-data-label-connector { fill: none; }

.highcharts-halo { display: none; }

.highcharts-point-select {
	fill: $neutral-color-20;
	stroke: $text-color;
}

.highcharts-column-series .highcharts-point {
	stroke: $background-color;
	transition: fill-opacity $speed;
}

.highcharts-column-series .highcharts-point-hover {
	fill-opacity: 0.75;
	transition: fill-opacity $speed-fast;
}

.highcharts-pie-series .highcharts-point {
	stroke-linejoin: round;
	stroke: $background-color;
}

.highcharts-pie-series .highcharts-point-hover {
	fill-opacity: 0.75;
	transition: fill-opacity $speed-fast;
}

.highcharts-pie-series .highcharts-point-select {
	fill: inherit;
	stroke: inherit;
}

.highcharts-funnel-series .highcharts-point {
	stroke-linejoin: round;
	stroke: $background-color;
}

.highcharts-funnel-series .highcharts-point-hover {
	fill-opacity: 0.75;
	transition: fill-opacity $speed-fast;
}

.highcharts-funnel-series .highcharts-point-select {
	fill: inherit;
	stroke: inherit;
}

.highcharts-pyramid-series .highcharts-point {
	stroke-linejoin: round;
	stroke: $background-color;
}

.highcharts-pyramid-series .highcharts-point-hover {
	fill-opacity: 0.75;
	transition: fill-opacity $speed-fast;
}

.highcharts-pyramid-series .highcharts-point-select {
	fill: inherit;
	stroke: inherit;
}

.highcharts-solidgauge-series .highcharts-point {
	stroke-width: 0;
}

.highcharts-treemap-series .highcharts-point {
	stroke-width: 1px;
	stroke: $neutral-color-10;
	transition:
		stroke $speed,
		fill $speed,
		fill-opacity $speed;
}

.highcharts-treemap-series .highcharts-point-hover {
	stroke: $neutral-color-40;
	transition:
		stroke $speed,
		fill $speed,
		fill-opacity $speed;
}

.highcharts-treemap-series .highcharts-above-level { display: none; }

.highcharts-treemap-series .highcharts-internal-node { fill: none; }

.highcharts-treemap-series .highcharts-internal-node-interactive {
	fill-opacity: 0.15;
	cursor: pointer;

	&:hover { fill-opacity: 0.75; }
}

// LEGEND

.highcharts-legend-box {
	fill: none;
	stroke-width: 0;
}

.highcharts-legend-item {
	&:hover {
		filter: drop-shadow(0 1px 2px $grey-feather);
	}
}

.highcharts-legend-item text {
	fill: $grey-mid;
	font-size: 10px;
	font-weight: normal;
	cursor: pointer;
	stroke-width: 0;

	&:hover { fill: inherit; }
}

.highcharts-legend-item-hidden * {
	fill: $neutral-color-20 !important;
	stroke: $neutral-color-20 !important;
	transition: fill $speed;
}

.highcharts-legend-nav-active {
	fill: $highlight-color-100;
	cursor: pointer;
}

.highcharts-legend-nav-inactive {
	fill: $neutral-color-20;
}

.highcharts-legend-title-box {
	fill: none;
	stroke-width: 0;
}

// LOADING

.highcharts-loading {
	position: absolute;
	background-color: $background-color;
	opacity: 0.5;
	text-align: center;
	z-index: 10;
	transition: opacity $speed;
}

.highcharts-loading-hidden {
	height: 0 !important;
	opacity: 0;
	overflow: hidden;
	transition:
		opacity $speed,
		height $speed step-end;
}

.highcharts-loading-inner {
	font-weight: bold;
	position: relative;
	top: 45%;
}

/* Plot bands and polar pane backgrounds */
.highcharts-plot-band {
	fill: $text-color;
	fill-opacity: 0.05;
}

.highcharts-plot-line {
	fill: none;
	stroke: $neutral-color-40;
	stroke-width: 1px;
}

// HIGHCHARTS MORE

.highcharts-boxplot-box { fill: $background-color; }

.highcharts-boxplot-median { stroke-width: 2px; }

.highcharts-bubble-series .highcharts-point { fill-opacity: 0.5; }

.highcharts-errorbar-series .highcharts-point { stroke: $text-color; }

.highcharts-gauge-series .highcharts-data-label-box {
	stroke: $neutral-color-20;
	stroke-width: 1px;
}

.highcharts-gauge-series .highcharts-dial {
	fill: $text-color;
	stroke-width: 0;
}

.highcharts-polygon-series .highcharts-graph {
	fill: inherit;
	stroke-width: 0;
}

.highcharts-waterfall-series .highcharts-graph {
	stroke: $text-color;
	stroke-dasharray: 1, 3;
}

// HIGHSTOCK

.highcharts-navigator-mask {
	fill: $highlight-color-60;
	/* navigator.maskFill option */
	fill-opacity: 0.25;
}

.highcharts-navigator-mask-inside {
	fill: $highlight-color-60;
	/* navigator.maskFill option */
	fill-opacity: 0.25;
	cursor: ew-resize;
}

.highcharts-navigator-outline {
	stroke: $neutral-color-20;
	fill: none;
}

.highcharts-navigator-handle {
	stroke: $neutral-color-20;
	fill: $neutral-color-5;
	cursor: ew-resize;
}

.highcharts-navigator-series {
	fill: $highlight-color-80;
	stroke: $highlight-color-80;
}

.highcharts-navigator-series .highcharts-graph { stroke-width: 1px; }

.highcharts-navigator-series .highcharts-area { fill-opacity: 0.05; }

.highcharts-navigator-xaxis .highcharts-axis-line { stroke-width: 0; }

.highcharts-navigator-xaxis .highcharts-grid-line {
	stroke-width: 1px;
	stroke: $neutral-color-10;
}

.highcharts-navigator-xaxis.highcharts-axis-labels { fill: $neutral-color-40; }

.highcharts-navigator-yaxis .highcharts-grid-line { stroke-width: 0; }

.highcharts-scrollbar-thumb {
	fill: $neutral-color-20;
	stroke: $neutral-color-20;
	stroke-width: 1px;
}

.highcharts-scrollbar-button {
	fill: $neutral-color-10;
	stroke: $neutral-color-20;
	stroke-width: 1px;
}

.highcharts-scrollbar-arrow { fill: $neutral-color-60; }

.highcharts-scrollbar-rifles {
	stroke: $neutral-color-60;
	stroke-width: 1px;
}

.highcharts-scrollbar-track {
	fill: $neutral-color-5;
	stroke: $neutral-color-5;
	stroke-width: 1px;
}

.highcharts-button {
	fill: $neutral-color-3;
	stroke: $neutral-color-20;
	cursor: default;
	stroke-width: 1px;
	transition: fill $speed;
}

.highcharts-button text {
	fill: $text-color;
}

.highcharts-button-hover {
	transition: fill 0;
	fill: $neutral-color-10;
	stroke: $text-color;
}

.highcharts-button-pressed {
	font-weight: bold;
	fill: $highlight-color-10;
	stroke: $highlight-color-80;
}

.highcharts-button-disabled text { fill: $neutral-color-20; }

.highcharts-range-selector-buttons .highcharts-button { stroke-width: 0; }

.highcharts-range-label rect { fill: none; }

.highcharts-range-label text { fill: $neutral-color-60; }

.highcharts-range-input rect { fill: none; }

.highcharts-range-input text { fill: $text-color; }

input.highcharts-range-selector {
	position: absolute;
	border: 0;
	width: 1px;
	// Chrome needs a pixel to see it
	height: 1px;
	padding: 0;
	text-align: center;
	left: -9em;
}

.highcharts-crosshair-label text {
	fill: $background-color;
	font-size: 12px;
}

.highcharts-crosshair-label .highcharts-label-box { fill: inherit; }

.highcharts-candlestick-series .highcharts-point {
	stroke: $text-color;
	stroke-width: 1px;
}

.highcharts-candlestick-series .highcharts-point-up { fill: $background-color; }

.highcharts-ohlc-series .highcharts-point-hover { stroke-width: 3px; }

.highcharts-flags-series .highcharts-point {
	stroke: $neutral-color-40;
	fill: $background-color;
}

.highcharts-flags-series .highcharts-point-hover {
	stroke: $text-color;
	fill: $highlight-color-20;
}

.highcharts-flags-series .highcharts-point text {
	fill: $text-color;
	font-size: 0.9em;
	font-weight: bold;
}

// HIGHMAPS

.highcharts-map-series .highcharts-point {
	transition:
		fill 500ms,
		fill-opacity 500ms,
		stroke-width $speed;
	stroke: $neutral-color-20;
}

.highcharts-map-series .highcharts-point-hover {
	transition:
		fill 0ms,
		fill-opacity 0;
	fill-opacity: 0.5;
	stroke-width: 2px;
}

.highcharts-mapline-series .highcharts-point {
	fill: none;
}

.highcharts-heatmap-series .highcharts-point {
	stroke-width: 0;
}

.highcharts-map-navigation {
	font-size: 1.3em;
	font-weight: bold;
	text-align: center;
}

.highcharts-coloraxis { stroke-width: 0; }

.highcharts-coloraxis-marker { fill: $neutral-color-40; }

.highcharts-null-point { fill: $neutral-color-3; }

// 3D CHARTS

.highcharts-3d-frame { fill: transparent; }

.highcharts-column-series .highcharts-point {
	// Use point color
	stroke: inherit;
}

// Exporting module
.highcharts-contextbutton {
	// Needed to capture hover
	fill: $background-color;
	stroke: none;
	stroke-linecap: round;
}

.highcharts-contextbutton:hover {
	fill: $neutral-color-10;
	stroke: $neutral-color-10;
}

.highcharts-button-symbol {
	stroke: $neutral-color-60;
	stroke-width: 3px;
}

.highcharts-menu {
	border: 1px solid $neutral-color-40;
	background: $background-color;
	padding: 5px 0;
	box-shadow: 3px 3px 10px #888;
}

.highcharts-menu-item {
	padding: 0.5em 1em;
	background: none;
	color: $text-color;
	cursor: pointer;
	transition:
		background $speed,
		color $speed;
}

.highcharts-menu-item:hover {
	background: $highlight-color-80;
	color: $background-color;
}

// Drilldown module

.highcharts-drilldown-point {
	cursor: pointer;
}

.highcharts-drilldown-axis-label,
.highcharts-drilldown-data-label text {
	cursor: pointer;
	fill: $highlight-color-100;
	font-weight: bold;
	text-decoration: underline;
}

// No-data module

.highcharts-no-data text {
	font-weight: bold;
	font-size: 12px;
	fill: $neutral-color-60;
}

              
            
!

JS

              
                Highcharts.chart("it-field", {
	chart: {
		type: 'spline',
		spacingTop: 24,
		spacingBottom: 2
	},
	
	title: null,
	
	subtitle: null,
	
	credits: {
        text: 'SCB',
        href: 'javascript:window.open("https://goo.gl/jzUSZD", "_blank")'
    },

	xAxis: {
		title: null,
		tickLength: 0,
		tickWidth: 0,
		allowDecimals: false
	},

	yAxis: {
		title: null,
		tickLength: 0,
		tickWidth: 0,
	},
	
	tooltip: {
		hideDelay: 250,
		snap: 12,
		crosshairs: false,
		formatter: function () {
				let yValue = Intl.NumberFormat('en-US').format(this.y);
			
				console.log(this);
			
            return yValue + ' in ' + this.x + ' ';
        }
	},

	legend: {
		layout: "horizontal",
		align: "left",
		verticalAlign: "bottom",
		itemMarginTop: 12,
		symbolHeight: 8,
		symbolWidth: 8,
		symbolRadius: 4
	},

	plotOptions: {
		series: {
			connectNulls: true,
			label: {
				connectorAllowed: false,
				enabled: false
			},
			pointStart: 2010,
			marker: {
				enabled: true,
				symbol: 'circle',
           	radius: 2,
				states: {
					hover: {
						radiusPlus: 3
					}
				}
			},
			events: {
				legendItemClick: function () {
					return false;
				}
			},
			dataLabels: {
				enabled: false,
				borderRadius: 3,
				padding: 4,
				y: -4
      	}
		}
	},

	series: [
		{
			name: "Total",
			data: [89078, 92078, 96078, null, 103079, null, 110000]
		},
		{
			name: "Male",
			data: [70000, 72000, 75000, null, 82000, null, 86000]
		},
		{
			name: "Female",
			data: [19000, 20000, 21000, null, 21000, null, 24000]
		}
	]
});

              
            
!
999px

Console