2. If the circle $x^{2}+y^{2}=n^{2}$ covers at least one maximum point and one minimum point of the function $f(x)=\sqrt{3} \sin \frac{\pi x}{n}$, then the minimum value of the positive integer $n$ is ( ).
(A) 1
(-B) 2
(C) 3
(D) 4
2. B.

Since $f(x)=\sqrt{3} \sin \frac{\pi x}{n}$ is an odd function, its graph is symmetric about the origin. Therefore, the circle $x^{2}+y^{2}=n^{2}$ only needs to cover one of the extreme points of $f(x)$. Let $\frac{\pi x}{n}=\frac{\pi}{2}$, solving this gives the nearest maximum point $P\left(\frac{n}{2}, \sqrt{3}\right)$ to the origin. According to the problem, $n^{2} \geqslant\left(\frac{n}{2}\right)^{2}+(\sqrt{3})^{2}$, the smallest positive integer value of $n$ is 2.