Format ValueMarkText

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lilo
Newbie
Newbie
Posts: 61
Joined: Thu Sep 23, 2010 12:00 am

Format ValueMarkText

Post by lilo » Sun Oct 31, 2010 1:58 am

I am using:

AnnotationChart4.Text = "Point: " & AIndex.ToString() + Value: " & Ternary1.ValueMarkText(AIndex)

How do I format the ValueMarkText?

I have tried TChart1.Series(0).ValueFormat = "##0"

lilo
Newbie
Newbie
Posts: 61
Joined: Thu Sep 23, 2010 12:00 am

Re: Format ValueMarkText

Post by lilo » Sun Oct 31, 2010 11:19 am

I have also tried:

TChart1.Series(0).ValueFormat = String.Format("##0")

and

AnnotationChart4.Text = String.Format("Point: {0} Value: {1:##0}", AIndex.ToString(), Ternary1.ValueMarkText(AIndex))

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Format ValueMarkText

Post by Sandra » Tue Nov 02, 2010 2:15 pm

Hello lilo,

I have reproduce your problem and I have added it as Feature request with number [TF02015258] to be considered for inclusion in futures versions of TeeChart.Net.
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Format ValueMarkText

Post by Narcís » Tue Nov 02, 2010 2:57 pm

Hi lilo,

You can also split mark text string and format it as in this example:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        private Steema.TeeChart.Tools.Annotation annotation1;
        private Steema.TeeChart.Styles.Ternary ternary1;

        private void InitializeChart()
        {
            ternary1 = new Steema.TeeChart.Styles.Ternary(tChart1.Chart);
            ternary1.FillSampleValues();

            annotation1 = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
            tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
            
        }

        void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            int index = ternary1.Clicked(e.X, e.Y);

            if (index != -1)
            {
                string tmp = ternary1.ValueMarkText(index);
                string[] tmpArray = tmp.Split(' ');

                tmp = " ";

                for (int i = 0; i < tmpArray.Length; i++)
                {
                    tmp += String.Format("{0:##0}", tmpArray[i]) + " ";
                }

                annotation1.Text = String.Format("Point: {0} Value: {1}", index.ToString(), tmp);   
            }

            double m = 5;
            this.Text = String.Format("{0:##0}", m.ToString());            
        }
If this doesn't help please let us know what do you want to get exactly.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

lilo
Newbie
Newbie
Posts: 61
Joined: Thu Sep 23, 2010 12:00 am

Re: Format ValueMarkText

Post by lilo » Tue Nov 02, 2010 10:14 pm

This is the solution to my problem.

lilo
Newbie
Newbie
Posts: 61
Joined: Thu Sep 23, 2010 12:00 am

Re: Format ValueMarkText

Post by lilo » Wed Nov 03, 2010 9:56 am

This code worked:

Dim tmp As String, tmp1 As String, tmp2 As String, tmp3 As String, tmparray() As String
tmp = Ternary1.ValueMarkText(AIndex)
tmparray = tmp.Split(" ")
tmp = " "
tmp1 = Format(Val(tmparray(0)), "##0")
tmp2 = Format(Val(tmparray(1)), "##0")
tmp3 = Format(Val(tmparray(2)), "##0")
AnnotationChart4.Text = String.Format("Point: {0} {4}Value: {1} {2} {3}", AIndex.ToString(), tmp1, tmp2, tmp3, vbCrLf)

Post Reply