Page 1 of 1

Issue with HorizBar and SetNull()

Posted: Fri May 29, 2009 2:56 pm
by 13049497
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!

Posted: Mon Jun 01, 2009 8:03 am
by 10050769
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,

Posted: Tue Jun 02, 2009 5:42 am
by 13049497
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 ;)

Posted: Tue Jun 02, 2009 9:17 am
by yeray
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?