Overlapping Text on Graph in ASP.NET

In this blog you will learn Overlapping Text on Graph in ASP.NET

In my recent project I was working on the graph. I found the graph label are too long & it’s overlapping to each other. I search on couple of website to get the solution but couldn’t find any appropriate solution. So I did some experiment with the code found the solution.

chart

I am binding the graph with JSON data that is returning from ActionResult (MVC). To fix the above issue I come across with simple solution, you just need to add newline character between your label texts.

Server Code: \\n

Note: If you are in server side you must use the \\ so that java script can treat it as special character inside the string. Otherwise you will get below JavaScript error.

Syntax Error: JSON.parse: bad control character in string literal at line 1 column 2027 of the JSON data.

Java Script: you just need to use the \n.

DataBase: \\n

Thanks
Kamal Samant