You can do this by limiting the number of characters entered into the data source.
OR
In your SQL Procedure, you can add ellipses (or something to that effect) after a certain number of characters
You can do this by limiting the number of characters entered into the data source.
OR
In your SQL Procedure, you can add ellipses (or something to that effect) after a certain number of characters
Do it at the database layer in your SQL statement. If characters exceed a certain length (e.g. 15), return just first 15 characters.
I was hoping for a solution that would be specific to the ASP.NET charting controls.
Seeing no clear answer for the charting controls, it was time to move to the source data. I was hesitant to substring
the names from the columns to a custom length because that sproc was being reused/consumed by other form elements on other pages - a gridview
.
The solution was to create a NEW COLUMN called DisplayName
on the resultset in the stored proc. Instead of modifying the existing, I simply included a new column:
SELECT
SomeName
,COUNT(SomeName) AS SomeNumber
,SUBSTRING(SomeName,0,15) AS DisplayName
This isn't an expensive solution in terms of development, research, time, and processing cost, so it's a win. Most times the presentation tier should take care of these issues, but in this case, the faster solution works when there isn't a clear solution at the presentation tier.
Thanks to Russ and waqasahmed!