@ons/design-system 72.10.3 → 72.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/card/_card.scss +1 -0
- package/components/card/example-card-set-with-headline-figures.njk +4 -4
- package/components/chart/_chart.scss +2 -14
- package/components/chart/_macro.njk +34 -34
- package/components/chart/_macro.spec.js +0 -49
- package/components/chart/boxplot.js +3 -0
- package/components/chart/chart.js +18 -8
- package/components/chart/columnrange-chart.js +6 -0
- package/components/chart/common-chart-options.js +1 -13
- package/components/chart/example-bar-with-confidence-levels.njk +0 -5
- package/components/chart/example-column-with-confidence-levels.njk +1 -4
- package/components/chart/example-scatter-chart.njk +4 -8
- package/components/chart/specific-chart-options.js +42 -15
- package/components/description-list/_description-list.scss +7 -6
- package/components/description-list/_macro.njk +1 -1
- package/components/details-panel/_details-panel.scss +40 -20
- package/components/details-panel/_macro.njk +18 -12
- package/components/details-panel/example-details-panel.njk +1 -0
- package/components/featured-article/_macro.njk +76 -0
- package/components/featured-article/example-featured-article-with-chart.njk +223 -0
- package/components/featured-article/example-featured-article-with-image.njk +24 -0
- package/components/featured-article/featured-article.scss +33 -0
- package/components/featured-article/macro.spec.js +173 -0
- package/components/header/_header.scss +34 -1
- package/components/header/_macro.njk +140 -132
- package/components/header/_macro.spec.js +1 -1
- package/components/hero/_hero.scss +5 -0
- package/components/hero/_macro.njk +8 -4
- package/components/hero/example-hero-grey.njk +2 -17
- package/components/language-selector/_macro.spec.js +4 -3
- package/components/table/_macro.njk +83 -44
- package/components/table/_macro.spec.js +90 -0
- package/components/table/_table.scss +15 -3
- package/components/table/example-table-merge-cells.njk +139 -0
- package/css/main.css +1 -1
- package/css/print.css +1 -1
- package/js/details.js +39 -0
- package/js/main.js +1 -0
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/main.scss +1 -0
- package/scss/print.scss +6 -1
- package/scss/utilities/_grid.scss +46 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{% from "components/card/_macro.njk" import onsCard %}
|
|
2
2
|
|
|
3
3
|
<div class="ons-container">
|
|
4
|
-
<div class="ons-grid ons-grid-flex ons-grid-flex--vertical-top">
|
|
5
|
-
<div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch
|
|
4
|
+
<div class="ons-grid ons-grid-flex-gap ons-grid-flex-gap--s ons-grid-flex--vertical-top">
|
|
5
|
+
<div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch">
|
|
6
6
|
{{
|
|
7
7
|
onsCard({
|
|
8
8
|
"variant": 'feature',
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}}
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
|
-
<div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch
|
|
23
|
+
<div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch">
|
|
24
24
|
{{
|
|
25
25
|
onsCard({
|
|
26
26
|
"variant": 'feature',
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
}}
|
|
39
39
|
</div>
|
|
40
40
|
|
|
41
|
-
<div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch
|
|
41
|
+
<div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch">
|
|
42
42
|
{{
|
|
43
43
|
onsCard({
|
|
44
44
|
"variant": 'feature',
|
|
@@ -8,19 +8,7 @@
|
|
|
8
8
|
@extend .ons-u-fs-r--b;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
&__title {
|
|
12
|
-
font-size: 1.25rem;
|
|
13
|
-
line-height: 1.625rem;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&__subtitle {
|
|
17
|
-
font-size: 1rem;
|
|
18
|
-
line-height: 1.3rem;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
11
|
&__caption {
|
|
22
|
-
font-size: 1rem;
|
|
23
|
-
line-height: 1.2rem;
|
|
24
12
|
color: var(--ons-color-grey-75);
|
|
25
13
|
}
|
|
26
14
|
|
|
@@ -91,8 +79,8 @@
|
|
|
91
79
|
|
|
92
80
|
&-item {
|
|
93
81
|
&--uncertainty {
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
82
|
+
width: 12px;
|
|
83
|
+
height: 12px;
|
|
96
84
|
background-color: rgb(32 96 149 / 65%);
|
|
97
85
|
}
|
|
98
86
|
|
|
@@ -2,14 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
{% macro onsChart(params) %}
|
|
4
4
|
{% set supportedChartTypes = ['line', 'bar', 'column', 'scatter', 'area', 'columnrange', 'boxplot'] %}
|
|
5
|
-
{% set supportedChartTypesWithLine = ['column'
|
|
5
|
+
{% set supportedChartTypesWithLine = ['column'] %}
|
|
6
6
|
{% set supportedChartTypesWithScatter = ['columnrange'] %}
|
|
7
|
-
|
|
8
|
-
{% if params.headingLevel and params.headingLevel >= 1 and params.headingLevel <= 4 %}
|
|
9
|
-
{% set headingLevel = params.headingLevel %}
|
|
10
|
-
{% else %}
|
|
11
|
-
{% set headingLevel = 2 %}
|
|
12
|
-
{% endif %}
|
|
7
|
+
{% set headingLevel = params.headingLevel | default(2) %}
|
|
13
8
|
{% set openingTitleTag = "<h" ~ headingLevel %}
|
|
14
9
|
{% set closingTitleTag = "</h" ~ headingLevel ~ ">" %}
|
|
15
10
|
{% set openingSubtitleTag = "<h" ~ (headingLevel + 1) %}
|
|
@@ -53,8 +48,11 @@
|
|
|
53
48
|
>
|
|
54
49
|
<figure class="ons-chart">
|
|
55
50
|
{{ openingTitleTag | safe }} class="ons-chart__title">{{ params.title }}{{ closingTitleTag | safe }}
|
|
56
|
-
{
|
|
57
|
-
|
|
51
|
+
{% if params.subtitle %}
|
|
52
|
+
{{ openingSubtitleTag | safe }}
|
|
53
|
+
class="ons-chart__subtitle">{{ params.subtitle }}{{ closingSubtitleTag | safe }}
|
|
54
|
+
{% endif %}
|
|
55
|
+
|
|
58
56
|
{% if params.description %}
|
|
59
57
|
<p class="ons-u-vh">{{ params.description }}</p>
|
|
60
58
|
{% endif %}
|
|
@@ -83,28 +81,31 @@
|
|
|
83
81
|
Footnotes for the annotations at mobile
|
|
84
82
|
Hidden from screen readers because the full text will be read out where they appear in the chart
|
|
85
83
|
#}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
84
|
+
{% if params.annotations or params.rangeAnnotations or params.referenceLineAnnotations %}
|
|
85
|
+
<ul class="ons-chart__footnotes" aria-hidden="true">
|
|
86
|
+
{% for annotation in params.annotations %}
|
|
87
|
+
<li class="ons-chart__footnote_item">
|
|
88
|
+
<span class="ons-chart__footnote-number">{{ loop.index }}</span>
|
|
89
|
+
{{ annotation.text }}
|
|
90
|
+
</li>
|
|
91
|
+
{% endfor %}
|
|
92
|
+
{% for rangeAnnotation in params.rangeAnnotations %}
|
|
93
|
+
<li class="ons-chart__footnote_item">
|
|
94
|
+
<span class="ons-chart__footnote-number">{{ loop.index + params.annotations | length }}</span>
|
|
95
|
+
{{ rangeAnnotation.text }}
|
|
96
|
+
</li>
|
|
97
|
+
{% endfor %}
|
|
98
|
+
{% for referenceLineAnnotation in params.referenceLineAnnotations %}
|
|
99
|
+
<li class="ons-chart__footnote_item">
|
|
100
|
+
<span class="ons-chart__footnote-number"
|
|
101
|
+
>{{ loop.index + params.annotations | length + params.rangeAnnotations | length }}</span
|
|
102
|
+
>
|
|
103
|
+
{{ referenceLineAnnotation.text }}
|
|
104
|
+
</li>
|
|
105
|
+
{% endfor %}
|
|
106
|
+
</ul>
|
|
107
|
+
{% endif %}
|
|
108
|
+
|
|
108
109
|
{% if params.caption %}
|
|
109
110
|
<figcaption class="ons-chart__caption">{{ params.caption }}</figcaption>
|
|
110
111
|
{% endif %}
|
|
@@ -132,7 +133,7 @@
|
|
|
132
133
|
"name": item.name if item.name else '',
|
|
133
134
|
"data": item.data if item.data else [],
|
|
134
135
|
"marker": {
|
|
135
|
-
"enabled": item.
|
|
136
|
+
"enabled": true if (item.type == 'scatter' or params.chartType == 'scatter' or item.marker == true) else false
|
|
136
137
|
},
|
|
137
138
|
"dataLabels": {
|
|
138
139
|
"enabled": item.dataLabels if item.dataLabels else false
|
|
@@ -160,8 +161,7 @@
|
|
|
160
161
|
{%
|
|
161
162
|
set config = {
|
|
162
163
|
"chart": {
|
|
163
|
-
"type": params.chartType
|
|
164
|
-
"inverted": params.isChartInverted if params.isChartInverted == true else false
|
|
164
|
+
"type": params.chartType
|
|
165
165
|
},
|
|
166
166
|
"legend": {
|
|
167
167
|
"enabled" : legendValue
|
|
@@ -1132,55 +1132,6 @@ describe('Macro: Chart', () => {
|
|
|
1132
1132
|
expect(configScript).toContain('"type":"columnrange"');
|
|
1133
1133
|
expect(configScript).toContain('"type":"scatter"');
|
|
1134
1134
|
});
|
|
1135
|
-
|
|
1136
|
-
describe('GIVEN: Params: isChartInverted', () => {
|
|
1137
|
-
describe('WHEN: isChartInverted parameter is provided and set to true', () => {
|
|
1138
|
-
const $ = cheerio.load(
|
|
1139
|
-
renderComponent('chart', {
|
|
1140
|
-
...EXAMPLE_COLUMN_RANGE_CHART_PARAMS,
|
|
1141
|
-
isChartInverted: true,
|
|
1142
|
-
}),
|
|
1143
|
-
);
|
|
1144
|
-
test('THEN: it sets isChartInverted to true', () => {
|
|
1145
|
-
const configScript = $(`script[data-highcharts-config--uuid]`).html();
|
|
1146
|
-
expect(configScript).toContain('"chart":{"type":"columnrange","inverted":true}');
|
|
1147
|
-
});
|
|
1148
|
-
});
|
|
1149
|
-
|
|
1150
|
-
describe('WHEN: isChartInverted parameter is provided and set to false', () => {
|
|
1151
|
-
const $ = cheerio.load(
|
|
1152
|
-
renderComponent('chart', {
|
|
1153
|
-
...EXAMPLE_COLUMN_RANGE_CHART_PARAMS,
|
|
1154
|
-
isChartInverted: false,
|
|
1155
|
-
}),
|
|
1156
|
-
);
|
|
1157
|
-
test('THEN: it sets isChartInverted to false', () => {
|
|
1158
|
-
const configScript = $(`script[data-highcharts-config--uuid]`).html();
|
|
1159
|
-
expect(configScript).toContain('"chart":{"type":"columnrange","inverted":false}');
|
|
1160
|
-
});
|
|
1161
|
-
});
|
|
1162
|
-
|
|
1163
|
-
describe('WHEN: isChartInverted parameter is not provided', () => {
|
|
1164
|
-
const $ = cheerio.load(renderComponent('chart', EXAMPLE_COLUMN_RANGE_CHART_PARAMS));
|
|
1165
|
-
test('THEN: it sets isChartInverted to false', () => {
|
|
1166
|
-
const configScript = $(`script[data-highcharts-config--uuid]`).html();
|
|
1167
|
-
expect(configScript).toContain('"chart":{"type":"columnrange","inverted":false}');
|
|
1168
|
-
});
|
|
1169
|
-
});
|
|
1170
|
-
|
|
1171
|
-
describe('WHEN: isChartInverted parameter is provided but is not a boolean', () => {
|
|
1172
|
-
const $ = cheerio.load(
|
|
1173
|
-
renderComponent('chart', {
|
|
1174
|
-
...EXAMPLE_COLUMN_RANGE_CHART_PARAMS,
|
|
1175
|
-
isChartInverted: 'false',
|
|
1176
|
-
}),
|
|
1177
|
-
);
|
|
1178
|
-
test('THEN: it sets isChartInverted to false', () => {
|
|
1179
|
-
const configScript = $(`script[data-highcharts-config--uuid]`).html();
|
|
1180
|
-
expect(configScript).toContain('"chart":{"type":"columnrange","inverted":false}');
|
|
1181
|
-
});
|
|
1182
|
-
});
|
|
1183
|
-
});
|
|
1184
1135
|
});
|
|
1185
1136
|
});
|
|
1186
1137
|
});
|
|
@@ -62,14 +62,20 @@ class HighchartsBaseChart {
|
|
|
62
62
|
this.yAxisTickIntervalDesktop = this.node.dataset.highchartsYAxisTickIntervalDesktop
|
|
63
63
|
? parseInt(this.node.dataset.highchartsYAxisTickIntervalDesktop)
|
|
64
64
|
: undefined;
|
|
65
|
-
this.commonChartOptions = new CommonChartOptions(
|
|
65
|
+
this.commonChartOptions = new CommonChartOptions();
|
|
66
66
|
this.estimateLineLabel = this.node.dataset.highchartsEstimateLineLabel;
|
|
67
67
|
this.uncertainyRangeLabel = this.node.dataset.highchartsUncertaintyRangeLabel;
|
|
68
68
|
this.customReferenceLineValue = this.node.dataset.highchartsCustomReferenceLineValue
|
|
69
69
|
? parseFloat(this.node.dataset.highchartsCustomReferenceLineValue)
|
|
70
70
|
: undefined;
|
|
71
71
|
|
|
72
|
-
this.specificChartOptions = new SpecificChartOptions(
|
|
72
|
+
this.specificChartOptions = new SpecificChartOptions(
|
|
73
|
+
this.theme,
|
|
74
|
+
this.chartType,
|
|
75
|
+
this.config,
|
|
76
|
+
this.xAxisTickIntervalDesktop,
|
|
77
|
+
this.yAxisTickIntervalDesktop,
|
|
78
|
+
);
|
|
73
79
|
this.lineChart = new LineChart();
|
|
74
80
|
this.barChart = new BarChart();
|
|
75
81
|
this.columnChart = new ColumnChart();
|
|
@@ -259,25 +265,29 @@ class HighchartsBaseChart {
|
|
|
259
265
|
const currentChart = event.target;
|
|
260
266
|
if (this.chartType === 'line') {
|
|
261
267
|
this.lineChart.updateLastPointMarker(currentChart.series);
|
|
262
|
-
this.
|
|
268
|
+
this.specificChartOptions.hideDataLabels(currentChart.series);
|
|
263
269
|
}
|
|
264
270
|
if (this.chartType === 'bar') {
|
|
265
271
|
this.barChart.updateBarChartHeight(this.config, currentChart, this.useStackedLayout);
|
|
266
272
|
if (!this.hideDataLabels) {
|
|
267
273
|
this.barChart.postLoadDataLabels(currentChart);
|
|
268
274
|
} else {
|
|
269
|
-
this.
|
|
275
|
+
this.specificChartOptions.hideDataLabels(currentChart.series);
|
|
270
276
|
}
|
|
271
277
|
}
|
|
272
278
|
if (this.chartType === 'column') {
|
|
273
|
-
this.
|
|
279
|
+
this.specificChartOptions.hideDataLabels(currentChart.series);
|
|
274
280
|
}
|
|
275
281
|
if (this.chartType === 'scatter') {
|
|
276
282
|
this.scatterChart.updateMarkers(currentChart);
|
|
283
|
+
this.specificChartOptions.hideDataLabels(currentChart.series);
|
|
284
|
+
}
|
|
285
|
+
if (this.chartType === 'boxplot') {
|
|
286
|
+
this.specificChartOptions.hideDataLabels(currentChart.series);
|
|
277
287
|
}
|
|
278
288
|
if (this.chartType === 'columnrange') {
|
|
279
289
|
this.columnRangeChart.updateColumnRangeChartHeight(this.config, currentChart);
|
|
280
|
-
this.
|
|
290
|
+
this.specificChartOptions.hideDataLabels(currentChart.series);
|
|
281
291
|
|
|
282
292
|
if (this.extraScatter > 0) {
|
|
283
293
|
const scatterSeries = currentChart.series.filter((series) => series.type === 'scatter');
|
|
@@ -290,7 +300,7 @@ class HighchartsBaseChart {
|
|
|
290
300
|
if (this.extraLines > 0) {
|
|
291
301
|
currentChart.series.forEach((series) => {
|
|
292
302
|
if (series.type === 'line') {
|
|
293
|
-
this.
|
|
303
|
+
this.specificChartOptions.hideDataLabels([series]);
|
|
294
304
|
}
|
|
295
305
|
});
|
|
296
306
|
}
|
|
@@ -307,7 +317,7 @@ class HighchartsBaseChart {
|
|
|
307
317
|
if (this.rangeAnnotationsOptions) {
|
|
308
318
|
this.rangeAnnotationsOptions.addLine(currentChart);
|
|
309
319
|
}
|
|
310
|
-
if (this.chartType != 'bar') {
|
|
320
|
+
if (this.chartType != 'bar' && this.chartType != 'columnrange') {
|
|
311
321
|
this.specificChartOptions.adjustChartHeight(currentChart, this.percentageHeightDesktop, this.percentageHeightMobile);
|
|
312
322
|
}
|
|
313
323
|
// Update the legend symbols on render to maintain them during resize
|
|
@@ -20,6 +20,9 @@ class ColumnRangeChart {
|
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
|
+
tooltip: {
|
|
24
|
+
enabled: false,
|
|
25
|
+
},
|
|
23
26
|
xAxis: {
|
|
24
27
|
// Update the category label colours for bar charts
|
|
25
28
|
labels: {
|
|
@@ -57,6 +60,9 @@ class ColumnRangeChart {
|
|
|
57
60
|
useHTML: false,
|
|
58
61
|
},
|
|
59
62
|
},
|
|
63
|
+
chart: {
|
|
64
|
+
inverted: true, // Invert the chart to make it horizontal
|
|
65
|
+
},
|
|
60
66
|
legend: {
|
|
61
67
|
symbolRadius: 0,
|
|
62
68
|
itemStyle: {
|
|
@@ -2,7 +2,7 @@ import ChartConstants from './chart-constants';
|
|
|
2
2
|
|
|
3
3
|
// Options that are common to all chart types - these are set once in the Highcharts.setOptions() method
|
|
4
4
|
class CommonChartOptions {
|
|
5
|
-
constructor(
|
|
5
|
+
constructor() {
|
|
6
6
|
this.constants = ChartConstants.constants();
|
|
7
7
|
|
|
8
8
|
this.options = {
|
|
@@ -85,7 +85,6 @@ class CommonChartOptions {
|
|
|
85
85
|
tickWidth: 1,
|
|
86
86
|
tickLength: 6,
|
|
87
87
|
tickColor: this.constants.gridLineColor,
|
|
88
|
-
tickInterval: yAxisTickInterval,
|
|
89
88
|
},
|
|
90
89
|
xAxis: {
|
|
91
90
|
labels: {
|
|
@@ -109,7 +108,6 @@ class CommonChartOptions {
|
|
|
109
108
|
tickWidth: 1,
|
|
110
109
|
tickLength: 6,
|
|
111
110
|
tickColor: this.constants.gridLineColor,
|
|
112
|
-
tickInterval: xAxisTickInterval,
|
|
113
111
|
},
|
|
114
112
|
plotOptions: {
|
|
115
113
|
series: {
|
|
@@ -134,16 +132,6 @@ class CommonChartOptions {
|
|
|
134
132
|
}
|
|
135
133
|
|
|
136
134
|
getOptions = () => this.options;
|
|
137
|
-
|
|
138
|
-
hideDataLabels = (series) => {
|
|
139
|
-
series.forEach((series) => {
|
|
140
|
-
series.update({
|
|
141
|
-
dataLabels: {
|
|
142
|
-
enabled: false,
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
135
|
}
|
|
148
136
|
|
|
149
137
|
export default CommonChartOptions;
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
{{
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "columnrange",
|
|
6
|
-
"isChartInverted": true,
|
|
7
6
|
"description": "Volume sales, seasonally adjusted, Great Britain, January 2022 to January 2025",
|
|
8
|
-
"theme": "primary",
|
|
9
7
|
"title": "Food stores showed a strong rise on the month, while non-food stores fell",
|
|
10
8
|
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
11
9
|
"id": "uuid",
|
|
@@ -56,13 +54,10 @@
|
|
|
56
54
|
[-10.5, 12.0],
|
|
57
55
|
[-12.1, 18.5]
|
|
58
56
|
],
|
|
59
|
-
"dataLabels": true,
|
|
60
57
|
"name": "Values"
|
|
61
58
|
},
|
|
62
59
|
{
|
|
63
60
|
"data": [1,2,3,4,5,6,7,8,9,10,3,11,12],
|
|
64
|
-
"marker": true,
|
|
65
|
-
"dataLabels": false,
|
|
66
61
|
"name": "Another test data source",
|
|
67
62
|
"type": "scatter"
|
|
68
63
|
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
onsChart({
|
|
5
5
|
"chartType": "boxplot",
|
|
6
6
|
"description": "Public sector net debt excluding public sector banks, percentage of gross domestic product (GDP), UK, financial year ending (FYE) 1901 to October 2024",
|
|
7
|
-
"theme": "primary",
|
|
8
7
|
"title": "Figure 6: Net debt as a percentage of GDP remains at levels last seen in the early 1960s",
|
|
9
8
|
"subtitle": "Public sector net debt excluding public sector banks, percentage of gross domestic product (GDP), UK, financial year ending (FYE) 1901 to October 2024",
|
|
10
9
|
"id": "uuid",
|
|
@@ -39,9 +38,7 @@
|
|
|
39
38
|
[817, 817, 817, 817, 817],
|
|
40
39
|
[806, 806, 806, 806, 806],
|
|
41
40
|
[864, 864, 864, 864, 864]
|
|
42
|
-
]
|
|
43
|
-
"dataLabels": false,
|
|
44
|
-
"name": "Net debt"
|
|
41
|
+
]
|
|
45
42
|
}
|
|
46
43
|
],
|
|
47
44
|
'estimateLineLabel': 'Data line',
|
|
@@ -46,8 +46,7 @@
|
|
|
46
46
|
[163.5, 54.9], [158.7, 51.2], [165.5, 57.8], [160.4, 52.7],
|
|
47
47
|
[162.7, 55.4], [166.4, 58.4], [159.4, 51.5], [164.8, 56.5],
|
|
48
48
|
[158.6, 50.6], [163.4, 53.5]
|
|
49
|
-
]
|
|
50
|
-
"marker": true
|
|
49
|
+
]
|
|
51
50
|
},
|
|
52
51
|
{
|
|
53
52
|
"name": "Male",
|
|
@@ -60,8 +59,7 @@
|
|
|
60
59
|
[178.7, 68.8], [182.2, 74.7], [176.4, 67.5], [188.0, 77.6],
|
|
61
60
|
[184.1, 73.4], [179.2, 70.8], [186.6, 79.8], [183.4, 75.4],
|
|
62
61
|
[177.8, 69.6], [185.5, 76.7]
|
|
63
|
-
]
|
|
64
|
-
"marker": true
|
|
62
|
+
]
|
|
65
63
|
},
|
|
66
64
|
{
|
|
67
65
|
"name": "Adolescent Male",
|
|
@@ -72,8 +70,7 @@
|
|
|
72
70
|
[168.8, 58.6], [171.5, 62.8], [169.2, 59.4], [173.7, 63.5],
|
|
73
71
|
[170.2, 61.6], [172.4, 64.2], [168.2, 58.1], [173.9, 64.8],
|
|
74
72
|
[169.8, 60.7], [171.4, 63.6]
|
|
75
|
-
]
|
|
76
|
-
"marker": true
|
|
73
|
+
]
|
|
77
74
|
},
|
|
78
75
|
{
|
|
79
76
|
"name": "Adolescent Female",
|
|
@@ -84,8 +81,7 @@
|
|
|
84
81
|
[164.5, 55.1], [166.2, 57.5], [163.4, 53.6], [165.9, 56.2],
|
|
85
82
|
[162.6, 52.5], [167.5, 58.4], [164.4, 55.6], [166.6, 57.6],
|
|
86
83
|
[163.8, 53.7], [165.2, 56.9]
|
|
87
|
-
]
|
|
88
|
-
"marker": true
|
|
84
|
+
]
|
|
89
85
|
}
|
|
90
86
|
],
|
|
91
87
|
"percentageHeightDesktop": 35,
|
|
@@ -2,7 +2,7 @@ import ChartConstants from './chart-constants';
|
|
|
2
2
|
|
|
3
3
|
// Options that rely on the chart config but are not specific to the chart type
|
|
4
4
|
class SpecificChartOptions {
|
|
5
|
-
constructor(theme, type, config) {
|
|
5
|
+
constructor(theme, type, config, xAxisTickInterval, yAxisTickInterval) {
|
|
6
6
|
this.constants = ChartConstants.constants();
|
|
7
7
|
this.theme = theme;
|
|
8
8
|
this.config = config;
|
|
@@ -13,6 +13,12 @@ class SpecificChartOptions {
|
|
|
13
13
|
type: type,
|
|
14
14
|
marginTop: this.config.legend.enabled ? (type === 'boxplot' ? 50 : undefined) : 50,
|
|
15
15
|
},
|
|
16
|
+
yAxis: {
|
|
17
|
+
tickInterval: yAxisTickInterval,
|
|
18
|
+
},
|
|
19
|
+
xAxis: {
|
|
20
|
+
tickInterval: xAxisTickInterval,
|
|
21
|
+
},
|
|
16
22
|
};
|
|
17
23
|
}
|
|
18
24
|
|
|
@@ -32,6 +38,16 @@ class SpecificChartOptions {
|
|
|
32
38
|
};
|
|
33
39
|
};
|
|
34
40
|
|
|
41
|
+
hideDataLabels = (series) => {
|
|
42
|
+
series.forEach((series) => {
|
|
43
|
+
series.update({
|
|
44
|
+
dataLabels: {
|
|
45
|
+
enabled: false,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
35
51
|
disableLegendForSingleSeries = (config) => {
|
|
36
52
|
if (config.chart.type != 'boxplot' && config.series.length === 1) {
|
|
37
53
|
config.legend = {
|
|
@@ -42,18 +58,25 @@ class SpecificChartOptions {
|
|
|
42
58
|
};
|
|
43
59
|
|
|
44
60
|
adjustChartHeight = (currentChart, percentageHeightDesktop, percentageHeightMobile) => {
|
|
45
|
-
// get
|
|
46
|
-
const plotHeight = currentChart.plotHeight;
|
|
61
|
+
// get current width of the plot area
|
|
47
62
|
const plotWidth = currentChart.plotWidth;
|
|
48
|
-
|
|
49
|
-
// default
|
|
50
|
-
|
|
63
|
+
let newPlotHeight = undefined;
|
|
64
|
+
let totalHeight = 400; // Highcharts default height - needed if one of the percentage heights is undefined
|
|
65
|
+
|
|
66
|
+
// Calculate the new plot height based on the percentage height
|
|
51
67
|
if (plotWidth > 400) {
|
|
52
|
-
|
|
68
|
+
if (percentageHeightDesktop !== undefined) {
|
|
69
|
+
newPlotHeight = Math.round(plotWidth * (percentageHeightDesktop / 100));
|
|
70
|
+
}
|
|
53
71
|
} else {
|
|
54
|
-
|
|
72
|
+
if (percentageHeightMobile !== undefined) {
|
|
73
|
+
newPlotHeight = Math.round(plotWidth * (percentageHeightMobile / 100));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// update the total height if we have a new plot height
|
|
77
|
+
if (newPlotHeight !== undefined) {
|
|
78
|
+
totalHeight = currentChart.plotTop + newPlotHeight + currentChart.marginBottom;
|
|
55
79
|
}
|
|
56
|
-
const totalHeight = currentChart.plotTop + newPlotHeight + currentChart.marginBottom;
|
|
57
80
|
|
|
58
81
|
// set the new size of the chart
|
|
59
82
|
if (totalHeight !== currentChart.chartHeight) {
|
|
@@ -127,8 +150,9 @@ class SpecificChartOptions {
|
|
|
127
150
|
fill: item.color,
|
|
128
151
|
stroke: item.color,
|
|
129
152
|
'stroke-width': 1,
|
|
130
|
-
width
|
|
131
|
-
|
|
153
|
+
// 10px accounts for the stroke width to end up at 12px overall
|
|
154
|
+
width: 10,
|
|
155
|
+
height: 10,
|
|
132
156
|
'data-custom-legend-symbol': true,
|
|
133
157
|
});
|
|
134
158
|
legendSymbol.add(label.parentGroup);
|
|
@@ -136,11 +160,14 @@ class SpecificChartOptions {
|
|
|
136
160
|
x: 15, // Adjust label position to account for shorter space that the symbol takes up
|
|
137
161
|
});
|
|
138
162
|
}
|
|
139
|
-
} else if (seriesType === '
|
|
163
|
+
} else if (seriesType === 'scatter') {
|
|
164
|
+
// Because the scatter icons have a white border, we have to render them
|
|
165
|
+
// slightly larger to make them appear at 12 x 12 px
|
|
166
|
+
// Also the text looks better aligned if the y value is tweaked slightly for the scatter icons
|
|
140
167
|
symbol.attr({
|
|
141
|
-
width:
|
|
142
|
-
height:
|
|
143
|
-
y:
|
|
168
|
+
width: 13,
|
|
169
|
+
height: 13,
|
|
170
|
+
y: 7,
|
|
144
171
|
});
|
|
145
172
|
} else {
|
|
146
173
|
if (!symbol) return;
|
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
&--inline {
|
|
44
|
-
.ons-description-list__term {
|
|
45
|
-
padding-right: 1rem;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
44
|
@include mq(l) {
|
|
49
45
|
display: grid;
|
|
50
46
|
grid-template-columns: repeat(3, 1fr);
|
|
51
|
-
grid-
|
|
52
|
-
grid-auto-flow:
|
|
47
|
+
grid-auto-rows: auto;
|
|
48
|
+
grid-auto-flow: row;
|
|
53
49
|
gap: 0.5rem 2.5rem;
|
|
54
50
|
|
|
51
|
+
&-single {
|
|
52
|
+
grid-template-columns: 1fr;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
55
|
.ons-description-list__value {
|
|
56
56
|
grid-column-start: 2;
|
|
57
57
|
}
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
.ons-description-list__item {
|
|
60
60
|
display: grid;
|
|
61
61
|
grid-template-columns: auto 1fr;
|
|
62
|
+
grid-column-gap: 1rem;
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% macro onsDescriptionList(params) %}
|
|
2
2
|
<dl
|
|
3
|
-
class="ons-description-list ons-description-list__items ons-grid ons-grid--gutterless{{ ' ons-description-list--inline' if params.variant == 'inline' else ' ons-u-cf' }}{{ ' ' + params.classes if params.classes else '' }}"
|
|
3
|
+
class="ons-description-list ons-description-list__items ons-grid ons-grid--gutterless{{ ' ons-description-list--inline' if params.variant == 'inline' else ' ons-u-cf' }}{{ ' ons-description-list--inline-single' if params.itemsList|length < 2 else '' }}{{ ' ' + params.classes if params.classes else '' }}"
|
|
4
4
|
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
5
5
|
{% if params.descriptionListLabel %}
|
|
6
6
|
title="{{ params.descriptionListLabel }}" aria-label="{{ params.descriptionListLabel }}"
|