diff --git a/src/components/d3/renders/area.ts b/src/components/d3/renders/area.ts index 73965cd..f183182 100644 --- a/src/components/d3/renders/area.ts +++ b/src/components/d3/renders/area.ts @@ -13,15 +13,16 @@ export const renderArea = >( let area = d3.area() - if (chart.y0) { - area = area.y0(chart.y0) + if ('y0' in chart) { + area = area.y0(yAxis(chart.y0 ?? 0)) .y1(d => yAxis(chart.y(d))) + console.log('setting const y') } else { area = area.y(d => yAxis(chart.y(d))) } - if (chart.x0) { - area = area.x0(chart.x0) + if ('x0' in chart) { + area = area.x0(xAxis(chart.x0 ?? 0)) .x1(d => xAxis(chart.x(d))) } else { area = area.x(d => xAxis(chart.x(d))) @@ -52,6 +53,7 @@ export const renderArea = >( .duration(chart.animDurationMs || 0) .attr('d', area(data as any)) .attr('stroke-dasharray', chart.dash ? String(chart.dash) : null) + .attr('fill', chart.areaColor ?? null) return data }