JSFiddle - React, Tailwind, and code Playground

by neveldo

HTML

<script src="https://cdn.rawgit.com/DmitryBaranovskiy/raphael/v2.1.4/raphael-min.js"></script>
<script src="https://cdn.rawgit.com/neveldo/jQuery-Mapael/1.1.0/js/jquery.mapael.js"></script>
<script src="https://cdn.rawgit.com/neveldo/jQuery-Mapael/1.1.0/js/maps/usa_states.js"></script>
<div class="container">
	<h1>Map with a legend where slices are specified with a fixed value instead of min and max values</h1>
		<div class="mapcontainer">
			<div class="map">
				<span>Alternative content for the map</span>
			</div>
            <div class="plotLegend">	<span>Alternative content for the legend</span>
    
            </div>
            
		</div>
</div>

CSS

.mapTooltip {
			position : fixed;
			background-color : #fff;
			moz-opacity:0.70;
			opacity: 0.70;
			filter:alpha(opacity=70);
			border-radius:10px;
			padding : 10px;
			z-index: 1000;
			max-width: 200px;
			display:none;
			color:#343434;
		}

        .container {
            max-width: 800px;
            margin:auto;
        }

		body {
			font-family:Helvetica,Arial,sans-serif;
		}
	
		h1 {
			color:#5d5d5d;
			font-size:30px;
		}

JavaScript

$(function(){
 	$(".mapcontainer").mapael({
		map : {
			name : "usa_states"
		},
        legend: {
            plot: {
                title: "American cities",
                slices: [{
                    size: 30,
                    attrs: {
                        fill: "#26c800"
                    },
                    label: "Value 1",
                    sliceValue: "Value 1"
                }, {
                    size: 30,
                    attrs: {
                        fill: "#0088c8"
                    },
                    label: "Value 2",
                    sliceValue: "Value 2"
                }, {
                    size: 30,
                    attrs: {
                        fill: "#e9e100"
                    },
                    label: "Value 3",
                    sliceValue: "Value 3"
                }]
            }
        },
		plots: {
			'ny' : {
				latitude: 40.717079,
				longitude: -74.00116,
				tooltip: {content : "New York"},
                value: "Value 3"
			},
			'an' : {
				latitude: 61.2108398, 
				longitude: -149.9019557,
				tooltip: {content : "Anchorage"},
                value: "Value 3"
			},
			'sf' : {
				latitude: 37.792032,
				longitude: -122.394613,
				tooltip: {content : "San Francisco"},
                value: "Value 1"
			},
			'pa' : {
				latitude: 19.493204,
				longitude: -154.8199569,
				tooltip: {content : "Pahoa"},
                value: "Value 2"
			},
            'la' : {
				latitude: 34.025052,
				longitude: -118.192006,
				tooltip: {content : "Los Angeles"},
                value: "Value 3"
			},
            'dallas' : {
				latitude: 32.784881,
				longitude: -96.808244,
				tooltip: {content : "Dallas"},
                value: "Value 2"
			},
            'miami' : {
				latitude: 25.789125,
				longitude:  -80.205674,
				tooltip: {content : "Miami"},
                value: "Value 3"
			},
            'washington' : {
				latitude: 38.905761,
				longitude: ...