Visualization of the secondary structure of RNA (or any graph, for that matter) is algorithmically a complex problem. You need to make sure that there are as few overlaps as possible while maintaining consistent link lengths. As the other answers pointed out, there are a number of existing implementations that you can already use. I'll just add another one that is fairly easy to use and does not require a download:
forna - nibiru.tbi.univie.ac.at/forna
Here you just need to enter a dot chain string:
>molecule_name CGCUUCAUAUAAUCCUAAUGAUAUGGUUUGGGAGUUUCUACCAAGAGCCUUAAACUCUUGAUUAUGAAGUG ((((((((((..((((((.........))))))......).((((((.......))))))..)))))))))
This will give you a visualization that looks something like this:

This is calculated using a combination of the ViennaRNA RNAplot program and the radiation pattern algorithm using d3.
source share