Column Dashboard

author(s): Danielle Denton

by Mike Zavarello

HTML

<script src="https://www.frbatlanta.org/~/media/javascript/job-quality-tool/inflationDashboardData.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container_InflatDashboard" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

JavaScript

/* set global settings for all Highcharts visualizations */
function setChartDefaults(chartWidth, chartHeight, chartSourceLine, chartSourceLineOffset) {
    if (!chartWidth) chartWidth = 650;
    if (!chartHeight) chartHeight = 450;
    if (!chartSourceLine) chartSourceLine = 'Source: Atlanta Fed';
    if (!chartSourceLineOffset) chartSourceLineOffset = 50;
    Highcharts.setOptions({
        chart: { borderColor: '#CDCDCD', borderWidth: 1, zoomType: 'xy' },
        colors: [
			'#0E4768', /* "Bank" blue */
			'#768F40', /* green */
			'#F5892F', /* orange */
			'#581F54', /* purple */
			'#5588A3', /* light blue */
			'#084225', /* dark green */
			'#B59236', /* gold */
			'#8B4823', /* dark orange */
			'#756A5C', /* brown */
			'#A01D23', /* red */
			'#000000', /* black */
			'#B89078', /* faded dark orange; tan */
			'#CF8788', /* faded red; coral */
			'#AB8EA9', /* faded purple; mauve */
			'#9BB4A9', /* faded dark green; mint */
			'#B5C7D1'  /* faded "Bank" blue; sky */
        ],
        credits: { enabled: true, text: '', style: { color: '#ABABAB', font: '9px Arial, sans-serif' }, position: { align: 'right', y: -10 } },
        exporting: {
            chartOptions: {
                chart: {
                    height: chartHeight, width: chartWidth
                },
                legend: { enabled: true },
                rangeSelector: { enabled: false }
            },
            enableImages: true,
            buttons: {
                contextButton: {
                    text: 'Export',
                    menuItems: [{
                        text: 'Print this chart', onclick: function () { this.print(); thisTitle = this.options.title.text; newTitle = thisTitle.replace("<br>", ": "); newTitle = thisTitle.replace("<br />", ": "); ga('send', 'event', 'Highcharts', 'print', newTitle + ' | ' + document.title); $.get('/dms-goal-items-for-javascript-calls/highcharts-exports'); }
                    }, {
                        separator: true,
   ...