@ons/design-system 72.6.0 → 72.9.0
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/breadcrumbs/_breadcrumbs.scss +1 -0
- package/components/chart/_chart.scss +10 -0
- package/components/chart/_macro.njk +50 -32
- package/components/chart/_macro.spec.js +201 -0
- package/components/chart/annotations-options.js +1 -1
- package/components/chart/area-chart.js +26 -0
- package/components/chart/bar-chart.js +11 -2
- package/components/chart/chart-constants.js +84 -3
- package/components/chart/chart.js +43 -10
- package/components/chart/column-chart.js +33 -24
- package/components/chart/common-chart-options.js +14 -35
- package/components/chart/example-area-chart.njk +68 -0
- package/components/chart/example-clustered-column-chart.njk +2 -1
- package/components/chart/example-column-chart-with-annotations.njk +2 -1
- package/components/chart/example-column-chart.njk +2 -1
- package/components/chart/example-column-with-line-chart.njk +5 -2
- package/components/chart/example-line-chart-with-markers.njk +138 -0
- package/components/chart/example-line-chart.njk +3 -1
- package/components/chart/example-scatter-chart.njk +94 -0
- package/components/chart/line-chart.js +18 -23
- package/components/chart/scatter-chart.js +34 -0
- package/components/details/details.js +5 -0
- package/components/details-panel/_details-panel.scss +107 -0
- package/components/details-panel/_macro.njk +41 -0
- package/components/details-panel/_macro.spec.js +54 -0
- package/components/details-panel/example-details-panel-open.njk +29 -0
- package/components/details-panel/example-details-panel.njk +28 -0
- package/components/hero/_hero.scss +87 -60
- package/components/hero/_macro.njk +1 -1
- package/components/hero/example-hero-dark.njk +1 -1
- package/components/pagination/_macro.njk +1 -1
- package/components/pagination/_pagination.scss +7 -7
- package/components/summary/_macro.njk +2 -2
- package/components/summary/_macro.spec.js +37 -21
- package/components/summary/_summary.scss +5 -1
- package/components/summary/example-summary-grouped.njk +0 -12
- package/css/main.css +1 -1
- 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/vars/_colors.scss +1 -0
|
@@ -7,7 +7,9 @@ import SpecificChartOptions from './specific-chart-options';
|
|
|
7
7
|
import LineChart from './line-chart';
|
|
8
8
|
import BarChart from './bar-chart';
|
|
9
9
|
import ColumnChart from './column-chart';
|
|
10
|
+
import ScatterChart from './scatter-chart';
|
|
10
11
|
import AnnotationsOptions from './annotations-options';
|
|
12
|
+
import AreaChart from './area-chart';
|
|
11
13
|
|
|
12
14
|
class HighchartsBaseChart {
|
|
13
15
|
static selector() {
|
|
@@ -19,6 +21,10 @@ class HighchartsBaseChart {
|
|
|
19
21
|
this.chartType = this.node.dataset.highchartsType;
|
|
20
22
|
this.theme = this.node.dataset.highchartsTheme;
|
|
21
23
|
const chartNode = this.node.querySelector('[data-highcharts-chart]');
|
|
24
|
+
if (!chartNode) {
|
|
25
|
+
console.error('No chart node found');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
22
28
|
this.id = this.node.dataset.highchartsId;
|
|
23
29
|
this.useStackedLayout = this.node.hasAttribute('data-highcharts-use-stacked-layout');
|
|
24
30
|
this.config = JSON.parse(this.node.querySelector(`[data-highcharts-config--${this.id}]`).textContent);
|
|
@@ -28,11 +34,17 @@ class HighchartsBaseChart {
|
|
|
28
34
|
}
|
|
29
35
|
this.percentageHeightDesktop = this.node.dataset.highchartsPercentageHeightDesktop;
|
|
30
36
|
this.percentageHeightMobile = this.node.dataset.highchartsPercentageHeightMobile;
|
|
31
|
-
this.
|
|
37
|
+
this.xAxisTickIntervalMobile = parseInt(this.node.dataset.highchartsXAxisTickIntervalMobile);
|
|
38
|
+
this.xAxisTickIntervalDesktop = parseInt(this.node.dataset.highchartsXAxisTickIntervalDesktop);
|
|
39
|
+
this.yAxisTickIntervalMobile = parseInt(this.node.dataset.highchartsYAxisTickIntervalMobile);
|
|
40
|
+
this.yAxisTickIntervalDesktop = parseInt(this.node.dataset.highchartsYAxisTickIntervalDesktop);
|
|
41
|
+
this.commonChartOptions = new CommonChartOptions(this.xAxisTickIntervalDesktop, this.yAxisTickIntervalDesktop);
|
|
32
42
|
this.specificChartOptions = new SpecificChartOptions(this.theme, this.chartType, this.config);
|
|
33
43
|
this.lineChart = new LineChart();
|
|
34
44
|
this.barChart = new BarChart();
|
|
35
45
|
this.columnChart = new ColumnChart();
|
|
46
|
+
this.areaChart = new AreaChart();
|
|
47
|
+
this.scatterChart = new ScatterChart();
|
|
36
48
|
this.extraLines = this.checkForExtraLines();
|
|
37
49
|
if (window.isCommonChartOptionsDefined === undefined) {
|
|
38
50
|
this.setCommonChartOptions();
|
|
@@ -96,7 +108,9 @@ class HighchartsBaseChart {
|
|
|
96
108
|
const specificChartOptions = this.specificChartOptions.getOptions();
|
|
97
109
|
const lineChartOptions = this.lineChart.getLineChartOptions();
|
|
98
110
|
const barChartOptions = this.barChart.getBarChartOptions(this.useStackedLayout);
|
|
99
|
-
const columnChartOptions = this.columnChart.getColumnChartOptions(this.useStackedLayout);
|
|
111
|
+
const columnChartOptions = this.columnChart.getColumnChartOptions(this.config, this.useStackedLayout, this.extraLines);
|
|
112
|
+
const areaChartOptions = this.areaChart.getAreaChartOptions();
|
|
113
|
+
const scatterChartOptions = this.scatterChart.getScatterChartOptions();
|
|
100
114
|
// Merge specificChartOptions with the existing config
|
|
101
115
|
this.config = this.mergeConfigs(this.config, specificChartOptions);
|
|
102
116
|
|
|
@@ -113,6 +127,14 @@ class HighchartsBaseChart {
|
|
|
113
127
|
// Merge the column chart options with the existing config
|
|
114
128
|
this.config = this.mergeConfigs(this.config, columnChartOptions);
|
|
115
129
|
}
|
|
130
|
+
if (this.chartType === 'area') {
|
|
131
|
+
// Merge the area chart options with the existing config
|
|
132
|
+
this.config = this.mergeConfigs(this.config, areaChartOptions);
|
|
133
|
+
}
|
|
134
|
+
if (this.chartType === 'scatter') {
|
|
135
|
+
// Merge the scatter chart options with the existing config
|
|
136
|
+
this.config = this.mergeConfigs(this.config, scatterChartOptions);
|
|
137
|
+
}
|
|
116
138
|
|
|
117
139
|
if (this.extraLines > 0) {
|
|
118
140
|
this.config = this.mergeConfigs(this.config, this.lineChart.getLineChartOptions());
|
|
@@ -138,24 +160,34 @@ class HighchartsBaseChart {
|
|
|
138
160
|
// Note this is not the same as the viewport width
|
|
139
161
|
// All responsive rules should be defined here to avoid overriding existing rules
|
|
140
162
|
setResponsiveOptions = () => {
|
|
141
|
-
|
|
163
|
+
let mobileChartOptions = this.commonChartOptions.getMobileOptions(this.xAxisTickIntervalMobile, this.yAxisTickIntervalMobile);
|
|
164
|
+
if (this.chartType === 'column') {
|
|
165
|
+
const mobileColumnChartOptions = this.columnChart.getColumnChartMobileOptions(
|
|
166
|
+
this.config,
|
|
167
|
+
this.useStackedLayout,
|
|
168
|
+
this.extraLines,
|
|
169
|
+
);
|
|
170
|
+
mobileChartOptions = this.mergeConfigs(mobileChartOptions, mobileColumnChartOptions);
|
|
171
|
+
}
|
|
172
|
+
|
|
142
173
|
if (!this.config.responsive) {
|
|
143
174
|
this.config.responsive = {};
|
|
144
175
|
}
|
|
145
|
-
|
|
176
|
+
|
|
146
177
|
let rules = [
|
|
147
178
|
{
|
|
148
179
|
condition: {
|
|
149
180
|
maxWidth: 400,
|
|
150
181
|
},
|
|
151
182
|
chartOptions: {
|
|
152
|
-
...
|
|
183
|
+
...mobileChartOptions,
|
|
153
184
|
},
|
|
154
185
|
},
|
|
155
|
-
// We are using a slightly wider breakpoint for annotations
|
|
156
|
-
// to try and reduce the likelihood of them being automatically
|
|
157
|
-
// hidden by Highcharts
|
|
158
186
|
{
|
|
187
|
+
// If these conditions change, the styling for the footnotes container query in _chart.scss needs to be updated
|
|
188
|
+
// We are using a slightly wider breakpoint for annotations
|
|
189
|
+
// to try and reduce the likelihood of them being automatically
|
|
190
|
+
// hidden by Highcharts
|
|
159
191
|
condition: {
|
|
160
192
|
maxWidth: 600,
|
|
161
193
|
},
|
|
@@ -196,9 +228,11 @@ class HighchartsBaseChart {
|
|
|
196
228
|
}
|
|
197
229
|
}
|
|
198
230
|
if (this.chartType === 'column') {
|
|
199
|
-
this.columnChart.updatePointPadding(this.config, currentChart, this.useStackedLayout, this.extraLines);
|
|
200
231
|
this.commonChartOptions.hideDataLabels(currentChart.series);
|
|
201
232
|
}
|
|
233
|
+
if (this.chartType === 'scatter') {
|
|
234
|
+
this.scatterChart.updateMarkers(currentChart);
|
|
235
|
+
}
|
|
202
236
|
if (this.chartType != 'bar') {
|
|
203
237
|
this.commonChartOptions.adjustChartHeight(currentChart, this.percentageHeightDesktop, this.percentageHeightMobile);
|
|
204
238
|
}
|
|
@@ -208,7 +242,6 @@ class HighchartsBaseChart {
|
|
|
208
242
|
if (this.extraLines > 0) {
|
|
209
243
|
currentChart.series.forEach((series) => {
|
|
210
244
|
if (series.type === 'line') {
|
|
211
|
-
this.lineChart.updateLastPointMarker([series]);
|
|
212
245
|
this.commonChartOptions.hideDataLabels([series]);
|
|
213
246
|
}
|
|
214
247
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
class ColumnChart {
|
|
2
|
-
getColumnChartOptions = (useStackedLayout) => {
|
|
2
|
+
getColumnChartOptions = (config, useStackedLayout, extraLines) => {
|
|
3
3
|
return {
|
|
4
4
|
plotOptions: {
|
|
5
5
|
column: {
|
|
6
|
-
|
|
7
|
-
groupPadding: 0,
|
|
6
|
+
...this.getPointPadding(config, useStackedLayout, extraLines, false),
|
|
8
7
|
borderRadius: 0,
|
|
9
8
|
borderWidth: 0,
|
|
10
9
|
},
|
|
@@ -15,33 +14,43 @@ class ColumnChart {
|
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
getColumnChartMobileOptions = (config, useStackedLayout, extraLines) => {
|
|
18
|
+
return {
|
|
19
|
+
plotOptions: {
|
|
20
|
+
column: {
|
|
21
|
+
...this.getPointPadding(config, useStackedLayout, extraLines, true),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Set spacing between bars based on screen size and number of categories:
|
|
28
|
+
// - For charts with enough categories (≥ 10 on mobile, ≥ 20 on desktop), use 10% spacing (0.1), i.e. 20% total gap between bars
|
|
29
|
+
// - For charts with fewer categories, use 20% spacing (0.2), i.e. 40% total gap
|
|
30
|
+
// - For non-clustered or stacked charts, spacing is applied as pointPadding
|
|
31
|
+
// - For clustered charts, spacing is applied as groupPadding
|
|
32
|
+
// - Max bar width: 75px (desktop), 55px (mobile)
|
|
33
|
+
getPointPadding = (config, stackedLayout, numberOfExtraLines, isMobile) => {
|
|
34
|
+
const numberOfCategories = config.xAxis.categories ? config.xAxis.categories.length : 0;
|
|
35
|
+
const numberOfSeries = config.series.length - numberOfExtraLines; // Get number of column series
|
|
36
|
+
|
|
37
|
+
const categoryThreshold = isMobile ? 10 : 20;
|
|
38
|
+
const maxPointWidth = isMobile ? 55 : 75;
|
|
39
|
+
|
|
24
40
|
let pointPadding = 0;
|
|
25
41
|
let groupPadding = 0;
|
|
42
|
+
let spacing = numberOfCategories >= categoryThreshold ? 0.1 : 0.2;
|
|
43
|
+
|
|
26
44
|
// non-clustered charts or stacked charts
|
|
27
45
|
if (numberOfSeries === 1 || stackedLayout === true) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} else {
|
|
34
|
-
// clustered charts
|
|
35
|
-
groupPadding = 0.04;
|
|
46
|
+
pointPadding = spacing;
|
|
47
|
+
}
|
|
48
|
+
// clustered charts
|
|
49
|
+
else {
|
|
50
|
+
groupPadding = spacing;
|
|
36
51
|
}
|
|
37
52
|
|
|
38
|
-
|
|
39
|
-
currentChart.series.forEach((series) => {
|
|
40
|
-
series.update({
|
|
41
|
-
pointPadding: pointPadding,
|
|
42
|
-
groupPadding: groupPadding,
|
|
43
|
-
});
|
|
44
|
-
});
|
|
53
|
+
return { pointPadding: pointPadding, groupPadding: groupPadding, maxPointWidth: maxPointWidth };
|
|
45
54
|
};
|
|
46
55
|
}
|
|
47
56
|
|
|
@@ -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(xAxisTickInterval, yAxisTickInterval) {
|
|
6
6
|
this.constants = ChartConstants.constants();
|
|
7
7
|
|
|
8
8
|
this.options = {
|
|
@@ -22,7 +22,6 @@ class CommonChartOptions {
|
|
|
22
22
|
symbolWidth: 20,
|
|
23
23
|
margin: 50,
|
|
24
24
|
navigation: {
|
|
25
|
-
// ensures that when the legend is long, there is no pagination or scrollbar
|
|
26
25
|
enabled: false,
|
|
27
26
|
},
|
|
28
27
|
itemDistance: 30,
|
|
@@ -30,9 +29,8 @@ class CommonChartOptions {
|
|
|
30
29
|
color: this.constants.labelColor, // Prevents the text from changing color on hover
|
|
31
30
|
},
|
|
32
31
|
itemStyle: {
|
|
33
|
-
cursor: 'default', // ensures that it does not change to a hand (pointer) on hover.
|
|
34
32
|
color: this.constants.labelColor,
|
|
35
|
-
fontSize: this.constants.
|
|
33
|
+
fontSize: this.constants.defaultFontSize,
|
|
36
34
|
fontWeight: 'normal',
|
|
37
35
|
},
|
|
38
36
|
// Disable click event on legend
|
|
@@ -64,7 +62,7 @@ class CommonChartOptions {
|
|
|
64
62
|
labels: {
|
|
65
63
|
style: {
|
|
66
64
|
color: this.constants.axisLabelColor,
|
|
67
|
-
fontSize: this.constants.
|
|
65
|
+
fontSize: this.constants.defaultFontSize,
|
|
68
66
|
},
|
|
69
67
|
},
|
|
70
68
|
title: {
|
|
@@ -78,7 +76,7 @@ class CommonChartOptions {
|
|
|
78
76
|
y: -25,
|
|
79
77
|
style: {
|
|
80
78
|
color: this.constants.axisLabelColor,
|
|
81
|
-
fontSize: this.constants.
|
|
79
|
+
fontSize: this.constants.defaultFontSize,
|
|
82
80
|
},
|
|
83
81
|
},
|
|
84
82
|
lineColor: this.constants.gridLineColor,
|
|
@@ -87,7 +85,7 @@ class CommonChartOptions {
|
|
|
87
85
|
plotLines: [
|
|
88
86
|
{
|
|
89
87
|
color: this.constants.zeroLineColor,
|
|
90
|
-
width: 1,
|
|
88
|
+
width: 1.5,
|
|
91
89
|
value: 0,
|
|
92
90
|
zIndex: 2,
|
|
93
91
|
},
|
|
@@ -96,19 +94,22 @@ class CommonChartOptions {
|
|
|
96
94
|
tickWidth: 1,
|
|
97
95
|
tickLength: 6,
|
|
98
96
|
tickColor: this.constants.gridLineColor,
|
|
97
|
+
tickInterval: yAxisTickInterval,
|
|
99
98
|
},
|
|
100
99
|
xAxis: {
|
|
101
100
|
labels: {
|
|
101
|
+
useHTML: true,
|
|
102
|
+
rotation: 0,
|
|
102
103
|
style: {
|
|
103
104
|
color: this.constants.axisLabelColor,
|
|
104
|
-
fontSize: this.constants.
|
|
105
|
+
fontSize: this.constants.defaultFontSize,
|
|
105
106
|
},
|
|
106
107
|
},
|
|
107
108
|
title: {
|
|
108
109
|
align: 'high',
|
|
109
110
|
style: {
|
|
110
111
|
color: this.constants.axisLabelColor,
|
|
111
|
-
fontSize: this.constants.
|
|
112
|
+
fontSize: this.constants.defaultFontSize,
|
|
112
113
|
},
|
|
113
114
|
},
|
|
114
115
|
lineColor: this.constants.gridLineColor,
|
|
@@ -117,6 +118,7 @@ class CommonChartOptions {
|
|
|
117
118
|
tickWidth: 1,
|
|
118
119
|
tickLength: 6,
|
|
119
120
|
tickColor: this.constants.gridLineColor,
|
|
121
|
+
tickInterval: xAxisTickInterval,
|
|
120
122
|
},
|
|
121
123
|
plotOptions: {
|
|
122
124
|
series: {
|
|
@@ -141,36 +143,13 @@ class CommonChartOptions {
|
|
|
141
143
|
|
|
142
144
|
getOptions = () => this.options;
|
|
143
145
|
|
|
144
|
-
getMobileOptions = () => {
|
|
146
|
+
getMobileOptions = (xAxisTickInterval, yAxisTickInterval) => {
|
|
145
147
|
return {
|
|
146
|
-
legend: {
|
|
147
|
-
itemStyle: {
|
|
148
|
-
fontSize: this.constants.mobileFontSize,
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
148
|
xAxis: {
|
|
152
|
-
|
|
153
|
-
style: {
|
|
154
|
-
fontSize: this.constants.mobileFontSize,
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
title: {
|
|
158
|
-
style: {
|
|
159
|
-
fontSize: this.constants.mobileFontSize,
|
|
160
|
-
},
|
|
161
|
-
},
|
|
149
|
+
tickInterval: xAxisTickInterval,
|
|
162
150
|
},
|
|
163
151
|
yAxis: {
|
|
164
|
-
|
|
165
|
-
style: {
|
|
166
|
-
fontSize: this.constants.mobileFontSize,
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
title: {
|
|
170
|
-
style: {
|
|
171
|
-
fontSize: this.constants.mobileFontSize,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
152
|
+
tickInterval: yAxisTickInterval,
|
|
174
153
|
},
|
|
175
154
|
};
|
|
176
155
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{% from "components/chart/_macro.njk" import onsChart %}
|
|
2
|
+
|
|
3
|
+
{{
|
|
4
|
+
onsChart({
|
|
5
|
+
"chartType": "area",
|
|
6
|
+
"description": "Area chart showing the annual rate of inflation for the Consumer Prices Index including owner occupiers’ housing costs (CPIH) and its components.",
|
|
7
|
+
"theme": "alternate",
|
|
8
|
+
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
|
+
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
|
+
"id": "id",
|
|
11
|
+
"headingLevel": 4,
|
|
12
|
+
"caption": "Source: Monthly Business Survey, Retails Sales Inquiry from the Office for National Statistics",
|
|
13
|
+
"download": {
|
|
14
|
+
'title': 'Download Figure 1 data',
|
|
15
|
+
'itemsList': [
|
|
16
|
+
{
|
|
17
|
+
"text": "Excel spreadsheet (XLSX format, 18KB)",
|
|
18
|
+
"url": "#"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"text": "Simple text file (CSV format, 25KB)",
|
|
22
|
+
"url": "#"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
|
|
26
|
+
"text": "Image (PNG format, 25KB)",
|
|
27
|
+
"url": "#"
|
|
28
|
+
}
|
|
29
|
+
]},
|
|
30
|
+
"legend": "true",
|
|
31
|
+
"series": [
|
|
32
|
+
{
|
|
33
|
+
"data": [
|
|
34
|
+
39.2, 47.1, 44.0, 46, 65.3, 53.2, 49.1, 49.3, 50.4, 48.1,
|
|
35
|
+
43.9, 41.8
|
|
36
|
+
],
|
|
37
|
+
"name": "Test series 3"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"data": [
|
|
41
|
+
28.8, 23.2, 33.0, 25.8, 20.8, 39.8, 37.9, 28.2, 37.6, 46.7,
|
|
42
|
+
43.9, 41.8
|
|
43
|
+
],
|
|
44
|
+
"name": "Test series 2"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"data": [
|
|
48
|
+
37.8, 41.0, 43.0, 42.9, 41.8, 39.8, 37.9, 38.2, 37.6, 36.7,
|
|
49
|
+
33.9, 31.8
|
|
50
|
+
],
|
|
51
|
+
"name": "Test series 1"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"xAxis": {
|
|
55
|
+
"categories": [
|
|
56
|
+
"Mar 1901", "Mar 1902", "Mar 1903", "Mar 1904", "Mar 1905", "Mar 1906", "Mar 1907", "Mar 1908", "Mar 1909", "Mar 1910",
|
|
57
|
+
"Mar 1911", "Mar 1912"
|
|
58
|
+
],
|
|
59
|
+
"title": "Years",
|
|
60
|
+
"type": "linear"
|
|
61
|
+
},
|
|
62
|
+
"yAxis": {
|
|
63
|
+
"title": "Y axis title"
|
|
64
|
+
},
|
|
65
|
+
"percentageHeightDesktop": 50,
|
|
66
|
+
"percentageHeightMobile": 120
|
|
67
|
+
})
|
|
68
|
+
}}
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"legend": true,
|
|
30
30
|
"xAxis": {
|
|
31
31
|
"categories": ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"],
|
|
32
|
-
"type": "linear"
|
|
32
|
+
"type": "linear",
|
|
33
|
+
"tickIntervalMobile": 5
|
|
33
34
|
},
|
|
34
35
|
"yAxis": {
|
|
35
36
|
"title": "Percent (%)"
|
|
@@ -57,6 +58,8 @@
|
|
|
57
58
|
"name": "Another test data source",
|
|
58
59
|
"type": "line"
|
|
59
60
|
}
|
|
60
|
-
]
|
|
61
|
+
],
|
|
62
|
+
"percentageHeightDesktop": 35,
|
|
63
|
+
"percentageHeightMobile": 90
|
|
61
64
|
})
|
|
62
65
|
}}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
{% from "components/chart/_macro.njk" import onsChart %}
|
|
2
|
+
|
|
3
|
+
{{
|
|
4
|
+
onsChart({
|
|
5
|
+
"chartType": "line",
|
|
6
|
+
"description": "Line chart showing the annual rate of inflation for the Consumer Prices Index including owner occupiers’ housing costs (CPIH) and its components.",
|
|
7
|
+
"theme": "primary",
|
|
8
|
+
"title": "Sales volumes and values saw moderate growth in July 2024",
|
|
9
|
+
"subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
|
|
10
|
+
"id": "id",
|
|
11
|
+
"headingLevel": 4,
|
|
12
|
+
"caption": "Source: Monthly Business Survey, Retails Sales Inquiry from the Office for National Statistics",
|
|
13
|
+
"download": {
|
|
14
|
+
'title': 'Download Figure 1 data',
|
|
15
|
+
'itemsList': [
|
|
16
|
+
{
|
|
17
|
+
"text": "Excel spreadsheet (XLSX format, 18KB)",
|
|
18
|
+
"url": "#"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"text": "Simple text file (CSV format, 25KB)",
|
|
22
|
+
"url": "#"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
|
|
26
|
+
"text": "Image (PNG format, 25KB)",
|
|
27
|
+
"url": "#"
|
|
28
|
+
}
|
|
29
|
+
]},
|
|
30
|
+
"legend": "true",
|
|
31
|
+
"xAxis": {
|
|
32
|
+
"title": "Year",
|
|
33
|
+
"type": "linear",
|
|
34
|
+
"labelFormat": "{value:,.f}",
|
|
35
|
+
"categories": [
|
|
36
|
+
'Oct 2014',
|
|
37
|
+
'Nov 2014',
|
|
38
|
+
'Dec 2014',
|
|
39
|
+
'Jan 2015',
|
|
40
|
+
'Feb 2015',
|
|
41
|
+
'Mar 2015',
|
|
42
|
+
'Apr 2015',
|
|
43
|
+
'May 2015',
|
|
44
|
+
'Jun 2015',
|
|
45
|
+
'Jul 2015'
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"yAxis": {
|
|
49
|
+
"title": "Sales",
|
|
50
|
+
"labelFormat": "{value:,.f}"
|
|
51
|
+
},
|
|
52
|
+
"series": [
|
|
53
|
+
{
|
|
54
|
+
"name": 'CPIH',
|
|
55
|
+
"data": [
|
|
56
|
+
1.3, null, 0.7, 0.5, 0.4, 0.3, 0.3, 0.4, 0.3, 0.5
|
|
57
|
+
],
|
|
58
|
+
"marker": 'true',
|
|
59
|
+
"connectNulls": 'true'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": 'Goods',
|
|
63
|
+
"data": [
|
|
64
|
+
0.3, -0.2, -1.0, null, -2.0, -2.1, -1.9, -1.8, -2.0, -1.8
|
|
65
|
+
],
|
|
66
|
+
"marker": 'true',
|
|
67
|
+
"connectNulls": 'true'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": 'Services',
|
|
71
|
+
"data": [
|
|
72
|
+
2.2, 2.1, 2.1, 2.1, 2.2, 2.2, 2.0, 2.1, 2.1, 2.2
|
|
73
|
+
],
|
|
74
|
+
"marker": 'true',
|
|
75
|
+
"connectNulls": 'true'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": 'CPIH excl energy, food, alcohol & tobacco',
|
|
79
|
+
"data": [
|
|
80
|
+
1.5, 1.3, 1.4, 1.5, 1.4, 1.2, 1.1, 1.2, 1.0, 1.3
|
|
81
|
+
],
|
|
82
|
+
"marker": 'true',
|
|
83
|
+
"connectNulls": 'true'
|
|
84
|
+
}
|
|
85
|
+
,
|
|
86
|
+
{
|
|
87
|
+
"name": 'Extra test series 1',
|
|
88
|
+
"data": [
|
|
89
|
+
3.2, 3.7, 3.8, 3.9, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7
|
|
90
|
+
],
|
|
91
|
+
"marker": 'true',
|
|
92
|
+
"connectNulls": 'true'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": 'Extra test series 2',
|
|
96
|
+
"data": [
|
|
97
|
+
4.5, 4.3, 4.4, 4.5, 4.4, 4.2, 4.1, 4.2, 4.0, 4.3
|
|
98
|
+
],
|
|
99
|
+
"marker": 'true',
|
|
100
|
+
"connectNulls": 'true'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": 'Extra test series 3',
|
|
104
|
+
"data": [
|
|
105
|
+
5.5, 5.3, 5.4, 5.5, 5.4, 5.2, 5.1, 5.2, 5.0, 5.3
|
|
106
|
+
],
|
|
107
|
+
"marker": 'true',
|
|
108
|
+
"connectNulls": 'true'
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": 'Extra test series 4',
|
|
112
|
+
"data": [
|
|
113
|
+
-3.5, -3.3, -3.4, -3.5, -3.4, -3.2, -3.1, -3.2, -3.0, -3.3
|
|
114
|
+
],
|
|
115
|
+
"marker": 'true',
|
|
116
|
+
"connectNulls": 'true'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": 'Extra test series 5',
|
|
120
|
+
"data": [
|
|
121
|
+
-4.5, -4.3, -4.4, -4.5, -4.4, -4.2, -4.1, -4.2, -4.0, -4.3
|
|
122
|
+
],
|
|
123
|
+
"marker": 'true',
|
|
124
|
+
"connectNulls": 'true'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": 'Extra test series 6',
|
|
128
|
+
"data": [
|
|
129
|
+
-5.5, -5.3, -5.4, -5.5, -5.4, -5.2, -5.1, -5.2, -5.0, -5.3
|
|
130
|
+
],
|
|
131
|
+
"marker": 'true',
|
|
132
|
+
"connectNulls": 'true'
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"percentageHeightDesktop": 35,
|
|
136
|
+
"percentageHeightMobile": 90
|
|
137
|
+
})
|
|
138
|
+
}}
|