Skip to content

Instantly share code, notes, and snippets.

View cvazquezlos's full-sized avatar
🎯
Focusing

Carlos Vázquez Losada cvazquezlos

🎯
Focusing
View GitHub Profile
@cvazquezlos
cvazquezlos / logback.xml
Created October 4, 2017 12:13 — forked from kyungw00k/logback.xml
logback & logstash pattern for elasticsearch
<?xml version="1.0" encoding="UTF-8"?>
<!-- For assistance related to logback-translator or configurations -->
<!-- files in general, please contact the logback user mailing list -->
<!-- at http://www.qos.ch/mailman/listinfo/logback-user -->
<!-- -->
<!-- For professional support please see -->
<!-- http://www.qos.ch/shop/products/professionalSupport -->
<!-- -->
<configuration>
@cvazquezlos
cvazquezlos / codemirror.css
Last active November 18, 2017 09:22
ng2-codemirror CDN.
/* BASICS */
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
color: black;
direction: ltr;
}
@cvazquezlos
cvazquezlos / Makefile
Created February 13, 2018 10:02 — forked from peterlozano/Makefile
Spain map.
all: es.json
es.json: subunits.json places.json provinces.json
topojson \
-o es.json \
--id-property SU_A3 \
--properties name=NAME \
-- \
subunits.json \
provinces.json \
@cvazquezlos
cvazquezlos / README.md
Created June 5, 2018 11:00 — forked from gisminister/README.md
Markercluster pie charts

The map shows traffic accidents recorded in Oslo, Norway, for the year 2013.

The Leaflet Markercluster plugin is wonderful. Since the markerclusters are divIcons you can put whatever you want inside them using the iconCreateFunction. I wanted my clusters to reveal more information than just the marker count and figured a pie chart would do the job. So I told the iconCreateFunction to do some D3 magic and this is the result.

The example is a bit more complicated than necessary due to how my dataset is structured. But if you take a look at the defineClusterIcon() function you'll see that I use d3.nest() to build a dataset for the pie chart based on a given property from all the cluster's children. Then I pass this dataset over to the bakeThePie() function together with instructions on how to style the chart. The function returns svg markup which in turn is placed inside the divIcon.

Feel free to suggest improvements.