<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/piximaps.min.css">
<script src="js/piximaps.min.js"></script>
<style>
#chart { width: 740px; height: 512px; box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.37); }
.pixi .charttitle .subtitle { font-size: 0.9em; font-style: italic; text-anchor: start }
</style>
<script>
window.addEventListener('load', () => {
'use strict';
// Select the DOM element displaying the event info:
const el = document.getElementById('event');
// Define the polygon overlay geometry:
const coord = [[[45.32215532151113,-0.7066030835640333],[45.32211331597668,-0.706414058661835],[45.32203641225064,-0.7060185512151236],[45.32358548458237,-0.6706975051857],[45.31935574816927,-0.6354313906461471],[45.31966336487238,-0.6267521909608718],[45.32224515209205,-0.618644280209395],[45.32694730057747,-0.6126677177410045],[45.332660191714524,-0.6083500905842243],[45.3386806995546,-0.604867424591987],[45.34405301473478,-0.5999345631295796],[45.34705228253674,-0.5922331459429415],[45.34648099270359,-0.5837297277447249],[45.339713414442514,-0.5747648835925645],[45.33279202782978,-0.5699638582454156],[45.32545316063485,-0.5671183996943228],[45.30576565925779,-0.5634269929613254],[45.29919583471997,-0.5567253323082468],[45.293878451929004,-0.545211660189949],[45.29049466279844,-0.5238871966368492],[45.290055209979926,-0.5101213271375116],[45.29087918412708,-0.4984428596502255],[45.28896756360217,-0.48516038834128494],[45.283331577090564,-0.4689335807202042],[45.267939730634055,-0.4406877305542878],[45.25829373366889,-0.4292180038077902],[45.24984524696052,-0.4222197125696425],[45.243055696463244,-0.42111009305637026],[45.22220364498219,-0.4238237163914107],[45.21519436672659,-0.4239006201175357],[45.20845974771916,-0.4231974950683366],[45.201736114829856,-0.4212858745434289],[45.19522122178196,-0.418396469721273],[45.18850857501073,-0.4141557471899091],[45.17325955078766,-0.4017741546535092],[45.1664919725265,-0.39428147910703615],[45.163855253816905,-0.3876237638256441],[45.16256985371578,-0.37769212239354033],[45.1672390429475,-0.35069871307507583],[45.16654690401643,-0.33911912334889394],[45.151144071441706,-0.307313701666061],[45.14913357315581,-0.2921525681864523],[45.143135038451305,-0.2778813273613707],[45.13709255747554,-0.26816941368747393],[45.12306301574557,-0.25075608282693906],[45.11750393385947,-0.23967087740908255],[45.112955593725616,-0.2263884061000283],[45.10114529012307,-0.17380783756163964],[45.10163967533077,-0.16029465327559933],[45.10437527090198,-0.14530930128324826],[45.11735012460855,-0.10381393816271611],[45.11899807470138,-0.08879562691663523],[45.1115053982555,-0.060846407335787944],[45.12011867943349,-0.033556367432368006],[45.12012966645091,0.03149368438599254],[45.108857693427865,0.0486103837621954],[45.08185329709198,0.06359573575463173],[45.063506129104525,0.06588089238931616],[45.01856105834614,0.03843704413421278],[45.01050807998385,0.036437531966555525],[44.9962697984125,0.0393818682786673],[44.99021633131861,0.03432815681895818],[44.982470969659545,0.02323196528294602],[44.97251735599113,0.013717804433127867],[44.96042140792164,0.00721389840265374],[44.94626003097562,0.005148468626998692],[44.93738307756692,0.010718536631173947],[44.91983791059113,0.030834504708593613],[44.91077418957721,0.030592804714160593],[44.861346697192346,-0.012693328933949033],[44.862983660267645,0.0006330868475004081],[44.857973894179906,0.006488800217965718],[44.85627101349641,0.010542755144030025],[44.843373063516,0.027978059140139067],[44.84027491885243,0.03107620380382059],[44.82667384472211,0.17446976396846026],[44.83185939139781,0.1931025773220938],[44.85761134598684,0.22377640635610874],[44.86761989114498,0.23990433621617058],[44.88129786990075,0.23304886721143703],[44.87922145400685,0.2511103916312436],[44.86761989114498,0.3048335380373146],[44.86566432434901,0.31021683933565214],[44.861148943468976,0.31533646840335905],[44.856633562588854,0.32216996427243316],[44.84399928483907,0.31127152645979095],[44.83371608133206,0.29648392819069613],[44.82734401051766,0.2799385177484339],[44.826487077116894,0.2637666425166003],[44.79007838381037,0.2744892988420986],[44.77460963362773,0.28305863464831305],[44.76233790407102,0.29740678009881094],[44.757514906487756,0.2847505292135679],[44.75660304069777,0.2730830487437004],[44.76018458445097,0.23944291116137606],[44.758481702868295,0.23236771529781208],[44.75373560901119,0.22746781218984324],[44.74499049171774,0.2250068749673062],[44.72741236638757,0.22401810545125045],[44.72015040291879,0.22111771451093887],[44.7147341432661,0.21384476492400495],[44.713767345986184,0.2004194713815366],[44.720875500204215,0.1902461317535824],[44.73087305924432,0.1811274792497386],[44.73860743478522,0.17086624797892114],[44.74006861637358,0.15862747767593532],[44.73724513005868,0.14344437196024273],[44.73143336206002,0.1289204459218638],[44.72391871337794,0.11870316002281811],[44.71033961148382,0.11041946868354557],[44.69648585124099,0.10841995651580305],[44.683598887378736,0.11320999574471102],[44.67293116254308,0.12533890216863597],[44.66392237301912,0.16563675593152993],[44.65563868167985,0.17455765471203222],[44.63743433502651,0.17016312292972202],[44.55706934227629,0.08187698703329715],[44.5508071344417,0.07212112708833729],[44.54981836492556,0.06232132177157723],[44.552927495707365,0.04135940731083565],[44.54914819913009,0.03325149655933046],[44.509114017597824,-0.006145477531731558],[44.49771020845938,-0.013835907700951111],[44.48526269831481,-0.017615204278229157],[44.47380395768647,-0.015011444822278008],[44.46757471000487,-0.00818893507124585],[44.45773095931625,0.007609405849450468],[44.448854005907634,0.011333770936801102],[44.43915307745252,0.009455108766275089],[44.42024560664947,-0.0003446956511083954],[44.41043481521447,-0.0011906429338068847],[44.399690185753485,0.003961944488168001],[44.39107690367612,0.011015167216157806],[44.38121118075139,0.015959015696012102],[44.366687254713014,0.014794464692812426],[44.369499754909754,-0.004827118176962131],[44.354360593666456,-0.07353561657541263],[44.34574731248847,-0.08535690629619808],[44.330915768847575,-0.07632614453592623],[44.30728417642359,-0.047970430490948957],[44.275863276069316,-0.03473190455378017],[44.25361596150745,-0.06637253086762485],[44.2265017021918,-0.14064011115218022],[44.264470453948235,-0.20321823873075573],[44.2581533146238,-0.21982956768036388],[44.211999748389644,-0.2236747827650163],[44.197959220541634,-0.23896775235988343],[44.20883568611799,-0.37987840216649715],[44.21740502192418,-0.3898539880710814],[44.23748803074804,-0.3963359218653295],[44.28026879396967,-0.3841191246978326],[44.288772212167885,-0.3905461270021533],[44.318830807795536,-0.4380619979628477],[44.33219018283063,-0.5031450081355615],[44.33910058332532,-0.5176799211913874],[44.34471459760056,-0.5217338761174517],[44.360798582088904,-0.526260243115729],[44.36615991115093,-0.5313469138289975],[44.39997583022031,-0.6099321212703899],[44.41225854499581,-0.6220170832218344],[44.43393457152328,-0.6274443289925671],[44.448601319795074,-0.6440556579422605],[44.451457765363585,-0.6805522410930109],[44.42299218833884,-0.8411503922767736],[44.44009790159686,-0.9219218794911512],[44.431023194464814,-0.9724260321356439],[44.4314626472833,-0.9894438546501192],[44.436439454117505,-1.0077580642832231],[44.48316431018472,-0.989388923160277],[44.50437890985876,-1.0002324294829918],[44.529768315355426,-1.0793999128756866],[44.523539066774475,-1.0858159290618516],[44.493535403536015,-1.144988294374258],[44.468215156789086,-1.251303275889967],[44.50454336100009,-1.2473038399999439],[44.519232489000075,-1.2497452459998613],[44.54755280200004,-1.2582901679998884],[44.55605703300006,-1.2572322259999282],[44.5835635440001,-1.2307836579999503],[44.5899112000001,-1.2268774079999503],[44.60199616100002,-1.2241918609998947],[44.64789459800011,-1.2062882149999155],[44.66547272300005,-1.1865128249999088],[44.666164455000086,-1.1614477199998987],[44.65534088700008,-1.100209113999881],[44.659125067000105,-1.0650121739999179],[44.66941966400012,-1.0447485019999192],[44.68463776200011,-1.044422980999883],[44.7031924500001,-1.069162563999953],[44.7031924500001,-1.0554906889999245],[44.71747467700001,-1.0652970039999445],[44.76813385600008,-1.1408585279998817],[44.771429755000014,-1.1517227859999366],[44.77342357000006,-1.15640214799987],[44.77651601800005,-1.1606339179998884],[44.77871328300003,-1.1653539699998987],[44.77826569200005,-1.1722305979999135],[44.775213934000135,-1.1765030589999128],[44.77090078300003,-1.1784561839998844],[44.76691315300005,-1.1797582669999542],[44.76520416900004,-1.1821182929999168],[44.755845445000034,-1.1885880199999121],[44.70685455900005,-1.233631964999887],[44.66274648600006,-1.2449438139999813],[44.638657945000034,-1.2538142569999309],[44.62742747600004,-1.2603653639999095],[45.120835679000066,-1.1994522779999102],[45.27912018400011,-1.1578669909999348],[45.49005768400011,-1.1399633449999556],[45.504828192000076,-1.1336970689999362],[45.5535342470001,-1.0995987619999141],[45.56903717700004,-1.0852758449999271],[45.573309637000136,-1.069162563999953],[45.569647528000075,-1.0585831369999141],[45.56513092700004,-1.0562231109999516],[45.55760325700007,-1.0567520819999174],[45.54633209800008,-1.0573624339998844],[45.543036200000046,-1.0601700509999432],[45.53774648600006,-1.0623266269999476],[45.532416083000015,-1.0623266269999476],[45.527044989000046,-1.0592341789998727],[45.51504140800003,-1.0486954419999108],[45.50726959800002,-1.0399470689999077],[45.47052643400011,-0.9729711579999218],[45.4538028020001,-0.9307755199998837],[45.450425523000064,-0.915272589999887],[45.35541413000007,-0.794178839999887],[45.32607656500005,-0.7661840489998895],[45.29588450700004,-0.7545059889998811],[45.27594635600005,-0.7519425119998857],[45.23871491100007,-0.7386775379999335],[45.14594147300005,-0.7200414699999556],[45.134507554000095,-0.7159724599999038],[45.0764834660001,-0.6821996739999179],[45.044907945000034,-0.6481827459998897],[45.018459377000056,-0.6098526679998599],[45.005072333000044,-0.577788865999878],[44.99799225500007,-0.5689591139999095],[44.98541901200008,-0.5606990229999269],[44.97614166900004,-0.5591934889998811],[44.960150458000044,-0.5620824859999232],[44.93927643400008,-0.5608617829998934],[44.91852448100008,-0.5565079419999108],[44.90228913000004,-0.5481664699999271],[44.89496491100002,-0.5346573559998546],[44.908758856000134,-0.5386449859999232],[44.937201239000046,-0.5423884759998714],[44.9495303410001,-0.5484513009999716],[44.97650788000004,-0.538970506999874],[44.99819570500003,-0.5503637359999232],[45.01430898600009,-0.5725805329998934],[45.02464427300001,-0.5961807929999168],[45.02358633000006,-0.565297003999973],[45.019517320000006,-0.5394180979999419],[45.01137929900008,-0.5164281889999813],[44.99799225500007,-0.4937638009999148],[45.029445705000086,-0.5189509759998998],[45.043443101000065,-0.5587458979998985],[45.05345286700006,-0.6021622389999379],[45.0730654970001,-0.6377660799998921],[45.09910716400009,-0.6559952459998897],[45.13080475500004,-0.668690558999856],[45.32215532151113,-0.7066030835640333]]];
// Set the map attributes:
const map = {
type: 'raster',
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
subdomains: ['a', 'b', 'c'],
zoom: 5,
coordinates: [46.766616, 2.431521],
};
// Define the chart options:
const opts = {
chart: {
width: window.innerWidth < (740 * 0.8) ? (window.innerWidth * 0.8) : 740,
height: window.innerHeight < 512 ? window.innerHeight : 512,
},
};
// Set the overlay attributes:
const zoi = [
{
'1': {
title: 'Tour Eiffel',
style: { fillColor: 'red' },
geometry: {
type: 'Point',
radius: 5,
coordinates: [48.858286, 2.294323],
},
properties: { latitude: '48°51\'29.6"N', longitude: '2°17\'40.5"E' },
},
},
{
'2': {
title: 'Gironde',
style: { fillColor: 'red', fillOpacity: 0.4, strokeColor: 'red', strokeWidth: 1 },
over: { fillOpacity: 0.5 },
geometry: {
type: 'Polygon',
coordinates: coord,
},
properties: { Population: '1,505,517', Area: '10,725 km²' },
},
},
];
// Fix the chart dimensions:
const el2 = document.getElementById('chart');
el2.style.width = opts.chart.width + 'px';
el2.style.height = opts.chart.height + 'px';
const el3 = document.getElementsByClassName('viewsource');
el3[0].style.width = opts.chart.width + 'px';
// Draw the chart:
const chart = Pixi.Map('#chart', map, opts);
chart.overlayAppend(zoi)
// Process the event 'overlayover':
chart
.on('overlayover', (data) => {
el.textContent = data.overlay.geometry.type + ': ' + data.overlay.title;
})
// Process the event 'overlayout':
.on('overlayout', () => {
el.textContent = '---';
})
;
});
</script>
</head>
<body>
<div id="chart" class="pixi"></div>
<div id="event"></div>
</body>
</html>