Page 1 of 1

Marks text: How to add a % sign?

Posted: Tue Mar 24, 2009 11:46 am
by 13051164
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.

Posted: Tue Mar 24, 2009 12:33 pm
by yeray
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 + " %";
        }

Posted: Tue Mar 24, 2009 1:15 pm
by 13051164
Thanks Yeray!