在Y轴上方缩放Y轴

时间:2022-10-19 09:20:39

在Y轴上方缩放Y轴for this example http://jsfiddle.net/5D5eD/8/. How to increase the Y-axis above X-axis also ?

对于这个例子http://jsfiddle.net/5D5eD/8/。如何在Y轴上方增加Y轴?

 main.append('g')
.attr('transform', 'translate(0,0)')
.attr('class', 'main axis date')
.call(yAxis)

what change should I make in this line .attr('transform', 'translate(0,0)') ?

我应该在这一行中做出什么改变.attr('transform','translate(0,0)')?

1 个解决方案

#1


1  

In order to do this, you need to run the code for plotting the chart again (minus the line plotting part) on another g element that has been translated. In order to do this, it's easiest to wrap the part that draws the graph in a function and call that twice.

为此,您需要运行代码以再次绘制图表(减去线条绘图部分)在已翻译的另一个g元素上。为了做到这一点,最简单的方法是在函数中包装绘制图形的部分并调用它两次。

Complete demo here.

在这里完成演示。

#1


1  

In order to do this, you need to run the code for plotting the chart again (minus the line plotting part) on another g element that has been translated. In order to do this, it's easiest to wrap the part that draws the graph in a function and call that twice.

为此,您需要运行代码以再次绘制图表(减去线条绘图部分)在已翻译的另一个g元素上。为了做到这一点,最简单的方法是在函数中包装绘制图形的部分并调用它两次。

Complete demo here.

在这里完成演示。