Issue with HorizBar and SetNull()

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Issue with HorizBar and SetNull()

Post by AIS » Fri May 29, 2009 2:56 pm

Hello,

with the following code i get transparent bars on the chart on the left upper side (maximize window). This is caused by SetNull in combination with HorizBox. I don`t know, if v4 or newer v3 releases contains this issue.

Image

All series have the same values. In my application i must use SetNull() to avoid artefacts of 0 value bars. In that case i found this behaviour.

Code: Select all

// Controls
            TChart chart1 = new TChart();
            TChart chart2 = new TChart();
            TChart chart3 = new TChart();
            TChart chart4 = new TChart();
            TableLayoutPanel tlp = new TableLayoutPanel();           

            tlp.Controls.Add(chart1);
            tlp.Controls.Add(chart2);
            tlp.Controls.Add(chart3);
            tlp.Controls.Add(chart4);

            this.Controls.Add(tlp);

            tlp.Dock = DockStyle.Fill;
            tlp.ColumnCount = 2;
            tlp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlp.RowCount = 2;
            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));

            chart1.Dock = DockStyle.Fill;
            chart2.Dock = DockStyle.Fill;
            chart3.Dock = DockStyle.Fill;
            chart4.Dock = DockStyle.Fill;

            chart1.Aspect.View3D = false;
            chart2.Aspect.View3D = false;
            chart3.Aspect.View3D = false;
            chart4.Aspect.View3D = false;

            chart1.Header.Text = "Bars with SetNull()";
            chart2.Header.Text = "HorizBars with SetNull()";
            chart3.Header.Text = "Bars without SetNull()";
            chart4.Header.Text = "HorizBars without SetNull()";

            // Data
            DataTable dt = new DataTable();
            dt.Columns.Add("X", typeof(Double));
            dt.Columns.Add("Y",typeof(String));
            for (int i = 0; i < 10; i++)
            {
                if (i == 5)
                {
                    dt.Rows.Add(0, "String" + i.ToString());
                }
                else
                {
                    dt.Rows.Add(i, "String" + i.ToString());
                }
            }

            // Generate bars
            foreach (DataRow dr in dt.Rows)
            {
                Bar bar = new Bar(chart1.Chart);
                Bar bar2 = new Bar(chart3.Chart);
                HorizBar horizBar = new HorizBar(chart2.Chart);
                HorizBar horizBar2 = new HorizBar(chart4.Chart);

                bar.Title = "Bar" + dr[0].ToString();
                bar2.Title = "Bar" + dr[0].ToString();
                horizBar.Title = "HorizBar" + dr[0].ToString();
                horizBar2.Title = "HorizBar" + dr[0].ToString();

                bar.MultiBar = MultiBars.Stacked;
                bar2.MultiBar = MultiBars.Stacked;
                horizBar.MultiBar = MultiBars.Stacked;
                horizBar2.MultiBar = MultiBars.Stacked;

                bar.Marks.Visible = false;
                bar2.Marks.Visible = false;
                horizBar.Marks.Visible = false;
                horizBar2.Marks.Visible = false;
            }

            // Fill with data
            foreach (DataRow dr in dt.Rows)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    CustomBar cb = (CustomBar)chart1.Series[i];
                    cb.Add((Double)dr[0], dr[1].ToString());

                    cb = (CustomBar)chart2.Series[i];
                    cb.Add((Double)dr[0], dr[1].ToString());

                    cb = (CustomBar)chart3.Series[i];
                    cb.Add((Double)dr[0], dr[1].ToString());

                    cb = (CustomBar)chart4.Series[i];
                    cb.Add((Double)dr[0], dr[1].ToString());
                    
                    if ((Double)dr[0] == 0)
                    {
                        cb = (CustomBar)chart1.Series[i];
                        cb.SetNull(cb.Count - 1);
                        cb = (CustomBar)chart2.Series[i];
                        cb.SetNull(cb.Count - 1);
                    }
                }
            }

            chart2.Axes.Left.Inverted = true;
            chart4.Axes.Left.Inverted = true;
Can i avoid this behaviour? No solution is to set a new color of each transparent series, because on the next zoom or refresh of the chart this settings are lost again.

Thanks in advance!

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Mon Jun 01, 2009 8:03 am

Hello AIS,

I could not reproduce your issue with latest versions of TeeChartfor.Net v2, v3 and v4. Can you please, check your code with some pervious latest versions of TeeChartFor .Net.

Thanks,
Best Regards,
Sandra Pazos / 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

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Post by AIS » Tue Jun 02, 2009 5:42 am

Yes of course, i have a version of july last year, but to see you must really maximize your window, if not, this behaviour not appear. If you have done this already, then i have to update my version ;)

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue Jun 02, 2009 9:17 am

Hi AIS,

I've tested it with latest v3 and everything seems alright. Could you please test it downloading the latest version available at customer download area?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply