Skip to content

Commit 799ec74

Browse files
committed
Make sure to reset the style of the axes when setting positions.
1 parent 08fbb24 commit 799ec74

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/chart.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,14 @@ export class Chart extends EventEmitter.EventEmitter {
8080
static cache: Record<string, Chart> = {}
8181

8282
private readonly id: string
83+
8384
readonly markerId: string
84-
public options: FunctionPlotOptions
85+
8586
public meta: ChartMeta
87+
/**
88+
* options are the input options sent to function plot.
89+
*/
90+
public options: FunctionPlotOptions
8691

8792
/**
8893
* Array of function-plot instances linked to the events of this instance,
@@ -628,7 +633,7 @@ export class Chart extends EventEmitter.EventEmitter {
628633
const canvas = instance.canvas.merge(instance.canvas.enter)
629634

630635
// Draw the x-axis
631-
canvas.select('.x.axis').call(instance.meta.xAxis)
636+
canvas.select('.x.axis').attr('transform', `translate(0, ${this.meta.height})`).call(instance.meta.xAxis)
632637

633638
if (this.options.x.position === 'sticky') {
634639
const yMin = this.meta.yScale.domain()[0]
@@ -648,7 +653,7 @@ export class Chart extends EventEmitter.EventEmitter {
648653
}
649654

650655
// Draw the y-axis
651-
canvas.select('.y.axis').call(instance.meta.yAxis)
656+
canvas.select('.y.axis').attr('transform', `translate(0, 0)`).call(instance.meta.yAxis)
652657

653658
if (this.options.y.position === 'sticky') {
654659
const xMin = this.meta.xScale.domain()[0]

0 commit comments

Comments
 (0)