From 63ba27d58aaa8026d5c8047354ddc63f391ce49e Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 29 Nov 2024 23:07:55 -0600 Subject: [PATCH] fix --- scripts/posts/models-of-production.js | 59 ++++++++------------------- 1 file changed, 16 insertions(+), 43 deletions(-) diff --git a/scripts/posts/models-of-production.js b/scripts/posts/models-of-production.js index ae3afef..29bd8ee 100644 --- a/scripts/posts/models-of-production.js +++ b/scripts/posts/models-of-production.js @@ -92,8 +92,7 @@ function drawSolowGraph() { .attr("y", y(outputData[K_MAX - 1].Y)) .append("xhtml:body") .style("font-size", "0.75em") - .html(`
`); - katex.render("Y", document.querySelector(".solow-visualization-y")); + .html(`\\(Y\\)`); const depreciationData = Array.from({ length: K_MAX }, (_, k) => ({ K: k, @@ -121,8 +120,8 @@ function drawSolowGraph() { .attr("y", y(depreciationData[K_MAX - 1].Y)) .append("xhtml:body") .style("font-size", "0.75em") - .html(`
`); - katex.render("\\bar{d}K", document.querySelector(".solow-visualization-d")); + .append("xhtml:div") + .html("\\(\\bar{d}K\\)"); const investmentData = outputData.map((d) => ({ K: d.K, @@ -150,8 +149,7 @@ function drawSolowGraph() { .attr("y", y(investmentData[K_MAX - 1].Y)) .append("xhtml:body") .style("font-size", "0.75em") - .html(`
`); - katex.render("I", document.querySelector(".solow-visualization-i")); + .html("\\(I\\)"); const k_star = L * Math.pow((s * A) / d, 1 / (1 - alpha)); svg @@ -169,15 +167,11 @@ function drawSolowGraph() { .append("foreignObject") .attr("width", "20em") .attr("height", "2em") - .attr("x", x(k_star) - 150) - .attr("y", y(y_star) - 50) + .attr("x", x(k_star) - 40) + .attr("y", y(y_star) - 40) .append("xhtml:body") .style("font-size", "0.75em") - .html(`
`); - katex.render( - `(K^*,Y^*)=(${k_star.toFixed(0)},${y_star.toFixed(0)})`, - document.querySelector(".solow-visualization-eq"), - ); + .html(`(${k_star.toFixed(0)}, ${y_star.toFixed(0)})`); } const formatNumber = (num) => { @@ -191,12 +185,9 @@ const updateRomerTable = (romerData) => { const rowA_t = document.getElementById("row-A_t"); const rowY_t = document.getElementById("row-Y_t"); - tableHeader.innerHTML = `
`; - katex.render(`t`, document.querySelector(".romer-table-time")); - rowA_t.innerHTML = ``; - rowY_t.innerHTML = ``; - katex.render("A_t", document.querySelector(".romer-table-at")); - katex.render("Y_t", document.querySelector(".romer-table-yt")); + tableHeader.innerHTML = `t`; + rowA_t.innerHTML = `A_t`; + rowY_t.innerHTML = `Y_t`; romerData.forEach((d) => { if (d.year % 20 === 0 || d.year === 1) { @@ -291,8 +282,7 @@ function drawRomerGraph() { .attr("y", y(romerData[T_MAX - 1].Y)) .append("xhtml:body") .style("font-size", "0.75em") - .html(`
`); - katex.render("log_{10}Y", document.querySelector(".romer-visualization-y")); + .html(`\\(log_{10}Y\\)`); updateRomerTable(romerData); } @@ -398,11 +388,7 @@ function drawRomerlGraph() { .attr("y", y(romerData[0].Y)) .append("xhtml:body") .style("font-size", "0.6em") - .html(`
`); - katex.render( - `\\bar{l}_0=${l_}`, - document.querySelector(".romer-changel-before"), - ); + .html(`\\(\\bar{l}_0=${l_}\\)`); svg .append("foreignObject") @@ -412,11 +398,7 @@ function drawRomerlGraph() { .attr("y", y(romerData[t0].Y)) .append("xhtml:body") .style("font-size", "0.6em") - .html(`
`); - katex.render( - `\\bar{l}_1=${l}`, - document.querySelector(".romer-changel-after"), - ); + .html(`\\(\\bar{l}_1=${l}\\)`); svg .append("foreignObject") @@ -426,8 +408,7 @@ function drawRomerlGraph() { .attr("y", y(romerData[T_MAX - 1].Y)) .append("xhtml:body") .style("font-size", "0.75em") - .html(`
`); - katex.render("log_{10}Y", document.querySelector(".romer-changel-y")); + .html(`\\(log_{10}Y\\)`); } function calculateRomerSolowData( @@ -552,11 +533,7 @@ function drawRomerSolowGraph() { .attr("y", y(romerSolowData[T_MAX - 1].Y)) .append("xhtml:body") .style("font-size", "0.75em") - .html(`
`); - katex.render( - "log_{10}Y", - document.querySelector(".romer-solow-visualization-y"), - ); + .html(`\\(log_{10}Y\\)`); } function drawRomerSolowChangeGraph() { @@ -666,11 +643,7 @@ function drawRomerSolowChangeGraph() { .attr("y", y(romerSolowData[T_MAX - 1].Y)) .append("xhtml:body") .style("font-size", "0.75em") - .html(`
`); - katex.render( - "log_{10}Y", - document.querySelector(".romer-solow-change-visualization-y"), - ); + .html(`\\(log_{10}Y\\)`); } document.addEventListener("DOMContentLoaded", function () {