My challenge is to center the legend below a choropleth map of the United States. I don't have much experience with JS or CSS, but I decided to delve into the datamaps.all.min.js file in the R-3.2.1\library\rMaps\libraries\datamaps\js directory in search for the tag for the legend and its default values. Here's what I discovered:
.datamaps-legend dt, .datamaps-legend dd {
float: left;
margin: 0 3px 0 0;
} .datamaps-legend dd {
width: 20px;
margin-right: 6px;
border-radius: 3px;
} .datamaps-legend {
padding-bottom: 20px;
z-index: 1001;
position: absolute;
left: 4px;
font-size: 12px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
I made some changes and added it to my header.html file as follows:
.datamaps-legend dt, .datamaps-legend dd {
float: left;
margin: 0 3px 0 0;
} .datamaps-legend dd {
width: 20px;
margin-right: 6px;
border-radius: 3px;
} .datamaps-legend {
padding-bottom: 20px;
z-index: 1001;
position: absolute;
left: 40px;
font-size: 10px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
However, it seems like these adjustments are either incorrect or ineffective due to another css file taking precedence over these instructions. Currently, the map section appears like this:
https://i.sstatic.net/YfhJJ.png
The issues include an unexpected bold and italic text treatment and the graphic overflowing onto the tables below despite setting "position: absolute".