JSFiddle - React, Tailwind, and code Playground
by Osvaldo
HTML
<script src="https://cdn.plot.ly/plotly-latest.min.js" defer></script>
<div id="doubleAxis" style="width: 100%; height: auto; margin-bottom: 1em;"></div>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
var trace1 = {
x: ['∙ 2007', '∙ 2008', '∙ 2009', '∙ 2010', '∙ 2011', '∙ 2012', '∙ 2013', '∙ 2014', '∙ 2015', '∙ 2016', '∙ 2017'],
y: [86122, 50323, 120094, 54770, 102161, 218957, 61691, 48718, 65850, 178436],
marker: {
color: ['rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', 'rgba(255, 195, 49, 1)', ]
},
name: 'Superficie afectada (ha)',
type: 'bar'
};
var trace2 = {
x: ['∙ 2007', '∙ 2008', '∙ 2009', '∙ 2010', '∙ 2011', '∙ 2012', '∙ 2013', '∙ 2014', '∙ 2015', '∙ 2016', '∙ 2017'],
y: [6, 35, 11, 24, 41, 17, 7, 16, 22, 56],
line: {
color: 'rgba(255, 77, 22, 1)',
width: 2
},
name: 'Nº de grandes incendios',
yaxis: 'y2',
type: 'scatter'
};
var data = [trace1, trace2];
var layout5 = {
title: 'Incendios florestales en Espana',
font: {
family: '"Work Sans",sans-serif',
size: 11,
color: '#212529'
},
titlefont: {
size: 16,
color: '#212529'
},
xaxis: {
fixedrange: true,
// title: 'Año'
},
yaxis: {
title: 'Superficie afectada (ha)',
fixedrange: true,
showgrid: false,
tickmode: 'array',
tickvals: [0, 50000, 100000,...