Do not paint for Barjoin line

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Amit
Newbie
Newbie
Posts: 9
Joined: Mon Oct 15, 2007 12:00 am

Do not paint for Barjoin line

Post by Amit » Fri Sep 28, 2012 6:08 am

Hello all,

I am using Barjoin.

I have a need to not show the Barjoin line when data for that bar/point is null. Corresponding bar comes as blank but the barjoin line joins to the last drawn point. Here are the actual snapshot and the way I want. Please let me know if this is posssible.
Attachments
modified.JPG
My need.
modified.JPG (17.87 KiB) Viewed 3661 times
original.JPG
Actual
original.JPG (18.21 KiB) Viewed 3640 times

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

Re: Do not paint for Barjoin line

Post by Sandra » Fri Sep 28, 2012 2:01 pm

Hello Amit,

I am afraid isn't possible do it directly. I have made a simple code, where I have used SetNull points and three series to achieve as you want:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.BarJoin Series1, Series3;
        Steema.TeeChart.Styles.Bar Series2;
        private void InitializeChart()
        {
            //TChart
            tChart1.Aspect.View3D = false;

            //Series
            Series1 = new Steema.TeeChart.Styles.BarJoin(tChart1.Chart);
            Series2 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            Series3 = new Steema.TeeChart.Styles.BarJoin(tChart1.Chart);
            //Add values to Series;
            Random rnd = new Random();
            Series1.FillSampleValues(6);
            Series1.Color = Color.Red;
            Series2.DataSource = Series1;
            Series2.Color = Series1.Color;
            Series3.DataSource = Series1;
            Series3.Color = Series1.Color;
            Series1.Marks.Visible = false;
            Series2.Marks.Visible = false;
            Series3.Marks.Visible = false;
            tChart1.Legend.LegendStyle = LegendStyles.Values;
            tChart1.Draw();
            for (int i = 0; i < 6; i++)
            {
                if (i < 2)
                {
                    Series2.SetNull(i);
                    Series3.SetNull(i);
                }
                else if (i == 2)
                {
                    Series1.SetNull(i);
                    Series3.SetNull(i);
                }
                else if (i > 2)
                {
                    Series1.SetNull(i);
                    Series2.SetNull(i);
                }

                tChart1.Legend.Symbol.OnSymbolDraw += new SymbolDrawEventHandler(Symbol_OnSymbolDraw);
            }

        }

        void Symbol_OnSymbolDraw(object sender, SymbolDrawEventArgs e)
        {
            //Paint null symbols of legend.
            tChart1.Graphics3D.Brush.Color = Color.Red;
            tChart1.Graphics3D.Rectangle(e.Rect);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            tChart1.ShowEditor();
        }

Can you tell us if previous code works in your end?

I hope will helps.

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

Post Reply