Plot function y = tan(yx) Could you help me to understand this expression y = tan(yx)?
Desmos.com renders it like image below:

I am trying to write a function to do similar in JavaScript.
To do so, I have to rearrange it in this way:
y = tan(xy)
tan-1(y) = xy
x = tan-1(y)/y
But, this expression only draws the middle line?
What am I doing wrong?
Need to understand how to rearrange y=tan(xy) expression to get something similar to the first illustration with JavaScript or any other programming language.

 A: The function $\tan^{-1}$ always gives an answer between $-\frac\pi2$ and $\frac\pi2$.  The complete solution of $b=\tan a$ is
$$x=\tan^{-1}b+k\pi\ ,\quad\hbox{$k$ is an integer.}$$
So in your case,
$$xy=\tan^{-1}y+k\pi\ .$$
You have implicitly assumed that $k$ has one specific value ($k=0$), which is why you have only got one curve instead of many.
A: To elaborate on Davids answer, we consider standard $\tan^{-1}(x)$ function $\Bbb R \to (-\frac{\pi}{2}, \frac{\pi}{2})$. From the equation $y = \tan(yx)$ you can very well say 
$$\tan^{-1}(y) = \tan^{-1}(\tan(yx))$$
Now we cannot simplify right side to simply $yx$! Now since the range of $\tan^{-1}()$ is $(-\frac{\pi}{2}, \frac{\pi}{2})$, $\tan^{-1}(\tan(yx)) = yx$ if and only $yx \in (-\frac{\pi}{2}, \frac{\pi}{2})$.
For other values of $yx$, say if $yx \in (\frac{\pi}{2}, \frac{3\pi}{2})$ then $yx - \pi \in (-\frac{\pi}{2}, \frac{\pi}{2})$. Thus for this we get $$\tan^{-1}(\tan(yx))= \tan^{-1}(\tan(yx-\pi)) = yx - \pi$$
Similarly say $yx \in (-\frac{3\pi}{2}, -\frac{\pi}{2})$ then $yx+\pi \in (-\frac{\pi}{2}, \frac{\pi}{2})$ and so $$\tan^{-1}(\tan(yx))= \tan^{-1}(-\tan(yx+\pi)) = -yx - \pi$$
