Skip to content

Instantly share code, notes, and snippets.

@deldersveld
deldersveld / PowerBI-CustomHTMLTooltip
Last active August 7, 2024 07:01
Use this code in a Power BI calculated column to enhance the default tooltip in the ArcGIS Maps for Power BI visual
HTML Tooltip = "<img src='https://www.blue-granite.com/hs-fs/hub/257922/file-2333776730-png/IMG_2015/Blue-Granite-Logo.png' width='200px' /><br>" &
"<br>Reported: <em>" & Table1[OutageReported] & "</em>" &
"<br>Restoration Est: <em>" & Table1[RestorationEstimate] & "</em>" &
"<br><br><table bordercolor='#FFFFFF' cellspacing='8'><tr>" &
"<th style='color:#01B8AA;'>Customers Affected</th><th style='color:#01B8AA;'>Status</th></tr><tr>" &
"<td style='color:#" & IF(Table1[Number of Customers Affected] > 50,"DD0000","FFFFFF") & ";'>" & Table1[Number of Customers Affected] & "</td>" &
"<td>" & Table1[Status] & "</td></tr></table>"
@ColinEberhardt
ColinEberhardt / .block
Last active May 28, 2024 21:48
Health and Wealth of Nations - Bubble Chart
license: mit
@halhen
halhen / elevation.R
Last active November 4, 2020 16:11
# Download elevation tif from eg http://www.eea.europa.eu/data-and-maps/data/digital-elevation-model-of-europe
# First, convert elevation tif to a space delimited xyz (lng lat elevation) file
# $ gdal_translate -of XYZ elevation3x3.tif /tmp/file.xyz
df <- read_delim('/tmp/file.xyz', delim=' ', col_names=FALSE)
df %>%
mutate(X3 = na_if(X3, 0)) %>%
ggplot(aes(X1, -X2 + 20 * X3/max(X3, na.rm=TRUE), group=X2)) +
geom_line(size=0.05) +
Sparkline Line =
// Static line color - use %23 instead of # for Firefox compatibility
VAR LineColor = "%2301B8AA"
// "Date" field used in this example along the X axis
VAR XMinDate = MIN('Table'[Date])
VAR XMaxDate = MAX('Table'[Date])
// Obtain overall min and overall max measure values when evaluated for each date
# Code for quick exploration of
# https://github.com/rfordatascience/tidytuesday/tree/master/data/2020/2020-05-26
# Video at https://youtu.be/kHFmtKCI_F4
library(tidyverse)
cocktails <- readr::read_csv("boston_cocktails.csv")
# Are name and row_id equivalent? -----------------------------------------
library(geofacet)
library(ggplot2)
# original plot
ggplot(election, aes(candidate, votes / 1000000, fill = candidate)) +
geom_col() +
scale_fill_manual(values = c("#4e79a7", "#e15759", "#59a14f")) +
facet_geo(~ state, grid = "us_state_grid2") +
coord_flip() +
ylab("Votes (millions)")
---
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r message=FALSE, warning=FALSE}
library(tidyverse)
library(geofacet)
library(ggplot2)
# original plot
ggplot(election, aes(candidate, votes / 1000000, fill = candidate)) +
geom_col() +
scale_fill_manual(values = c("#4e79a7", "#e15759", "#59a14f")) +
facet_geo(~ state, grid = "us_state_grid2") +
coord_flip() +
ylab("Votes (millions)")
@dianaow
dianaow / index.html
Created September 12, 2020 04:27
Using deck.gl with Mapbox GL JS (Method 1): Deck canvas overlay
<html>
<head>
<title>deck.gl ScatterplotLayer Example</title>
<script src="https://d3js.org/d3.v5.min.js" type="text/javascript"></script>
<script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script>
<script src="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" />
<style type="text/css">
body {