diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2023-05-11 18:54:10 +0100 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2023-05-11 18:54:10 +0100 |
commit | 469de094098c5cf149b9aeab9c2a7d23aa22c11d (patch) | |
tree | be9bd0e6c1a4bbfcc9fe878420dd7569deec0f77 /static/scripts.js | |
parent | b0f2c84d0ab4112040a4db49541eab504d1ec2c0 (diff) | |
download | UKGenderPayGap-469de094098c5cf149b9aeab9c2a7d23aa22c11d.tar.gz UKGenderPayGap-469de094098c5cf149b9aeab9c2a7d23aa22c11d.zip |
Finished filtering of new visualisation, started work on map char
Diffstat (limited to 'static/scripts.js')
-rw-r--r-- | static/scripts.js | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/static/scripts.js b/static/scripts.js index 4a71e79..2b1e47e 100644 --- a/static/scripts.js +++ b/static/scripts.js @@ -19,6 +19,16 @@ $(document).ready(function() { filterform.action = window.location.pathname + "/apply_click"; } + const slider = document.getElementById("yearslider"); + if (slider !== null) { + slider.onchange = function() { + fetch("/api/getyears").then(resp => { + resp.json().then(years => { + document.getElementById("slider_val").innerHTML = "Year range: " + years[Number(this.value) - 1]; + }); + }); + } + } fetch("/api/charts.json").then((resp) => { resp.json().then((body) => { @@ -188,6 +198,14 @@ function draw_plot_sic_sections(containerName, filters) { text: null }, + plotOptions: { + bar: { + dataLabels: { + align: "center" + } + } + }, + xAxis: { categories: categories, labels: { @@ -207,14 +225,21 @@ function draw_plot_sic_sections(containerName, filters) { }, labels: { format: '{value}%' - } + }, + plotLines: [{ + value: 0, + width: 2, + color: 'black', + zIndex: 10 + }] }, series: [{ data: pays, showInLegend: false, negativeColor: 'Red', - color: 'Green' + color: 'Green', + name: 'Pay Gap' }] }) }) |