tower 3D

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
micropross
Newbie
Newbie
Posts: 13
Joined: Mon Oct 04, 2010 12:00 am

tower 3D

Post by micropross » Thu Nov 04, 2010 5:33 pm

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

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

Re: tower 3D

Post by Narcís » Fri Nov 05, 2010 8:17 am

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.
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

micropross
Newbie
Newbie
Posts: 13
Joined: Mon Oct 04, 2010 12:00 am

Re: tower 3D

Post by micropross » Tue Nov 09, 2010 1:05 pm

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

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

Re: tower 3D

Post by Narcís » Tue Nov 09, 2010 2:13 pm

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);
        }
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

micropross
Newbie
Newbie
Posts: 13
Joined: Mon Oct 04, 2010 12:00 am

Re: tower 3D

Post by micropross » Tue Nov 09, 2010 2:25 pm

thank you very mush narcis

this exemple works well

micropross
Newbie
Newbie
Posts: 13
Joined: Mon Oct 04, 2010 12:00 am

Re: tower 3D

Post by micropross » Tue Nov 09, 2010 5:04 pm

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

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

Re: tower 3D

Post by Narcís » Wed Nov 10, 2010 9:39 am

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;
        }
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

micropross
Newbie
Newbie
Posts: 13
Joined: Mon Oct 04, 2010 12:00 am

Re: tower 3D

Post by micropross » Wed Nov 10, 2010 12:52 pm

what about Depth axis.
where can i enter the text to appear on the axis

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

Re: tower 3D

Post by Narcís » Wed Nov 10, 2010 1:34 pm

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!
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

Post Reply