Skip to content

Commit b03da7a

Browse files
authored
Merge pull request #4361 from ccnmtl/mathml
Update Small Economy trade graph to use MathML
2 parents d3346f7 + f39dfb7 commit b03da7a

File tree

1 file changed

+37
-16
lines changed

1 file changed

+37
-16
lines changed

media/js/src/graphs/InternationalTradeAndTariffsGraph.js

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,30 @@ const dwl = function(c, b, a, d, wp, t) {
114114
};
115115

116116
export class InternationalTradeAndTariffsGraph extends Graph {
117+
static qdhLabel = '<math><msubsup><mo>Q</mo><mn>D</mn><mn>H</mn></msubsup></math>';
118+
static qshLabel = '<math><msubsup><mo>Q</mo><mn>S</mn><mn>H</mn></msubsup></math>';
119+
117120
static getGraphPane(gFunctionChoice, gA1, gA2, gA3, gA4, gA5, gA6) {
118121
let lineItems = [];
119122

120123
if (gFunctionChoice === 0) {
121124
lineItems = [
122125
{
123-
label: 'Domestic Quantity Bought, Q<sup>H</sup><sub>D</sub>',
126+
label: 'Domestic Quantity Bought, ' +
127+
InternationalTradeAndTariffsGraph.qdhLabel,
124128
color: 'red',
125129
value: eqd(gA1, gA2, gA3, gA4, gA5).toFixed(2)
126130
},
127131
{
128-
label: 'Domestic Quantity Produced, Q<sup>H</sup><sub>S</sub>',
132+
label: 'Domestic Quantity Produced, ' +
133+
InternationalTradeAndTariffsGraph.qshLabel,
129134
color: 'red',
130135
value: eqs(gA1, gA2, gA3, gA4, gA5).toFixed(2)
131136
},
132137
{
133-
label: 'Domestic Trade Balance, Q<sup>H</sup><sub>S</sub>-Q<sup>H</sup><sub>D</sub>',
138+
label: 'Domestic Trade Balance, ' +
139+
InternationalTradeAndTariffsGraph.qshLabel + '-' +
140+
InternationalTradeAndTariffsGraph.qdhLabel,
134141
color: 'red',
135142
value: (
136143
eqd(gA1, gA2, gA3, gA4, gA5) -
@@ -141,17 +148,21 @@ export class InternationalTradeAndTariffsGraph extends Graph {
141148
} else if (gFunctionChoice === 1) {
142149
lineItems = [
143150
{
144-
label: 'Domestic Quantity Bought, Q<sup>H</sup><sub>D</sub>',
151+
label: 'Domestic Quantity Bought, ' +
152+
InternationalTradeAndTariffsGraph.qdhLabel,
145153
color: 'red',
146154
value: eqd(gA1, gA2, gA3, gA4, gA5).toFixed(2)
147155
},
148156
{
149-
label: 'Domestic Quantity Produced, Q<sup>H</sup><sub>S</sub>',
157+
label: 'Domestic Quantity Produced, ' +
158+
InternationalTradeAndTariffsGraph.qshLabel,
150159
color: 'red',
151160
value: eqs(gA1, gA2, gA3, gA4, gA5).toFixed(2)
152161
},
153162
{
154-
label: 'Domestic Trade Balance, Q<sup>H</sup><sub>S</sub>-Q<sup>H</sup><sub>D</sub>',
163+
label: 'Domestic Trade Balance, ' +
164+
InternationalTradeAndTariffsGraph.qshLabel + '-' +
165+
InternationalTradeAndTariffsGraph.qdhLabel,
155166
color: 'red',
156167
value: (
157168
eqd(gA1, gA2, gA3, gA4, gA5) -
@@ -177,25 +188,29 @@ export class InternationalTradeAndTariffsGraph extends Graph {
177188
} else if (gFunctionChoice === 2) {
178189
lineItems = [
179190
{
180-
label: 'Domestic Quantity Bought, Q<sup>H</sup><sub>D</sub>',
191+
label: 'Domestic Quantity Bought, ' +
192+
InternationalTradeAndTariffsGraph.qdhLabel,
181193
color: 'red',
182194
value: eqd(gA1, gA2, gA3, gA4, gA5).toFixed(2)
183195
},
184196
{
185-
label: 'Domestic Quantity Produced, Q<sup>H</sup><sub>S</sub>',
197+
label: 'Domestic Quantity Produced, ' +
198+
InternationalTradeAndTariffsGraph.qshLabel,
186199
color: 'red',
187200
value: eqs(gA1, gA2, gA3, gA4, gA5).toFixed(2)
188201
},
189202
{
190-
label: 'Domestic Trade Balance, Q<sup>H</sup><sub>S</sub>-Q<sup>H</sup><sub>D</sub>',
203+
label: 'Domestic Trade Balance, ' +
204+
InternationalTradeAndTariffsGraph.qshLabel + '-' +
205+
InternationalTradeAndTariffsGraph.qdhLabel,
191206
color: 'red',
192207
value: (
193208
eqd(gA1, gA2, gA3, gA4, gA5) -
194209
eqs(gA1, gA2, gA3, gA4, gA5)
195210
).toFixed(2)
196211
},
197212
{
198-
label: 'Domestic Price, P<sup>t</sup><sub>H</sub>',
213+
label: 'Domestic Price, <math><msubsup><mo>P</mo><mn>H</mn><mn>t</mn></msubsup></math>',
199214
color: 'red',
200215
value: (gA5 + gA6).toFixed(2)
201216
},
@@ -211,25 +226,29 @@ export class InternationalTradeAndTariffsGraph extends Graph {
211226
} else if (gFunctionChoice === 3) {
212227
lineItems = [
213228
{
214-
label: 'Domestic Quantity Bought, Q<sup>H</sup><sub>D</sub>',
229+
label: 'Domestic Quantity Bought, ' +
230+
InternationalTradeAndTariffsGraph.qdhLabel,
215231
color: 'red',
216232
value: eqd(gA1, gA2, gA3, gA4, gA5).toFixed(2)
217233
},
218234
{
219-
label: 'Domestic Quantity Produced, Q<sup>H</sup><sub>S</sub>',
235+
label: 'Domestic Quantity Produced, ' +
236+
InternationalTradeAndTariffsGraph.qshLabel,
220237
color: 'red',
221238
value: eqs(gA1, gA2, gA3, gA4, gA5).toFixed(2)
222239
},
223240
{
224-
label: 'Domestic Trade Balance, Q<sup>H</sup><sub>S</sub>-Q<sup>H</sup><sub>D</sub>',
241+
label: 'Domestic Trade Balance, ' +
242+
InternationalTradeAndTariffsGraph.qshLabel + '-' +
243+
InternationalTradeAndTariffsGraph.qdhLabel,
225244
color: 'red',
226245
value: (
227246
eqd(gA1, gA2, gA3, gA4, gA5) -
228247
eqs(gA1, gA2, gA3, gA4, gA5)
229248
).toFixed(2)
230249
},
231250
{
232-
label: 'Domestic Price, P<sup>t</sup><sub>H</sub>',
251+
label: 'Domestic Price, <math><msubsup><mo>P</mo><mn>H</mn><mn>t</mn></msubsup></math>',
233252
color: 'red',
234253
value: (gA5 + gA6).toFixed(2)
235254
},
@@ -327,9 +346,11 @@ export class InternationalTradeAndTariffsGraph extends Graph {
327346
);
328347

329348
this.showIntersection(
330-
this.l1, this.l3, false, 'Q<sup>H</sup><sub>S</sub>');
349+
this.l1, this.l3, false,
350+
InternationalTradeAndTariffsGraph.qshLabel);
331351
this.showIntersection(
332-
this.l2, this.l3, false, 'Q<sup>H</sup><sub>D</sub>');
352+
this.l2, this.l3, false,
353+
InternationalTradeAndTariffsGraph.qdhLabel);
333354
}
334355
}
335356

0 commit comments

Comments
 (0)