Maybe I'm misinterpreting your requirement, but I believe your requirement is covered in the Chart/Database
The legend is configured to dynamically display the categories from the data source. See the description:
The above charts are databound to a SqlDataSource Control.
The first chart shows how to display the results from different categories, grouped by the category name. The X axis labels show the corresponding years. The RadChart1.Legend.Appearance.GroupNameFormat is set to "#VALUE" so the legend items display the actual category name. More details about this property are available in this help topic.
Hope this helps!