Skip to content

Commit

Permalink
Updated the charts to better align with councildown
Browse files Browse the repository at this point in the history
  • Loading branch information
EBrown-nycc committed Sep 12, 2024
1 parent 7682f3d commit d25f47f
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 9 deletions.
62 changes: 61 additions & 1 deletion code/get_avg_monthly_delay_time.r
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,70 @@ plotdata$month_char <- factor(plotdata$month_char, levels = c("Sep", "Oct", "Nov
plotdata <- plotdata %>%
filter(!is.na(month_char))

nycc_thm <- hc_theme(
chart = list(
style = list(
fontFamily = "Georgia" # Set font to Georgia
)
),
colors = c("#660000","#1850b5","#ba9f64","#1f3a70","#b3b3ff","#af6d46","#666666"),
title = list(
style = list(
color = "#222222", # Set title color to black
fontFamily = "Georgia"
)
),
subtitle = list(
style = list(
color = "#666666", # Set subtitle color to dark grey
fontFamily = "Georgia"
)
),
caption = list(
style = list(
color = "#666666", # Set subtitle color to dark grey
fontFamily = "Georgia"
)
),
xAxis = list(
labels = list(
style = list(
color = "#666666", # Set xAxis label color to dark grey
fontFamily = "Georgia"
)
),
title = list(
style = list(
color = "#666666", # Set xAxis title color to dark grey
fontFamily = "Georgia"
)
)
),
yAxis = list(
labels = list(
style = list(
color = "#666666", # Set yAxis label color to dark grey
fontFamily = "Georgia"
)
),
title = list(
style = list(
color = "#666666", # Set yAxis title color to dark grey
fontFamily = "Georgia"
)
)
),
legend = list(
itemStyle = list(
fontFamily = "Georgia"
)
)
)

# Generate the Highcharter plot
h <- highchart() %>%
hc_xAxis(categories = plotdata$month_char, title = list(text = "School Year Calendar Months")) %>%
hc_yAxis(title = list(text = "Average Delay Time (minutes)"))
hc_yAxis(title = list(text = "Average Delay Time (minutes)")) %>% hc_add_theme(nycc_thm)

current_date <- Sys.Date()
current_time <- format(Sys.time(), "%H:%M:%S")
Expand Down
66 changes: 64 additions & 2 deletions code/get_num_monthly_delays.r
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,70 @@ plotdata$month_char <- factor(plotdata$month_char, levels = c("Sep", "Oct", "Nov
plotdata <- plotdata %>%
filter(!is.na(month_char))

nycc_thm <- hc_theme(
chart = list(
style = list(
fontFamily = "Georgia" # Set font to Georgia
)
),
colors = c("#660000","#1850b5","#ba9f64","#1f3a70","#b3b3ff","#af6d46","#666666"),
title = list(
style = list(
color = "#222222", # Set title color to black
fontFamily = "Georgia"
)
),
subtitle = list(
style = list(
color = "#666666", # Set subtitle color to dark grey
fontFamily = "Georgia"
)
),
caption = list(
style = list(
color = "#666666", # Set subtitle color to dark grey
fontFamily = "Georgia"
)
),
xAxis = list(
labels = list(
style = list(
color = "#666666", # Set xAxis label color to dark grey
fontFamily = "Georgia"
)
),
title = list(
style = list(
color = "#666666", # Set xAxis title color to dark grey
fontFamily = "Georgia"
)
)
),
yAxis = list(
labels = list(
style = list(
color = "#666666", # Set yAxis label color to dark grey
fontFamily = "Georgia"
)
),
title = list(
style = list(
color = "#666666", # Set yAxis title color to dark grey
fontFamily = "Georgia"
)
)
),
legend = list(
itemStyle = list(
fontFamily = "Georgia"
)
)
)

# Generate the Highcharter plot
h <- highchart() %>%
hc_xAxis(categories = plotdata$month_char, title = list(text = "School Year Calendar Months")) %>%
hc_yAxis(title = list(text = "Number of Delays"))
hc_yAxis(title = list(text = "Number of Delays")) %>% hc_add_theme(nycc_thm)

# Add series for each school year
for (sy in colnames(plotdata)[-1]) {
Expand All @@ -61,6 +121,7 @@ for (sy in colnames(plotdata)[-1]) {
current_date <- Sys.Date()
current_time <- format(Sys.time(), "%H:%M:%S")


h <- h %>% hc_title(text = "Number of Delays by Month") %>%
hc_caption(text = paste("Updated", current_date, "at", current_time))

Expand All @@ -82,4 +143,5 @@ h <- h %>%
)
)
)
saveWidget(h, '../visuals/num_monthly_delays.html', selfcontained = TRUE)

saveWidget(h, '../visuals/num_monthly_delays.html', selfcontained=TRUE)
6 changes: 3 additions & 3 deletions visuals/avg_monthly_delay_times.html
Original file line number Diff line number Diff line change
Expand Up @@ -3990,9 +3990,9 @@
</head>
<body style="background-color: white;">
<div id="htmlwidget_container">
<div class="highchart html-widget html-fill-item" id="htmlwidget-d7a8395cc4c707ced802" style="width:100%;height:500px;"></div>
<div class="highchart html-widget html-fill-item" id="htmlwidget-be78b896a4d1174b6449" style="width:100%;height:500px;"></div>
</div>
<script type="application/json" data-for="htmlwidget-d7a8395cc4c707ced802">{"x":{"hc_opts":{"chart":{"reflow":true},"title":{"text":"Average Monthly Delay Times"},"yAxis":{"title":{"text":"Average Delay Time (minutes)"}},"credits":{"enabled":false},"exporting":{"enabled":true,"buttons":{"contextButton":{"menuItems":[{"text":"Download PNG","onclick":"function () { this.exportChart(); }"},{"text":"Download CSV","onclick":"function () { this.downloadCSV(); }"}]}}},"boost":{"enabled":false},"plotOptions":{"series":{"label":{"enabled":false},"turboThreshold":0},"treemap":{"layoutAlgorithm":"squarified"}},"xAxis":{"categories":["Sep","Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun"],"title":{"text":"School Year Calendar Months"}},"series":[{"name":"2017-2018","data":[29,26,26,25,28,27,28,29,31,31]},{"name":"2018-2019","data":[32,35,34,35,36,35,36,32,32,32]},{"name":"2019-2020","data":[33,32,32,31,31,29,29,null,null,null]},{"name":"2021-2022","data":[31,37,34,32,32,31,31,32,33,32]},{"name":"2022-2023","data":[37,41,41,41,41,41,36,36,37,35]},{"name":"2023-2024","data":[37,35,34,33,33,34,34,38,37,39]}],"caption":{"text":"Updated 2024-08-29 at 19:56:42"}},"theme":{"chart":{"backgroundColor":"transparent"},"colors":["#7cb5ec","#434348","#90ed7d","#f7a35c","#8085e9","#f15c80","#e4d354","#2b908f","#f45b5b","#91e8e1"]},"conf_opts":{"global":{"Date":null,"VMLRadialGradientURL":"http =//code.highcharts.com/list(version)/gfx/vml-radial-gradient.png","canvasToolsURL":"http =//code.highcharts.com/list(version)/modules/canvas-tools.js","getTimezoneOffset":null,"timezoneOffset":0,"useUTC":true},"lang":{"contextButtonTitle":"Chart context menu","decimalPoint":".","downloadCSV":"Download CSV","downloadJPEG":"Download JPEG image","downloadPDF":"Download PDF document","downloadPNG":"Download PNG image","downloadSVG":"Download SVG vector image","downloadXLS":"Download XLS","drillUpText":"◁ Back to {series.name}","exitFullscreen":"Exit from full screen","exportData":{"annotationHeader":"Annotations","categoryDatetimeHeader":"DateTime","categoryHeader":"Category"},"hideData":"Hide data table","invalidDate":null,"loading":"Loading...","months":["January","February","March","April","May","June","July","August","September","October","November","December"],"noData":"No data to display","numericSymbolMagnitude":1000,"numericSymbols":["k","M","G","T","P","E"],"printChart":"Print chart","resetZoom":"Reset zoom","resetZoomTitle":"Reset zoom level 1:1","shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"shortWeekdays":["Sat","Sun","Mon","Tue","Wed","Thu","Fri"],"thousandsSep":" ","viewData":"View data table","viewFullscreen":"View in full screen","weekdays":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]}},"type":"chart","fonts":[],"debug":false},"evals":["hc_opts.exporting.buttons.contextButton.menuItems.0.onclick","hc_opts.exporting.buttons.contextButton.menuItems.1.onclick"],"jsHooks":[]}</script>
<script type="application/htmlwidget-sizing" data-for="htmlwidget-d7a8395cc4c707ced802">{"viewer":{"width":"100%","height":350,"padding":0,"fill":true},"browser":{"width":"100%","height":500,"padding":0,"fill":true}}</script>
<script type="application/json" data-for="htmlwidget-be78b896a4d1174b6449">{"x":{"hc_opts":{"chart":{"reflow":true},"title":{"text":"Average Monthly Delay Times"},"yAxis":{"title":{"text":"Average Delay Time (minutes)"}},"credits":{"enabled":false},"exporting":{"enabled":true,"buttons":{"contextButton":{"menuItems":[{"text":"Download PNG","onclick":"function () { this.exportChart(); }"},{"text":"Download CSV","onclick":"function () { this.downloadCSV(); }"}]}}},"boost":{"enabled":false},"plotOptions":{"series":{"label":{"enabled":false},"turboThreshold":0},"treemap":{"layoutAlgorithm":"squarified"}},"xAxis":{"categories":["Sep","Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun"],"title":{"text":"School Year Calendar Months"}},"series":[{"name":"2017-2018","data":[29,26,26,25,28,27,28,29,31,31]},{"name":"2018-2019","data":[32,35,34,35,36,35,36,32,32,32]},{"name":"2019-2020","data":[33,32,32,31,31,29,29,null,null,null]},{"name":"2021-2022","data":[31,37,34,32,32,31,31,32,33,32]},{"name":"2022-2023","data":[37,41,41,41,41,41,36,36,37,35]},{"name":"2023-2024","data":[37,35,34,33,33,34,34,38,37,39]}],"caption":{"text":"Updated 2024-09-12 at 19:39:42"}},"theme":{"chart":{"style":{"fontFamily":"Georgia"}},"colors":["#660000","#1850b5","#ba9f64","#1f3a70","#b3b3ff","#af6d46","#666666"],"title":{"style":{"color":"#222222","fontFamily":"Georgia"}},"subtitle":{"style":{"color":"#666666","fontFamily":"Georgia"}},"caption":{"style":{"color":"#666666","fontFamily":"Georgia"}},"xAxis":{"labels":{"style":{"color":"#666666","fontFamily":"Georgia"}},"title":{"style":{"color":"#666666","fontFamily":"Georgia"}}},"yAxis":{"labels":{"style":{"color":"#666666","fontFamily":"Georgia"}},"title":{"style":{"color":"#666666","fontFamily":"Georgia"}}},"legend":{"itemStyle":{"fontFamily":"Georgia"}}},"conf_opts":{"global":{"Date":null,"VMLRadialGradientURL":"http =//code.highcharts.com/list(version)/gfx/vml-radial-gradient.png","canvasToolsURL":"http =//code.highcharts.com/list(version)/modules/canvas-tools.js","getTimezoneOffset":null,"timezoneOffset":0,"useUTC":true},"lang":{"contextButtonTitle":"Chart context menu","decimalPoint":".","downloadCSV":"Download CSV","downloadJPEG":"Download JPEG image","downloadPDF":"Download PDF document","downloadPNG":"Download PNG image","downloadSVG":"Download SVG vector image","downloadXLS":"Download XLS","drillUpText":"◁ Back to {series.name}","exitFullscreen":"Exit from full screen","exportData":{"annotationHeader":"Annotations","categoryDatetimeHeader":"DateTime","categoryHeader":"Category"},"hideData":"Hide data table","invalidDate":null,"loading":"Loading...","months":["January","February","March","April","May","June","July","August","September","October","November","December"],"noData":"No data to display","numericSymbolMagnitude":1000,"numericSymbols":["k","M","G","T","P","E"],"printChart":"Print chart","resetZoom":"Reset zoom","resetZoomTitle":"Reset zoom level 1:1","shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"shortWeekdays":["Sat","Sun","Mon","Tue","Wed","Thu","Fri"],"thousandsSep":" ","viewData":"View data table","viewFullscreen":"View in full screen","weekdays":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]}},"type":"chart","fonts":"Georgia","debug":false},"evals":["hc_opts.exporting.buttons.contextButton.menuItems.0.onclick","hc_opts.exporting.buttons.contextButton.menuItems.1.onclick"],"jsHooks":[]}</script>
<script type="application/htmlwidget-sizing" data-for="htmlwidget-be78b896a4d1174b6449">{"viewer":{"width":"100%","height":350,"padding":0,"fill":true},"browser":{"width":"100%","height":500,"padding":0,"fill":true}}</script>
</body>
</html>
6 changes: 3 additions & 3 deletions visuals/num_monthly_delays.html
Original file line number Diff line number Diff line change
Expand Up @@ -3990,9 +3990,9 @@
</head>
<body style="background-color: white;">
<div id="htmlwidget_container">
<div class="highchart html-widget html-fill-item" id="htmlwidget-83dc197332f697d38477" style="width:100%;height:500px;"></div>
<div class="highchart html-widget html-fill-item" id="htmlwidget-aea3a39945e9256dd7dd" style="width:100%;height:500px;"></div>
</div>
<script type="application/json" data-for="htmlwidget-83dc197332f697d38477">{"x":{"hc_opts":{"chart":{"reflow":true},"title":{"text":"Number of Delays by Month"},"yAxis":{"title":{"text":"Number of Delays"}},"credits":{"enabled":false},"exporting":{"enabled":true,"buttons":{"contextButton":{"menuItems":[{"text":"Download PNG","onclick":"function () { this.exportChart(); }"},{"text":"Download CSV","onclick":"function () { this.downloadCSV(); }"}]}}},"boost":{"enabled":false},"plotOptions":{"series":{"label":{"enabled":false},"turboThreshold":0},"treemap":{"layoutAlgorithm":"squarified"}},"xAxis":{"categories":["Sep","Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun"],"title":{"text":"School Year Calendar Months"}},"series":[{"name":"2017-2018","data":[7239,10844,7680,7509,9757,6870,9354,8481,11269,5708]},{"name":"2018-2019","data":[9492,13671,12041,9874,12527,9700,12145,8714,12285,7083]},{"name":"2019-2020","data":[9981,13258,10715,9022,9550,7850,4428,null,null,null]},{"name":"2021-2022","data":[4191,10592,6946,5695,6187,5942,7458,5798,8199,4825]},{"name":"2022-2023","data":[9772,14460,11619,8297,9620,8136,10665,5618,10760,4734]},{"name":"2023-2024","data":[9063,11363,8909,8583,10517,7857,8452,4859,8182,2347]}],"caption":{"text":"Updated 2024-08-29 at 19:56:34"}},"theme":{"chart":{"backgroundColor":"transparent"},"colors":["#7cb5ec","#434348","#90ed7d","#f7a35c","#8085e9","#f15c80","#e4d354","#2b908f","#f45b5b","#91e8e1"]},"conf_opts":{"global":{"Date":null,"VMLRadialGradientURL":"http =//code.highcharts.com/list(version)/gfx/vml-radial-gradient.png","canvasToolsURL":"http =//code.highcharts.com/list(version)/modules/canvas-tools.js","getTimezoneOffset":null,"timezoneOffset":0,"useUTC":true},"lang":{"contextButtonTitle":"Chart context menu","decimalPoint":".","downloadCSV":"Download CSV","downloadJPEG":"Download JPEG image","downloadPDF":"Download PDF document","downloadPNG":"Download PNG image","downloadSVG":"Download SVG vector image","downloadXLS":"Download XLS","drillUpText":"◁ Back to {series.name}","exitFullscreen":"Exit from full screen","exportData":{"annotationHeader":"Annotations","categoryDatetimeHeader":"DateTime","categoryHeader":"Category"},"hideData":"Hide data table","invalidDate":null,"loading":"Loading...","months":["January","February","March","April","May","June","July","August","September","October","November","December"],"noData":"No data to display","numericSymbolMagnitude":1000,"numericSymbols":["k","M","G","T","P","E"],"printChart":"Print chart","resetZoom":"Reset zoom","resetZoomTitle":"Reset zoom level 1:1","shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"shortWeekdays":["Sat","Sun","Mon","Tue","Wed","Thu","Fri"],"thousandsSep":" ","viewData":"View data table","viewFullscreen":"View in full screen","weekdays":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]}},"type":"chart","fonts":[],"debug":false},"evals":["hc_opts.exporting.buttons.contextButton.menuItems.0.onclick","hc_opts.exporting.buttons.contextButton.menuItems.1.onclick"],"jsHooks":[]}</script>
<script type="application/htmlwidget-sizing" data-for="htmlwidget-83dc197332f697d38477">{"viewer":{"width":"100%","height":350,"padding":0,"fill":true},"browser":{"width":"100%","height":500,"padding":0,"fill":true}}</script>
<script type="application/json" data-for="htmlwidget-aea3a39945e9256dd7dd">{"x":{"hc_opts":{"chart":{"reflow":true},"title":{"text":"Number of Delays by Month"},"yAxis":{"title":{"text":"Number of Delays"}},"credits":{"enabled":false},"exporting":{"enabled":true,"buttons":{"contextButton":{"menuItems":[{"text":"Download PNG","onclick":"function () { this.exportChart(); }"},{"text":"Download CSV","onclick":"function () { this.downloadCSV(); }"}]}}},"boost":{"enabled":false},"plotOptions":{"series":{"label":{"enabled":false},"turboThreshold":0},"treemap":{"layoutAlgorithm":"squarified"}},"xAxis":{"categories":["Sep","Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun"],"title":{"text":"School Year Calendar Months"}},"series":[{"name":"2017-2018","data":[7239,10844,7680,7509,9757,6870,9354,8481,11269,5708]},{"name":"2018-2019","data":[9492,13671,12041,9874,12527,9700,12145,8714,12285,7083]},{"name":"2019-2020","data":[9981,13258,10715,9022,9550,7850,4428,null,null,null]},{"name":"2021-2022","data":[4191,10592,6946,5695,6187,5942,7458,5798,8199,4825]},{"name":"2022-2023","data":[9772,14460,11619,8297,9620,8136,10665,5618,10760,4734]},{"name":"2023-2024","data":[9063,11363,8909,8583,10517,7857,8452,4859,8182,2347]}],"caption":{"text":"Updated 2024-09-12 at 19:38:27"}},"theme":{"chart":{"style":{"fontFamily":"Georgia"}},"colors":["#660000","#1850b5","#ba9f64","#1f3a70","#b3b3ff","#af6d46","#666666"],"title":{"style":{"color":"#222222","fontFamily":"Georgia"}},"subtitle":{"style":{"color":"#666666","fontFamily":"Georgia"}},"caption":{"style":{"color":"#666666","fontFamily":"Georgia"}},"xAxis":{"labels":{"style":{"color":"#666666","fontFamily":"Georgia"}},"title":{"style":{"color":"#666666","fontFamily":"Georgia"}}},"yAxis":{"labels":{"style":{"color":"#666666","fontFamily":"Georgia"}},"title":{"style":{"color":"#666666","fontFamily":"Georgia"}}},"legend":{"itemStyle":{"fontFamily":"Georgia"}}},"conf_opts":{"global":{"Date":null,"VMLRadialGradientURL":"http =//code.highcharts.com/list(version)/gfx/vml-radial-gradient.png","canvasToolsURL":"http =//code.highcharts.com/list(version)/modules/canvas-tools.js","getTimezoneOffset":null,"timezoneOffset":0,"useUTC":true},"lang":{"contextButtonTitle":"Chart context menu","decimalPoint":".","downloadCSV":"Download CSV","downloadJPEG":"Download JPEG image","downloadPDF":"Download PDF document","downloadPNG":"Download PNG image","downloadSVG":"Download SVG vector image","downloadXLS":"Download XLS","drillUpText":"◁ Back to {series.name}","exitFullscreen":"Exit from full screen","exportData":{"annotationHeader":"Annotations","categoryDatetimeHeader":"DateTime","categoryHeader":"Category"},"hideData":"Hide data table","invalidDate":null,"loading":"Loading...","months":["January","February","March","April","May","June","July","August","September","October","November","December"],"noData":"No data to display","numericSymbolMagnitude":1000,"numericSymbols":["k","M","G","T","P","E"],"printChart":"Print chart","resetZoom":"Reset zoom","resetZoomTitle":"Reset zoom level 1:1","shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"shortWeekdays":["Sat","Sun","Mon","Tue","Wed","Thu","Fri"],"thousandsSep":" ","viewData":"View data table","viewFullscreen":"View in full screen","weekdays":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]}},"type":"chart","fonts":"Georgia","debug":false},"evals":["hc_opts.exporting.buttons.contextButton.menuItems.0.onclick","hc_opts.exporting.buttons.contextButton.menuItems.1.onclick"],"jsHooks":[]}</script>
<script type="application/htmlwidget-sizing" data-for="htmlwidget-aea3a39945e9256dd7dd">{"viewer":{"width":"100%","height":350,"padding":0,"fill":true},"browser":{"width":"100%","height":500,"padding":0,"fill":true}}</script>
</body>
</html>

0 comments on commit d25f47f

Please sign in to comment.