Built with blockbuilder.org
Built with blockbuilder.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(leaflet) | |
library(htmlwidgets) | |
library(webshot) | |
customPalette <- colorFactor(c("red", "red", "navy", "#00274c"), domain = dataset$OwnerType) | |
m <- leaflet(data = dataset) %>% | |
setView(-85.5, 42.3, zoom = 6) %>% | |
addProviderTiles("CartoDB.Positron") %>% | |
addCircleMarkers(~Longitude, ~Latitude, radius = ~ifelse(OwnerType == "Private", 1, 3), color = ~customPalette(OwnerType), stroke = FALSE, fillOpacity = 0.8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
double #map required for map to appear in FF,Edge,IE (and I have no idea why) | |
final map should appear as fixed 60% width | |
fixed for scrolling story pane | |
top 55px because it covers up the Export button in DevTools... | |
*/ | |
#map { | |
position:absolute; | |
top:20px; | |
bottom:0; |
Sample Power BI bar chart custom visual adapted from https://bl.ocks.org/mbostock/3885304
- Follow the instructions at https://github.com/Microsoft/PowerBI-visuals-docs to install the Power BI Custom Visual CLI Tool
- Follow the steps on the same site to create a new visual and install the typings for D3
- Copy and paste the code from this gist's "visual.ts" into "src/visual.ts"
- Copy and paste the code from this gist's "visual.less" into "style/visual.less"
- Start the visual in CLI and view it using the Developer Visual in Power BI service
Adapting a visual like this from a static D3 example is not a simple matter of copying and pasting. If you look through the original D3 example and compare it with the Power BI version, you will see some changes where the original was split between constructor() and update(). The original D3 also only used enter(), but for a dynamic visual in Power BI, code for transition() and exit() were also added. Some other tweaks were needed to get it working decently
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bing.sentiment <- syuzhet::get_sentiment(as.vector(dataset$Text), method="bing") | |
afinn.sentiment <- syuzhet::get_sentiment(as.vector(dataset$Text), method="afinn") | |
nrc.sentiment <- syuzhet::get_sentiment(as.vector(dataset$Text), method="nrc") | |
raw <- cbind(bing.sentiment, afinn.sentiment, nrc.sentiment) | |
scaled <- scale(raw, center=TRUE) | |
colnames(scaled) <- c("bing.scaled", "afinn.scaled", "nrc.scaled") | |
sentiment.output <- cbind(dataset, raw, scaled) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Single measure version | |
% of Total = DIVIDE(SUM('Sales'[Revenue]), CALCULATE(SUM('Sales'[Revenue]), ALLSELECTED('Product'[Category]))) | |
//As traced in Power BI Quick Calc "% of Grand Total" | |
EVALUATE | |
TOPN( | |
1001, | |
SUMMARIZECOLUMNS( | |
'Product'[Category], | |
"M0", CALCULATE( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
FilePath = "[replace with folder path]\tabula-lexiconnoex0315.csv", | |
Source = Csv.Document(File.Contents(FilePath),[Delimiter=",", Columns=6, Encoding=1252, QuoteStyle=QuoteStyle.Csv]), | |
#"Removed Top Rows" = Table.Skip(Source,1), | |
#"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]), | |
#"Filtered Rows" = Table.SelectRows(#"Promoted Headers", each ([#"Major #(cr)category"] <> "ATUS 2003-2015 Activity coding lexicon" and [#"Major #(cr)category"] <> "Major #(cr)category")), | |
#"Replaced Value" = Table.ReplaceValue(#"Filtered Rows","",null,Replacer.ReplaceValue,{"Major #(cr)category", "First and #(cr)second-tier #(cr)categories"}), | |
#"Filled Down" = Table.FillDown(#"Replaced Value",{"Major #(cr)category", "First and #(cr)second-tier #(cr)categories"}), | |
#"Filtered Rows1" = Table.SelectRows(#"Filled Down", each ([#"6-digit #(cr)activity #(cr)code"] <> "")), | |
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows1",{"", "_1"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Login-AzureRmAccount | |
$containerPrefix = <<string containing prefix to search. wildcard character not needed after prefix.>> | |
$storageContext = New-AzureStorageContext -ConnectionString <<connection string to storage account>> | |
Get-AzureStorageContainer -context $storageContext -prefix $containerPrefix | ForEach-Object {Remove-AzureStorageContainer -context $storageContext -Container $_.Name -Force} |
OlderNewer