Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Mon Mar 09, 2020 4:39 pm

Greetings, I could use a bit of help replacing underscore characters with spaces on my category labels. This is the c# code that creates those labels for the chart.

Code: Select all
            for (int i = 0; i < chart1.Series.Count; i++)
            {
                ChartSeriesDataFormat series = chart1.Series[i];
                for (int j = 0; j < series.Values.Count; j++)
                {
                    ChartDataLabel label = series.DataLabels.Add();
                    label.ID = j;
                    label.LabelValueVisible = true;                   
                    label.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 10;
                    label.TextProperties.Paragraphs[0].DefaultCharacterProperties.LatinFont = new TextFont("Arial Narrow");
                }
            }


Can I do the replace here or do I need to do it elsewhere? I'm using a dataadapter that populates the datatable which drives the chart.

dbrewerton-1
 
Posts: 7
Joined: Tue Mar 03, 2020 7:40 pm

Mon Mar 09, 2020 5:55 pm

I decided to take the path of least resistance and alter the results coming from my database view. The query is something like this (posting to help others):
Code: Select all
"SELECT Replace(Name, '_', ' ') FROM Table;"


SO if you have a name like [My_Column], the query will automatically convert that to [My Column].

dbrewerton-1
 
Posts: 7
Joined: Tue Mar 03, 2020 7:40 pm

Tue Mar 10, 2020 3:31 am

Hello,

Thanks for your post and sharing your workaround.
If you need further assistance, please feel free to contact us.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Presentation