Page 1 of 1

line series with different style

Posted: Mon Feb 01, 2010 10:31 am
by 9640089
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

Re: line series with different style

Posted: Mon Feb 01, 2010 12:13 pm
by 10050769
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,

Re: line series with different style

Posted: Wed Feb 10, 2010 1:15 pm
by 9640089
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

Re: line series with different style

Posted: Fri Feb 19, 2010 4:28 pm
by yeray
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;
        }