drawTernaryPlot = someTernaryPlot => {
const svg = d3.select(DOM.svg(width, height));
const radius = someTernaryPlot.radius();
const chart = svg
.append("g")
.attr("transform", `translate(${width / 2} ${height / 2 + yOffset})`)
.attr("height", 300)
.attr("font-family", "sans-serif")
.attr("id", "chart")
.on("mousemove", d => {
const xy = d3.pointer(d);
mutable inverse = afmDiagram.invert(xy);
});
const defs = chart.append("defs");
const clipPath = defs
.append("clipPath")
.attr("id", "trianglePath")
.append("path")
.attr("d", someTernaryPlot.triangle());
const axisLabelsGroup = chart
.append("g")
.attr("class", "axis-labels")
.call(axisLabels, someTernaryPlot.axisLabels());
const gridLinesPaths = someTernaryPlot
.gridLines()
.map(axisGrid => axisGrid.map(d3.line()).join(" "));
const gridGroup = chart
.append("g")
.attr("class", "grid")
.call(grid, gridLinesPaths);
const axisTicksGroups = chart
.append("g")
.attr("class", "ternary-ticks")
.attr("font-size", 10)
.selectAll("g")
.data(someTernaryPlot.ticks())
.join("g")
.attr("class", "axis-ticks");
const trianglePath = chart
.append("path")
.attr("d", someTernaryPlot.triangle())
.attr("id", "triangle")
.attr("fill", "none")
.attr("stroke", "black")
.attr("stroke-width", 2);
axisTicksGroups.call(ticks);
const dividingPath = chart
.append("path")
.attr("id", "divide")
.attr("d", makeCurvedLine(dividingLineTernary))
.attr("fill", "none")
.attr("stroke", "black")
.attr("stroke-width", 2);
return svg.node();
}