Marks text: How to add a % sign?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
serge wautier
Newbie
Newbie
Posts: 22
Joined: Tue Dec 16, 2008 12:00 am

Marks text: How to add a % sign?

Post by serge wautier » Tue Mar 24, 2009 11:46 am

Hi,

I have a bargraph with marks above each bar to display the value. If the value is 78, I want to display 78 %.
If I simply add a % in ValueFormat, it turns to 7800 % !
I noticed that I can avoid this 100 factor by using ValueFormat = ##0 '%
(note the ' before %).
Is this the recommended way to to work? Or is it just a coincidence?

TIA for shedding some light.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue Mar 24, 2009 12:33 pm

Hi serge,

The recommended way to modify your series' marks is using the GetSeriesMark event. For example:

Code: Select all

        Bar bar1;

        private void InitializeChart()
        {
            bar1 = new Bar(tChart1.Chart);
            bar1.FillSampleValues(5);
            bar1.Marks.Visible = true;
            bar1.Marks.Style = MarksStyles.Value;

            bar1.GetSeriesMark += new Series.GetSeriesMarkEventHandler(bar1_GetSeriesMark);
        }

        void bar1_GetSeriesMark(Series series, GetSeriesMarkEventArgs e)
        {
            e.MarkText = e.MarkText + " %";
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

serge wautier
Newbie
Newbie
Posts: 22
Joined: Tue Dec 16, 2008 12:00 am

Post by serge wautier » Tue Mar 24, 2009 1:15 pm

Thanks Yeray!

Post Reply