Page 1 of 2

Posted: Fri May 22, 2009 9:39 am
by 10050769
Hello shikha,

I make a simple example using custom labels, please check that next code works fine in your application.

InitializeChart():

Code: Select all

        private void InitializeChart()
        {
            Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar.FillSampleValues(30);
            bar.Marks.Visible = false;
            for (int i = 0; i < bar.Count; i++)
            {
                bar.Labels.Add("point index " + i.ToString());   
            }

            tChart1.Axes.Bottom.Labels.Angle = 90;
            tChart1.Axes.Bottom.Labels.Items.Clear();

            for (int i = 0; i < bar.Count; i++)
            {
                tChart1.Axes.Bottom.Labels.Items.Add(bar.XValues[i], bar.Labels[i]);
            }
        }
If you want a more advanced code for solve the possibles problems of overlap you could see this theardspecifically the last pages, that there are specific examples and the all possibilities if you can use to fix your issue.

I hope that will helps,

Thanks,

Posted: Fri May 22, 2009 10:22 am
by 13045482
hey but u are only setting it to 90 degrees which i have already done. but still i m getting error. please let me know if i have missed something i ur code. i can not use your code directly as i have other processing in my code. so if u can tell me what eactly will make a adifference , it will be great. thanks in advance.

Posted: Fri May 22, 2009 11:45 am
by yeray
Hi shikha,

Do all the points you've added have labels? Note that if you've added some of your points with labels and others without, the axis will be set to show the labels but most of them are empty. For example:

Code: Select all

Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
bar.Marks.Visible = false;

bar.Add(10);
bar.Add(20, "point index 1");
bar.Add(50);
bar.Add(30);
bar.Add(10, "point index 4");

tChart1.Axes.Bottom.Labels.Angle = 90;
If that's not your situation, please, try to reproduce your problem in a simple example project we can run as-is to reproduce it here.
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Posted: Fri May 22, 2009 12:13 pm
by 13045482
Hi
no its not the case . i am adding all points. i can say that because
when i set tcStraAssessRC.Page.MaxPointsPerPage = 4 , I can see all labels and the bars are also clearly shown.

But when i set tcStraAssessRC.Page.MaxPointsPerPage = 10 then i can not see some labels and bars are also diminished in size( in width).

Posted: Fri May 22, 2009 3:19 pm
by yeray
Hi shikha,

I suspect that your chart may be too short to show as many labels in its bottom axis but it would be easier to see what's happening if you could send us a simple example project we can run as-is to reproduce the problem here.

legend with scrollbar

Posted: Fri May 22, 2009 4:34 pm
by 13045482
Hi
Plesae let me know is there any way to have a scrollbar in legend. The isssue is my legend contains 40 values and only 10 are showing up.Thanks

Posted: Mon May 25, 2009 7:19 am
by yeray
Hi shikha,

In that case, you may be interested on Legend Scroll Bar Tool. Please, take a look at the example
All Features\Welcome !\Miscellaneous\Legend\Legend ScrollBar Tool from TeeChart Feature Demo. You'll find tutorials and demos at TeeChart's program group.

Posted: Mon May 25, 2009 2:51 pm
by 13045482
Hey
Thanks so much, this really looks good..

Posted: Mon May 25, 2009 2:58 pm
by 13045482
Also
I have foound my other issue , I can explain it better now. Actually my labels are VERY long( that is they have around 20-40 characters). So when i set them to
tcStraAssessRC.Axes.Bottom.Labels.Angle = 90

this solves my preoblem of seeing all labels BUT as they are very long they make chart very small ( so the axis is changed and bars become very small respectively as now the labels take most of teh space).

This can be seen in your FEATURE DEMO-ALL features-Basic features-
tChart1.Series.Clear();

tChart1.Series.Add(new Steema.TeeChart.Styles.Bar());
tChart1.Series[0].Clear();
tChart1.Series[0].Add(123, "ABC", Color.Red);
tChart1.Series[0].Add( 456, "DEF", Color.Blue );
tChart1.Series[0].Add( 321, "GHI", Color.Green );

Change the bar Marks :

tChart1.Series[0].Marks.Style = smsValue ;
If i set Axes.Bottom.Labels.Angle = 90, then you can see the chart goes little up and the bars become little small and the axes also changes from 500 to 600.

So as my labels are very big and I want to display them, the chart becomes too small. IS there a solution for this? Thanks in advance.

Posted: Mon May 25, 2009 3:00 pm
by 13045482
Also do we have anything like CHART scrollbar, so that in limited space, we can have this to show everything- chart, lengthy labels without comprimising with the visisbility of chart/bars. thanks.

Posted: Tue May 26, 2009 8:16 am
by 10050769
Hello shikha,

I recomend that see this theardspecifically from page 3 until the last. Where you have explained advanced code for solve the size of words. Also there are all cases of possible if you works with labels axes.


I hope that helps you.


Thanks,

Posted: Tue May 26, 2009 12:02 pm
by 13045482
hI
tHANKS FOR The REPLY. But going through it , i found that the only solution is to use Vertical orientation of labels. But what if I dont want Vertical orienation and still want to show all labels?

Posted: Tue May 26, 2009 1:19 pm
by 13045482
Hi
Its a bit urgent, awaiting ur reply

Posted: Tue May 26, 2009 1:21 pm
by 13045482
sorry for not being clear, what i meant was that showing labels vertically will reduce chart size. how to counter that side effect? Thanks

Posted: Tue May 26, 2009 3:19 pm
by yeray
Hi shikha,

Maybe a good tip for you could be reducing text size:

Code: Select all

tChart1.Axes.Bottom.Labels.Font.Size = 6;
Also, another possibility could be adding a line break into your label strings:

Code: Select all

        private void InitializeChart()
        {
            chartController1.Chart = tChart1;
            
            tChart1.Series.Add(new Steema.TeeChart.Styles.Bar());
            tChart1.Series[0].Add(123, "really long long label 1", Color.Red);
            tChart1.Series[0].Add(456, "really long long label 2", Color.Blue);
            tChart1.Series[0].Add(321, "really long long label 3", Color.Green);

            tChart1.Axes.Bottom.Labels.Angle = 90;

            tChart1.GetAxisLabel += new Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel);
        }

        void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
        {
            if (e.LabelText.Length > 16)
            {
                string tmp1 = e.LabelText.Substring(0, 16);
                string tmp2 = e.LabelText.Substring(16, e.LabelText.Length-16);
                
                e.LabelText = string.Format("{0}{1}{2}", tmp1, "\n", tmp2); 
            }
        }