{
const width = 500;
const height = 500;
const margin = { top: 20, right: 20, bottom: 20, left: 20 };
const svg = d3.select(DOM.svg(width, height));
svg.attr('width', width + margin.left + margin.right)
.attr('height', height + margin.top + margin.bottom)
.append('g')
.attr('transform', `translate(${margin.left}, ${margin.top})`);
const xScale = d3.scaleLinear().domain([0, 1]).range([0, width]);
const yScale = d3.scaleLinear().domain([0, 1]).range([height, 0]);
const xAxis = d3.axisBottom(xScale).tickFormat(d3.format('.2f')).tickSize(-height);
const yAxis = d3.axisLeft(yScale).tickFormat(d3.format('.2f')).tickSize(-width);
svg.append('g')
.attr('class', 'x-axis')
.attr('transform', `translate(0, ${height})`)
.call(xAxis);
svg.append('g')
.attr('class', 'y-axis')
.call(yAxis);
for (let i = 0; i <= 90; i += 15) {
const radians = i * Math.PI / 180;
const x2 = 1;
const y2 = 1/Math.tan(radians);
svg.append('line')
.attr('x1', xScale(0))
.attr('y1', yScale(0))
.attr('x2', xScale(x2))
.attr('y2', yScale(y2))
.attr('stroke', 'black')
.attr('stroke-width', 2)
.attr('stroke-dasharray', '4 2');
}
svg.append('text')
.attr('x', xScale(0.5))
.attr('y', height + 15)
.attr('text-anchor', 'middle')
.text('B04');
svg.append('text')
.attr('x', -15)
.attr('y', yScale(0.5))
.attr('text-anchor', 'end')
.text('B08')
.attr('transform', 'rotate(-90, -15, ' + yScale(0.5) + ')');
return svg.node();
}