Skip to content

Commit

Permalink
threshold-label
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeGordon83 authored and Max Bladen-Clark committed Jul 26, 2023
1 parent 63e2bc8 commit 40b84d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions server/src/js/components/line-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function LineChart (containerId, stationId, data, options = {}) {
.attr('class', 'threshold__remove')
.attr('tabindex', 0)
.attr('data-threshold-remove', '')
.attr('aria-label', 'Remove threshold (Visual only)')
.attr('aria-label', `Remove ${threshold.level}m threshold (Visual only)`)
.attr('aria-controls', `${containerId}-visualisation`)
.attr('transform', 'translate(20,0)')
remove.append('circle').attr('class', 'threshold__remove-bg').attr('r', 16).attr('x1', -5).attr('y1', -5)
Expand Down Expand Up @@ -449,8 +449,7 @@ function LineChart (containerId, stationId, data, options = {}) {
//

const defaults = {
btnAddThresholdClass: 'defra-button-text-s',
btnAddThresholdText: 'Show on chart <span class="govuk-visually-hidden">(Visual only)</span>'
btnAddThresholdClass: 'defra-button-text-s'
}
options = Object.assign({}, defaults, options)

Expand Down Expand Up @@ -514,7 +513,7 @@ function LineChart (containerId, stationId, data, options = {}) {
document.querySelectorAll('[data-threshold-add]').forEach(container => {
const button = document.createElement('button')
button.className = options.btnAddThresholdClass
button.innerHTML = options.btnAddThresholdText
button.innerHTML = `Show<span class="govuk-visually-hidden"> ${container.getAttribute('data-level')}m threshold</span> on chart <span class="govuk-visually-hidden">(Visual only)</span>`
button.setAttribute('aria-controls', `${containerId}-visualisation`)
button.setAttribute('data-id', container.getAttribute('data-id'))
button.setAttribute('data-threshold-add', '')
Expand Down
2 changes: 1 addition & 1 deletion server/views/rainfall-station.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h2 class="govuk-heading-s govuk-!-margin-bottom-0">
<div class="govuk-grid-column-full">
<h2 class="govuk-heading-s govuk-!-margin-top-4 govuk-!-margin-bottom-4">Rainfall over the last 5 days in millimetres</h2>
<div id="bar-chart" class="defra-bar-chart"></div>
<a data-journey-click="Rainfall:Station data:Rainfall - Download csv" href="/rainfall-station-csv/{{model.stationId}}" class="defra-button-secondary defra-button-secondary--icon"><svg focusable="false" aria-hidden="true" width="14" height="20" viewBox="0 0 14 20"><path d="M1.929 9L7 14.071 12.071 9M7 14.071V1M1 18h12" fill="none" stroke="currentColor" stroke-width="2"/></svg>Download data CSV (12KB)</a>
<a data-journey-click="Rainfall:Station data:Rainfall - Download csv" href="/rainfall-station-csv/{{model.stationId}}" class="defra-button-secondary defra-button-secondary--icon govuk-!-margin-bottom-4"><svg focusable="false" aria-hidden="true" width="14" height="20" viewBox="0 0 14 20"><path d="M1.929 9L7 14.071 12.071 9M7 14.071V1M1 18h12" fill="none" stroke="currentColor" stroke-width="2"/></svg>Download data CSV (12KB)</a>
</div>
</div>
{% endif %}
Expand Down

0 comments on commit 40b84d0

Please sign in to comment.