Page 1 of 1

Chart Display with Vertical Bottom Axis Labels of Large Size

Posted: Mon Jul 19, 2010 1:44 pm
by 13045482
Hi,

When I'm having a chart whose Labels are need to be displayed vertically and labels are very large. Charts in the grid (Y Axis) is not displayed properly. Is it possible to have a scroll bar so that user can see the chart properly.

Re: Chart Display with Vertical Bottom Axis Labels of Large Size

Posted: Tue Jul 20, 2010 9:37 am
by 10050769
Hello Neelam,

I suggest two solutions that I think you can use in your application.

First, you can change the size of Margins Left, Right, Bottom or Top, using next line of code:

Code: Select all

tChart1.Panel.MarginLeft = 7;
It is an easy solution but it is not very elegant.

Second, I think that it is a best solution for you, because treat size of string label. See next example that demonstrate as string label.

Code: Select all

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

        private void InitializeChart()
        {

            Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            Random rnd = new Random();
            tChart1.Aspect.View3D = false;
            tChart1.Legend.Visible = false;
            bar1.ColorEach = true;
            bar1.Add(4, rnd.Next(100),"TESTESTETETETETEETETETETTESTESTETETETETEETETETET");
            bar1.Add(6, rnd.Next(100),"s");
            bar1.Add(7,rnd.Next(100),"s");
            bar1.Add(9,rnd.Next(100),"s");
            bar1.Marks.Visible = false;
            tChart1.Panel.MarginLeft = 7;
            tChart1.Axes.Left.Labels.Style = Steema.TeeChart.AxisLabelStyle.Mark;
            tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;
            bar1.GetSeriesMark +=new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(bar1_GetSeriesMark);
        }

        void bar1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
        {
            if (e.MarkText.Length > 20)
            {
                e.MarkText = e.MarkText.Substring(0, 10) + "...";
            }
        }
I hope will helps.

Thanks,