Skip to content

Commit

Permalink
Additional SW fixes for clarity and grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
doprdele committed Jul 22, 2024
1 parent 2ae1f45 commit d84f048
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions assets/js/dss_plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ var financialYearColorsIdx = 0;
$(document).ready(function () {
dssOverview();
year_quarter();
timeSeriesCommunity();
patron_community();
timeSeriesCommunity();
patron_community();
request_type();
});



function colorMemo(financial_year) {
let c = financialYearColorsIdx;
let c = financialYearColorsIdx;
if (financialYearColorsCache[`${financial_year}`]) return financialYearColorsCache[`${financial_year}`];
if (c > iqss_color_pallette.length) financialYearColorsIdx = 0;
financialYearColorsCache[`${financial_year}`] = iqss_color_pallette[c];
financialYearColorsIdx = financialYearColorsIdx + 1;
return c;
}

function dssOverview() {
function dssOverview() {
d3.tsv(path + "overview.tsv", function (error, data) {
for (d of data) {
dssAddMetric(d, "dssOverview", "col-sm-6 col-xs-12 col-md-6 col-lg-4 col-xl-3")
Expand Down Expand Up @@ -75,7 +75,7 @@ function year_quarter() {
"value": "unique_tickets",
"label": "Number of Help requests"
})
.color((d) => { return colorMemo(d.financial_year) } )
.color((d) => { return colorMemo(d.financial_year) })
.font({
"family": fontFamily
})
Expand Down Expand Up @@ -114,7 +114,7 @@ function timeSeriesCommunity() {
"value": "cumulative_tickets",
"label": "Cumulative Requests"
})
.legend(true)
.legend({ labels: true, text: (d) => { return d.patron_community.substring(0, 3); } })
.font({
"family": fontFamily
})
Expand All @@ -133,17 +133,19 @@ function patron_community() {

const myNumData = data.map(d => ({
...d,
unique_tickets: parseInt(d.unique_tickets)
unique_tickets: parseInt(d.unique_tickets),
financialYearNumber: parseInt(d.financial_year.slice(2))
}));


const div = "helpRequestsByDepartment"

// Visualize
d3plus.viz()
.container("." + div)
.data(myNumData)
.type("bar")
.id(["financial_year","patron_community"])
.id(["financial_year", "patron_community"])
.y({
"value": "patron_community",
"scale": "discrete",
Expand All @@ -155,7 +157,7 @@ function patron_community() {
})
.order({
"sort": "desc",
"value": "financial_year",
"value": "financialYearNumber"
})
.color((d) => colorMemo(d.financial_year))
.font({
Expand Down

0 comments on commit d84f048

Please sign in to comment.