@ons/design-system 72.8.0 → 72.9.1
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/_macro.njk +15 -2
- package/components/card/example-card-set-with-headline-figures.njk +1 -4
- package/components/chart/_chart.scss +5 -0
- package/components/chart/_macro.njk +36 -31
- package/components/chart/_macro.spec.js +132 -67
- package/components/chart/annotations-options.js +1 -1
- package/components/chart/area-chart.js +27 -0
- package/components/chart/bar-chart.js +4 -4
- package/components/chart/chart-constants.js +84 -3
- package/components/chart/chart.js +39 -16
- package/components/chart/column-chart.js +33 -24
- package/components/chart/common-chart-options.js +6 -33
- package/components/chart/example-area-chart.njk +68 -0
- package/components/chart/example-column-with-line-chart.njk +3 -1
- package/components/chart/example-line-chart-with-markers.njk +138 -0
- 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/table-of-contents/_macro.njk +1 -11
- package/components/table-of-contents/example-table-of-contents-related-links-with-button.njk +1 -2
- 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/components/chart/example-bar-with-line-chart.njk +0 -64
|
@@ -9,9 +9,90 @@ class ChartConstants {
|
|
|
9
9
|
categoryLabelColor: '#414042',
|
|
10
10
|
gridLineColor: '#d9d9d9',
|
|
11
11
|
zeroLineColor: '#b3b3b3',
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
defaultFontSize: '0.875rem', // 14px
|
|
13
|
+
lineMarkerStyles: [
|
|
14
|
+
{
|
|
15
|
+
radius: 4,
|
|
16
|
+
symbol: 'circle',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
radius: 4,
|
|
20
|
+
symbol: 'square',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
radius: 5,
|
|
24
|
+
symbol: 'diamond',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
radius: 5,
|
|
28
|
+
symbol: 'triangle',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
radius: 5,
|
|
32
|
+
symbol: 'triangle-down',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
radius: 4,
|
|
36
|
+
symbol: 'circle',
|
|
37
|
+
fillColor: 'white',
|
|
38
|
+
lineWidth: 2.5,
|
|
39
|
+
lineColor: null,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
radius: 4,
|
|
43
|
+
symbol: 'square',
|
|
44
|
+
fillColor: 'white',
|
|
45
|
+
lineWidth: 2.5,
|
|
46
|
+
lineColor: null,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
radius: 5,
|
|
50
|
+
symbol: 'diamond',
|
|
51
|
+
fillColor: 'white',
|
|
52
|
+
lineWidth: 2.5,
|
|
53
|
+
lineColor: null,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
radius: 5,
|
|
57
|
+
symbol: 'triangle',
|
|
58
|
+
fillColor: 'white',
|
|
59
|
+
lineWidth: 2.5,
|
|
60
|
+
lineColor: null,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
radius: 5,
|
|
64
|
+
symbol: 'triangle-down',
|
|
65
|
+
fillColor: 'white',
|
|
66
|
+
lineWidth: 2.5,
|
|
67
|
+
lineColor: null,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
scatterMarkerStyles: [
|
|
71
|
+
{
|
|
72
|
+
radius: 5,
|
|
73
|
+
symbol: 'circle',
|
|
74
|
+
lineWidth: 1,
|
|
75
|
+
lineColor: '#ffffff',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
radius: 5,
|
|
79
|
+
symbol: 'square',
|
|
80
|
+
lineWidth: 1,
|
|
81
|
+
lineColor: '#ffffff',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
radius: 6,
|
|
85
|
+
symbol: 'diamond',
|
|
86
|
+
lineWidth: 1,
|
|
87
|
+
lineColor: '#ffffff',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
radius: 6,
|
|
91
|
+
symbol: 'triangle',
|
|
92
|
+
lineWidth: 1,
|
|
93
|
+
lineColor: '#ffffff',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
15
96
|
};
|
|
16
97
|
|
|
17
98
|
return constants;
|
|
@@ -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);
|
|
@@ -37,6 +43,8 @@ class HighchartsBaseChart {
|
|
|
37
43
|
this.lineChart = new LineChart();
|
|
38
44
|
this.barChart = new BarChart();
|
|
39
45
|
this.columnChart = new ColumnChart();
|
|
46
|
+
this.areaChart = new AreaChart();
|
|
47
|
+
this.scatterChart = new ScatterChart();
|
|
40
48
|
this.extraLines = this.checkForExtraLines();
|
|
41
49
|
if (window.isCommonChartOptionsDefined === undefined) {
|
|
42
50
|
this.setCommonChartOptions();
|
|
@@ -100,7 +108,9 @@ class HighchartsBaseChart {
|
|
|
100
108
|
const specificChartOptions = this.specificChartOptions.getOptions();
|
|
101
109
|
const lineChartOptions = this.lineChart.getLineChartOptions();
|
|
102
110
|
const barChartOptions = this.barChart.getBarChartOptions(this.useStackedLayout);
|
|
103
|
-
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();
|
|
104
114
|
// Merge specificChartOptions with the existing config
|
|
105
115
|
this.config = this.mergeConfigs(this.config, specificChartOptions);
|
|
106
116
|
|
|
@@ -117,15 +127,20 @@ class HighchartsBaseChart {
|
|
|
117
127
|
// Merge the column chart options with the existing config
|
|
118
128
|
this.config = this.mergeConfigs(this.config, columnChartOptions);
|
|
119
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
|
+
}
|
|
120
138
|
|
|
121
139
|
if (this.extraLines > 0) {
|
|
122
140
|
this.config = this.mergeConfigs(this.config, this.lineChart.getLineChartOptions());
|
|
123
141
|
if (this.chartType === 'column') {
|
|
124
142
|
this.config = this.mergeConfigs(this.config, columnChartOptions);
|
|
125
143
|
}
|
|
126
|
-
if (this.chartType === 'bar') {
|
|
127
|
-
this.config = this.mergeConfigs(this.config, barChartOptions);
|
|
128
|
-
}
|
|
129
144
|
}
|
|
130
145
|
|
|
131
146
|
// Disable the legend for single series charts
|
|
@@ -142,27 +157,34 @@ class HighchartsBaseChart {
|
|
|
142
157
|
// Note this is not the same as the viewport width
|
|
143
158
|
// All responsive rules should be defined here to avoid overriding existing rules
|
|
144
159
|
setResponsiveOptions = () => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.
|
|
148
|
-
|
|
160
|
+
let mobileChartOptions = this.commonChartOptions.getMobileOptions(this.xAxisTickIntervalMobile, this.yAxisTickIntervalMobile);
|
|
161
|
+
if (this.chartType === 'column') {
|
|
162
|
+
const mobileColumnChartOptions = this.columnChart.getColumnChartMobileOptions(
|
|
163
|
+
this.config,
|
|
164
|
+
this.useStackedLayout,
|
|
165
|
+
this.extraLines,
|
|
166
|
+
);
|
|
167
|
+
mobileChartOptions = this.mergeConfigs(mobileChartOptions, mobileColumnChartOptions);
|
|
168
|
+
}
|
|
169
|
+
|
|
149
170
|
if (!this.config.responsive) {
|
|
150
171
|
this.config.responsive = {};
|
|
151
172
|
}
|
|
152
|
-
|
|
173
|
+
|
|
153
174
|
let rules = [
|
|
154
175
|
{
|
|
155
176
|
condition: {
|
|
156
177
|
maxWidth: 400,
|
|
157
178
|
},
|
|
158
179
|
chartOptions: {
|
|
159
|
-
...
|
|
180
|
+
...mobileChartOptions,
|
|
160
181
|
},
|
|
161
182
|
},
|
|
162
|
-
// We are using a slightly wider breakpoint for annotations
|
|
163
|
-
// to try and reduce the likelihood of them being automatically
|
|
164
|
-
// hidden by Highcharts
|
|
165
183
|
{
|
|
184
|
+
// If these conditions change, the styling for the footnotes container query in _chart.scss needs to be updated
|
|
185
|
+
// We are using a slightly wider breakpoint for annotations
|
|
186
|
+
// to try and reduce the likelihood of them being automatically
|
|
187
|
+
// hidden by Highcharts
|
|
166
188
|
condition: {
|
|
167
189
|
maxWidth: 600,
|
|
168
190
|
},
|
|
@@ -195,7 +217,7 @@ class HighchartsBaseChart {
|
|
|
195
217
|
this.commonChartOptions.hideDataLabels(currentChart.series);
|
|
196
218
|
}
|
|
197
219
|
if (this.chartType === 'bar') {
|
|
198
|
-
this.barChart.updateBarChartHeight(this.config, currentChart, this.useStackedLayout
|
|
220
|
+
this.barChart.updateBarChartHeight(this.config, currentChart, this.useStackedLayout);
|
|
199
221
|
if (!this.hideDataLabels) {
|
|
200
222
|
this.barChart.postLoadDataLabels(currentChart);
|
|
201
223
|
} else {
|
|
@@ -203,9 +225,11 @@ class HighchartsBaseChart {
|
|
|
203
225
|
}
|
|
204
226
|
}
|
|
205
227
|
if (this.chartType === 'column') {
|
|
206
|
-
this.columnChart.updatePointPadding(this.config, currentChart, this.useStackedLayout, this.extraLines);
|
|
207
228
|
this.commonChartOptions.hideDataLabels(currentChart.series);
|
|
208
229
|
}
|
|
230
|
+
if (this.chartType === 'scatter') {
|
|
231
|
+
this.scatterChart.updateMarkers(currentChart);
|
|
232
|
+
}
|
|
209
233
|
if (this.chartType != 'bar') {
|
|
210
234
|
this.commonChartOptions.adjustChartHeight(currentChart, this.percentageHeightDesktop, this.percentageHeightMobile);
|
|
211
235
|
}
|
|
@@ -215,7 +239,6 @@ class HighchartsBaseChart {
|
|
|
215
239
|
if (this.extraLines > 0) {
|
|
216
240
|
currentChart.series.forEach((series) => {
|
|
217
241
|
if (series.type === 'line') {
|
|
218
|
-
this.lineChart.updateLastPointMarker([series]);
|
|
219
242
|
this.commonChartOptions.hideDataLabels([series]);
|
|
220
243
|
}
|
|
221
244
|
});
|
|
@@ -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
|
|
|
@@ -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
|
},
|
|
@@ -104,14 +102,14 @@ class CommonChartOptions {
|
|
|
104
102
|
rotation: 0,
|
|
105
103
|
style: {
|
|
106
104
|
color: this.constants.axisLabelColor,
|
|
107
|
-
fontSize: this.constants.
|
|
105
|
+
fontSize: this.constants.defaultFontSize,
|
|
108
106
|
},
|
|
109
107
|
},
|
|
110
108
|
title: {
|
|
111
109
|
align: 'high',
|
|
112
110
|
style: {
|
|
113
111
|
color: this.constants.axisLabelColor,
|
|
114
|
-
fontSize: this.constants.
|
|
112
|
+
fontSize: this.constants.defaultFontSize,
|
|
115
113
|
},
|
|
116
114
|
},
|
|
117
115
|
lineColor: this.constants.gridLineColor,
|
|
@@ -147,35 +145,10 @@ class CommonChartOptions {
|
|
|
147
145
|
|
|
148
146
|
getMobileOptions = (xAxisTickInterval, yAxisTickInterval) => {
|
|
149
147
|
return {
|
|
150
|
-
legend: {
|
|
151
|
-
itemStyle: {
|
|
152
|
-
fontSize: this.constants.mobileFontSize,
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
148
|
xAxis: {
|
|
156
|
-
labels: {
|
|
157
|
-
style: {
|
|
158
|
-
fontSize: this.constants.mobileFontSize,
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
title: {
|
|
162
|
-
style: {
|
|
163
|
-
fontSize: this.constants.mobileFontSize,
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
149
|
tickInterval: xAxisTickInterval,
|
|
167
150
|
},
|
|
168
151
|
yAxis: {
|
|
169
|
-
labels: {
|
|
170
|
-
style: {
|
|
171
|
-
fontSize: this.constants.mobileFontSize,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
title: {
|
|
175
|
-
style: {
|
|
176
|
-
fontSize: this.constants.mobileFontSize,
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
152
|
tickInterval: yAxisTickInterval,
|
|
180
153
|
},
|
|
181
154
|
};
|
|
@@ -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
|
+
}}
|
|
@@ -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
|
+
}}
|