line series with different style

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
schafma
Newbie
Newbie
Posts: 10
Joined: Wed Jan 25, 2006 12:00 am

line series with different style

Post by schafma » Mon Feb 01, 2010 10:31 am

Hello,

is it possible to have different line styles (e.g. dash and solid) on the very same series?
What I'm trying to do is to code additional infomation (data is trustworthy or not) using the line style.
Different colors would be no solutions since there are several lines in one chart.

Hopefully you have an idea,

Marcus

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

Re: line series with different style

Post by Sandra » Mon Feb 01, 2010 12:13 pm

Hello schafma,
is it possible to have different line styles (e.g. dash and solid) on the very same series?
Is not possible have different line styles for one series. I recommend that do something as next code:

Code: Select all

 private Steema.TeeChart.Styles.Line line, line1;
        private void Form1_Load(object sender, EventArgs e)
        {
            line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            tChart1.Aspect.View3D = false;
            line.FillSampleValues(10);
            line1.FillSampleValues(5);
            for (int i = 0; i <= (line.Count)/2; i++)
            {
                line1[i].X = line[i].X;
                line1[i].Y = line[i].Y;
            }
            line.LinePen.Style = System.Drawing.Drawing2D.DashStyle.Dash;
            line.LinePen.Width = 3;
            line1.LinePen.Style = System.Drawing.Drawing2D.DashStyle.Solid;
            line1.LinePen.Width = 3;
            line1.Color = line.Color;

        }
Please, check next code works if you want.

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

schafma
Newbie
Newbie
Posts: 10
Joined: Wed Jan 25, 2006 12:00 am

Re: line series with different style

Post by schafma » Wed Feb 10, 2010 1:15 pm

Dear Sandra,
thank you for the idea. I'm not quite sure if this solution is flexible enough for my needs but I'll give it a try.
I had also the idea to use the colors arrays of the line series to assign different alpha values (opacities) to the according line segments.

Once again thank you for your help.
Maybe this feature (different line styles per line segment) will be implemented in a futur release.

Marcus

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

Re: line series with different style

Post by Yeray » Fri Feb 19, 2010 4:28 pm

Hi Marcus,

Here it is another possibility, maybe more flexible (you could have an array of segments in the line to be discontinuous and check it in the condition into the GetPointerStyle event)

Code: Select all

        Steema.TeeChart.Styles.Line line;

        private void InitializeChart()
        {
            line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            tChart1.Aspect.View3D = false;
            line.FillSampleValues(10);

            line.LinePen.Width = 3;
            line.Pointer.Visible = true;

            line.GetPointerStyle += new Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventHandler(line_GetPointerStyle);
        }

        void line_GetPointerStyle(Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.GetPointerStyleEventArgs e)
        {
            if ((e.ValueIndex == 3) || (e.ValueIndex == 6)) line.LinePen.Style = System.Drawing.Drawing2D.DashStyle.Dash;
            else line.LinePen.Style = System.Drawing.Drawing2D.DashStyle.Solid;

            e.Style = Steema.TeeChart.Styles.PointerStyles.Nothing;
        }
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