Skip to content

Commit

Permalink
Updating packages
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveBathnes committed Aug 26, 2024
1 parent 3d95a43 commit 070a111
Show file tree
Hide file tree
Showing 5 changed files with 1,515 additions and 5,507 deletions.
42 changes: 17 additions & 25 deletions js/catalogue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
$(function () {
var renderAllWrapper = function () {
renderAllWrapper()
}
if (window.location.pathname.indexOf('catalogue') != -1) {
// Load in all the CSVs.
// These are the main grouping of catalogue data, and the lookups for branches and categories
Expand Down Expand Up @@ -103,10 +106,8 @@
return d
})
.html({
one:
'<small>Items</small><br/><span class="big colour1">%number</span>',
some:
'<small>Items</small><br/><span class="big colour1">%number</span>',
one: '<small>Items</small><br/><span class="big colour1">%number</span>',
some: '<small>Items</small><br/><span class="big colour1">%number</span>',
none: '<small>Items</small><br/><span class="big colour1">None</span>'
})
.group(itemsNumGroup)
Expand All @@ -123,12 +124,9 @@
return d
})
.html({
one:
'<small>Issues</small><br/><span class="big colour2">%number</span>',
some:
'<small>Issues</small><br/><span class="big colour2">%number</span>',
none:
'<small>Issues</small><br/><span class="big colour2">None</span>'
one: '<small>Issues</small><br/><span class="big colour2">%number</span>',
some: '<small>Issues</small><br/><span class="big colour2">%number</span>',
none: '<small>Issues</small><br/><span class="big colour2">None</span>'
})
.group(issuesNumGroup)

Expand All @@ -144,12 +142,9 @@
return d
})
.html({
one:
'<small>Renewals</small><br/><span class="big colour3">%number</span>',
some:
'<small>Renewals</small><br/><span class="big colour3">%number</span>',
none:
'<small>Renewals</small><br/><span class="big colour3">None</span>'
one: '<small>Renewals</small><br/><span class="big colour3">%number</span>',
some: '<small>Renewals</small><br/><span class="big colour3">%number</span>',
none: '<small>Renewals</small><br/><span class="big colour3">None</span>'
})
.group(renewalsNumGroup)

Expand All @@ -165,10 +160,8 @@
return d
})
.html({
one:
'<small>Cost</small><br/><span class="big colour4">£%number</span>',
some:
'<small>Cost</small><br/><span class="big colour4">£%number</span>',
one: '<small>Cost</small><br/><span class="big colour4">£%number</span>',
some: '<small>Cost</small><br/><span class="big colour4">£%number</span>',
none: '<small>Cost</small><br/><span class="big colour4">£0</span>'
})
.group(costNumGroup)
Expand All @@ -180,9 +173,8 @@
.html({
some:
'<strong>%filter-count</strong> selected out of <strong>%total-count</strong> records' +
" | <a href='javascript:dc.filterAll(); dc.renderAll();'>Reset All</a><br/> &nbsp",
all:
'All records selected. Please click on the graphs to filter the data.<br/> &nbsp'
" | <a href='javascript:dc.filterAll(); renderAllWrapper();'>Reset All</a><br/> &nbsp",
all: 'All records selected. Please click on the graphs to filter the data.<br/> &nbsp'
})

////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -345,7 +337,7 @@
})

// Startup: Render all the charts
dc.renderAll()
renderAllWrapper()

$('#loader').hide()

Expand All @@ -371,7 +363,7 @@
catalogueRowBranchChart.width(
document.getElementById('div-catalogue-branch').offsetWidth
)
dc.renderAll()
renderAllWrapper()
}
})
})
Expand Down
48 changes: 19 additions & 29 deletions js/members.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
$(function () {
var renderAllWrapper = function () {
renderAllWrapper()
}
if (window.location.pathname.indexOf('members') != -1) {
var parseDate = d3.timeParse('%d/%m/%y %H:%M:%S')
var parseDate2 = d3.timeParse('%d/%m/%Y %H:%M:%S')
Expand Down Expand Up @@ -51,12 +54,9 @@
return d
})
.html({
one:
'<small class="colour1">Members</small><br/><span class="big strong colour1">%number</span>',
some:
'<small class="colour1">Members</small><br/><span class="big strong colour1">%number</span>',
none:
'<small class="colour1">Members</small><br/><span class="big strong colour1">None</span>'
one: '<small class="colour1">Members</small><br/><span class="big strong colour1">%number</span>',
some: '<small class="colour1">Members</small><br/><span class="big strong colour1">%number</span>',
none: '<small class="colour1">Members</small><br/><span class="big strong colour1">None</span>'
})
.group(membersNumGroup)

Expand All @@ -73,12 +73,9 @@
return d
})
.html({
one:
'<small class="colour2">Libraries</small><br/><span class="big strong colour2">%number</span>',
some:
'<small class="colour2">Libraries</small><br/><span class="big strong colour2">%number</span>',
none:
'<small class="colour2">Libraries</small><br/><span class="big strong colour2">None</span>'
one: '<small class="colour2">Libraries</small><br/><span class="big strong colour2">%number</span>',
some: '<small class="colour2">Libraries</small><br/><span class="big strong colour2">%number</span>',
none: '<small class="colour2">Libraries</small><br/><span class="big strong colour2">None</span>'
})

branchesNumberDisplay.group({
Expand All @@ -105,12 +102,9 @@
return d
})
.html({
one:
'<small class="colour3">Postcode districts</small><br/><span class="big strong colour3">%number</span>',
some:
'<small class="colour3">Postcode districts</small><br/><span class="big strong colour3">%number</span>',
none:
'<small class="colour3">Postcode districts</small><br/><span class="big strong colour3">None</span>'
one: '<small class="colour3">Postcode districts</small><br/><span class="big strong colour3">%number</span>',
some: '<small class="colour3">Postcode districts</small><br/><span class="big strong colour3">%number</span>',
none: '<small class="colour3">Postcode districts</small><br/><span class="big strong colour3">None</span>'
})
postcodedistrictsNumberDisplay.group({
value: function () {
Expand Down Expand Up @@ -139,12 +133,9 @@
return daysFull[d]
})
.html({
none:
'<small class="colour4">Popular joining day</small><br/><span class="big strong colour4">%number</span>',
one:
'<small class="colour4">Popular joining day</small><br/><span class="big strong colour4">%number</span>',
some:
'<small class="colour4">Popular joining day</small><br/><span class="big strong colour4">%number</span>'
none: '<small class="colour4">Popular joining day</small><br/><span class="big strong colour4">%number</span>',
one: '<small class="colour4">Popular joining day</small><br/><span class="big strong colour4">%number</span>',
some: '<small class="colour4">Popular joining day</small><br/><span class="big strong colour4">%number</span>'
})

popularJoiningNumberDisplay.group({
Expand All @@ -168,9 +159,8 @@
.html({
some:
'<strong>%filter-count</strong> selected out of <strong>%total-count</strong> records' +
" | <a href='javascript:dc.filterAll(); dc.renderAll();'>Reset All</a><br/> &nbsp",
all:
'All records selected. Please click on the graphs to apply filters.<br/> &nbsp'
" | <a href='javascript:dc.filterAll(); renderAllWrapper();'>Reset All</a><br/> &nbsp",
all: 'All records selected. Please click on the graphs to apply filters.<br/> &nbsp'
})

var postcodedimension = membersNdx.dimension(function (d) {
Expand Down Expand Up @@ -357,7 +347,7 @@
return false
})

dc.renderAll()
renderAllWrapper()

// Bit of a hack. Search through the layer list and remove the tile layer
postcodesChoro.map().eachLayer(function (l) {
Expand Down Expand Up @@ -386,7 +376,7 @@
$('#div-members-hourjoined').width()
)
membersDayJoinedBarChart.width($('#div-members-dayjoined').width())
dc.renderAll()
renderAllWrapper()
}
})
}
Expand Down
60 changes: 22 additions & 38 deletions js/usage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
$(function () {
var renderAllWrapper = function () {
dc.renderAll()
}

var path = window.location.pathname

if (path == '/index.html' || path == '/') {
var parseDate = d3.timeParse('%Y-%m')

Expand Down Expand Up @@ -79,12 +84,9 @@
return d
})
.html({
one:
'<small>Issues</small><br/><span class="big strong colour1">%number</span>',
some:
'<small>Issues</small><br/><span class="big strong colour1">%number</span>',
none:
'<small>Issues</small><br/><span class="big strong colour1">None</span>'
one: '<small>Issues</small><br/><span class="big strong colour1">%number</span>',
some: '<small>Issues</small><br/><span class="big strong colour1">%number</span>',
none: '<small>Issues</small><br/><span class="big strong colour1">None</span>'
})
.group(issuesNumGroup)

Expand All @@ -100,12 +102,9 @@
return d
})
.html({
one:
'<small>Visits</small><br/><span class="big strong colour2">%number</span>',
some:
'<small>Visits</small><br/><span class="big strong colour2">%number</span>',
none:
'<small>Visits</small><br/><span class="big strong colour2">None</span>'
one: '<small>Visits</small><br/><span class="big strong colour2">%number</span>',
some: '<small>Visits</small><br/><span class="big strong colour2">%number</span>',
none: '<small>Visits</small><br/><span class="big strong colour2">None</span>'
})
.group(visitsNumGroup)

Expand All @@ -121,12 +120,9 @@
return d
})
.html({
one:
'<small>Enquiries</small><br/><span class="big strong colour3">%number</span>',
some:
'<small>Enquiries</small><br/><span class="big strong colour3">%number</span>',
none:
'<small>Enquiries</small><br/><span class="big strong colour3">None</span>'
one: '<small>Enquiries</small><br/><span class="big strong colour3">%number</span>',
some: '<small>Enquiries</small><br/><span class="big strong colour3">%number</span>',
none: '<small>Enquiries</small><br/><span class="big strong colour3">None</span>'
})
.group(enquiriesNumGroup)

Expand All @@ -142,12 +138,9 @@
return (d.total / d.count).toFixed(1)
})
.html({
one:
'<small>PC utilisation</small><br/><span class="big strong colour4">%number%</span>',
some:
'<small>PC utilisation</small><br/><span class="big strong colour4">%number%</span>',
none:
'<small>PC utilisation</small><br/><span class="big strong colour4">None</span>'
one: '<small>PC utilisation</small><br/><span class="big strong colour4">%number%</span>',
some: '<small>PC utilisation</small><br/><span class="big strong colour4">%number%</span>',
none: '<small>PC utilisation</small><br/><span class="big strong colour4">None</span>'
})
.group(pcNumGroup)

Expand All @@ -158,9 +151,8 @@
.html({
some:
'<strong>%filter-count</strong> selected out of <strong>%total-count</strong> usage records' +
" | <a href='javascript:dc.filterAll(); dc.renderAll();'>Reset All</a><br/> &nbsp",
all:
'All records selected. Please click on the graphs to apply filters.<br/> &nbsp'
" | <a href='javascript:dc.filterAll(); renderAllWrapper()'>Reset All</a><br/> &nbsp",
all: 'All records selected. Please click on the graphs to apply filters.<br/> &nbsp'
})

// Usage dimensions
Expand Down Expand Up @@ -612,15 +604,7 @@
.elasticX(true)
.elasticY(true)
.renderHorizontalGridLines(true)
.legend(
dc
.legend()
.x(0)
.y(0)
.horizontal(true)
.itemHeight(20)
.gap(15)
)
.legend(dc.legend().x(0).y(0).horizontal(true).itemHeight(20).gap(15))
.x(d3.scaleTime().domain([minDate, maxDate]))
.compose([
dc
Expand Down Expand Up @@ -660,7 +644,7 @@
})

// Startup: Render all the charts
dc.renderAll()
renderAllWrapper()

// Hide the loading spinner
$('#loader').hide()
Expand Down Expand Up @@ -692,7 +676,7 @@
pcBranchBarChart.width($('#div-pc-branch').width())
pcMonthRowChart.width($('#div-pc-month').width())

dc.renderAll()
renderAllWrapper()
}
})
})
Expand Down
Loading

0 comments on commit 070a111

Please sign in to comment.