Page 1 of 1

tower 3D

Posted: Thu Nov 04, 2010 5:33 pm
by 16057371
Hi
i try to plot a tower graph, but i have an error for a big values of X axes.
is there an limitation value for X axes ?

thanks

Re: tower 3D

Posted: Fri Nov 05, 2010 8:17 am
by narcis
Hi micropross,

Not that I can think of except for that you exceed double values range. Can you please attach a simple example project we can run "as-is" to reproduce the problem here?

Thanks in advance.

Re: tower 3D

Posted: Tue Nov 09, 2010 1:05 pm
by 16057371
hi Narcis

exemple :

Random r = new Random(1000);
this.towerSeries1.Clear();
for (int x=1; x<=1000; x = x+100)
for (int z=1; z<=10; z++)
this.towerSeries1.Add(x,r.Next(1000)-100,z);

this code generate a System.NullReferenceException.

thanks

Re: tower 3D

Posted: Tue Nov 09, 2010 2:13 pm
by narcis
Hi micropross,

Thanks for the example code. You need to set Tower.IrregularGrid to true to get this working, for example:

Code: Select all

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

        private Steema.TeeChart.Styles.Tower towerSeries1;

        private void InitializeChart()
        {
            this.towerSeries1 = new Steema.TeeChart.Styles.Tower(tChart1.Chart);
            this.towerSeries1.IrregularGrid = true;

            Random r = new Random(1000);
            this.towerSeries1.Clear();

            for (int x = 1; x <= 1000; x = x + 100)
                for (int z = 1; z <= 10; z++)
                    this.towerSeries1.Add(x, r.Next(1000) - 100, z);
        }

Re: tower 3D

Posted: Tue Nov 09, 2010 2:25 pm
by 16057371
thank you very mush narcis

this exemple works well

Re: tower 3D

Posted: Tue Nov 09, 2010 5:04 pm
by 16057371
i have another question ,

for a big values for x and Y the tower look very thin . i modified the percent width and depth to 100% but the tower remains very thin.
is there a method to modifie that?

thanks

Re: tower 3D

Posted: Wed Nov 10, 2010 9:39 am
by narcis
Hi micropross,

The problem here is you have very big X increments between each tower. X values are: 1, 101, 201, 301, ..., 901. This makes a big separation between columns and therefore them being narrow. Populating your series as in the code snippet below solves the problem.

Code: Select all

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

        private Steema.TeeChart.Styles.Tower towerSeries1;

        private void InitializeChart()
        {
            tChart1.Dock = DockStyle.Fill;

            this.towerSeries1 = new Steema.TeeChart.Styles.Tower(tChart1.Chart);
            this.towerSeries1.IrregularGrid = true;

            Random r = new Random(1000);
            this.towerSeries1.Clear();

            for (int x = 1; x <= 10; x++)
                for (int z = 1; z <= 10; z++)
                {
                    double tmp = ((x - 1) * 100) + 1;
                    this.towerSeries1.Add(x, r.Next(1000) - 100, z, tmp.ToString());
                }

            tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text;
        }

Re: tower 3D

Posted: Wed Nov 10, 2010 12:52 pm
by 16057371
what about Depth axis.
where can i enter the text to appear on the axis

Re: tower 3D

Posted: Wed Nov 10, 2010 1:34 pm
by narcis
Hi micropross,

You can enable depth axis labels setting it to visible:

tChart1.Axes.Depth.Visible = true;

You can customize code in the GetAxisLabel event which you should complete here:

Code: Select all

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

        private Steema.TeeChart.Styles.Tower towerSeries1;

        private void InitializeChart()
        {
            tChart1.Dock = DockStyle.Fill;

            this.towerSeries1 = new Steema.TeeChart.Styles.Tower(tChart1.Chart);
            this.towerSeries1.IrregularGrid = true;

            Random r = new Random(1000);
            this.towerSeries1.Clear();

            for (int x = 1; x <= 10; x++)
                for (int z = 1; z <= 10; z++)
                {
                    double tmp = ((x - 1) * 100) + 1;
                    this.towerSeries1.Add(x, r.Next(1000) - 100, z, tmp.ToString());
                }

            tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text;
            tChart1.Axes.Depth.Visible = true;

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

        void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
        {
            if (sender.Equals(tChart1.Axes.Depth))
            {
                //e.LabelText = "Your text here"
            }
        }
Finally, you can also add custom labels as in the All Features\Welcome !\Axes\Labels\Custom labels example in the features demo available at TeeChart's program group.

Hope this helps!