Page 1 of 1

Format ValueMarkText

Posted: Sun Oct 31, 2010 1:58 am
by 15057312
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"

Re: Format ValueMarkText

Posted: Sun Oct 31, 2010 11:19 am
by 15057312
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))

Re: Format ValueMarkText

Posted: Tue Nov 02, 2010 2:15 pm
by 10050769
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.

Re: Format ValueMarkText

Posted: Tue Nov 02, 2010 2:57 pm
by narcis
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.

Re: Format ValueMarkText

Posted: Tue Nov 02, 2010 10:14 pm
by 15057312
This is the solution to my problem.

Re: Format ValueMarkText

Posted: Wed Nov 03, 2010 9:56 am
by 15057312
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)