This is a migrated thread and some comments may be shown as answers.

ScatterLineSeries - not respecting BorderWidth or BorderDashStyle

6 Answers 214 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Sergio
Top achievements
Rank 1
Sergio asked on 13 Jun 2017, 02:12 PM

Hello.  I'm trying to style a series spline to have a thin borderwidth to set it apart from the other splines on the chartview, but no matter what value I set the BorderWidth property to, the spline is the same thickness.  Intellisense for BorderWidth mentions that BorderBoxStyle.FourBorders must be used, and the series is normally in SingleBorder, but setting it to FourBorders also didn't help.  I also tried to set the BorderDashStyle to dashes, just to see if other property changes would be respected, but the line is still solid.  The BorderColor and Spline properties appear to be respected.  Any ideas what I'm doing wrong?

Here's the code to create and add the series, as well as a screenshot of the chart.  The series in question is to the top (high) red spline.

Thanks!

 

    ScatterLineSeries x3PriceEnvelopeHighSeries = new ScatterLineSeries();
                        x3PriceEnvelopeHighSeries.XValueMember = "FaceWeight";
                        x3PriceEnvelopeHighSeries.YValueMember = "x3Price";
                        x3PriceEnvelopeHighSeries.DataSource = curvePointsHigh;
                        x3PriceEnvelopeHighSeries.BorderColor = Color.Red;
                        x3PriceEnvelopeHighSeries.BackColor = Color.Red;
                        x3PriceEnvelopeHighSeries.ShowLabels = false;
                        x3PriceEnvelopeHighSeries.Spline = true;
                        //x3PriceEnvelopeHighSeries.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.FourBorders;
                        x3PriceEnvelopeHighSeries.BorderWidth = (float)0.25;
                        //x3PriceEnvelopeHighSeries.BorderLeftWidth = (float)0.25;
                        //x3PriceEnvelopeHighSeries.BorderTopWidth = (float)0.0;
                        //x3PriceEnvelopeHighSeries.BorderRightWidth = (float)0.0;
                        //x3PriceEnvelopeHighSeries.BorderBottomWidth = (float)0.0;
                        x3PriceEnvelopeHighSeries.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                        chart.Series.Add(x3PriceEnvelopeHighSeries);
                        x3PriceEnvelopeHighSeries.IsVisibleInLegend = false;

6 Answers, 1 is accepted

Sort by
0
Sergio
Top achievements
Rank 1
answered on 13 Jun 2017, 02:30 PM
To clarify, I can't get the BorderWidth to be thin (e.g. 0.25 relative to 1.0), but setting BorderWidth to 100 does produce a very thick line.
0
Hristo
Telerik team
answered on 14 Jun 2017, 02:12 PM
Hi Sergio,

Thank you for writing.

The line elements are painted using the Graphics.DrawPath method receiving a Pen object as an argument. The pen object receives a width object in its constructor and Microsoft have basically stated that minimum width of the drawing would be 1https://msdn.microsoft.com/en-us/library/k0yzhw2d.aspx#Anchor_1.

In this case, there is not much we can do because of the Pen limitation. If it fits your local setup you can also set a semi-transparent back color to those lines you would like to be with a width less than 1.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Sergio
Top achievements
Rank 1
answered on 14 Jun 2017, 09:15 PM

Thanks for your reply, Hristo.  I understand your explanation, but if the minimum thickness is 1, and 1 renders to the thick lines shown in my attached image, how did Telerik generate the WinForms chartview with much thinner lines on their website, shown in the image attached to this reply?

Thanks!

0
Hristo
Telerik team
answered on 15 Jun 2017, 10:08 AM
Hello Sergio,

Thank you for writing.

The charts in the displayed images have a default border width of 2. I am following the example as demonstrated here: http://docs.telerik.com/devtools/winforms/chartview/series-types/scatterline.

I am also sending you a short video toggling the border widths between 1 and 2.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Sergio
Top achievements
Rank 1
answered on 15 Jun 2017, 03:20 PM

Figured it out!  The line was so thick because what I was seeing was not the line, it was the datapoints.  The scatterlineseries had over 600 datapoints, and they were all tightly packed together, so all those squares formed the thick line.  I trimmed the series datasource down to about 75 data points and the line got thin. :-)  I also used a small PointSize, and now I have a smooth, thin curve/spline.

Thank you for your help, Hristo.

0
Hristo
Telerik team
answered on 16 Jun 2017, 06:55 AM
Hello Sergio,

Thank you for the update.

I am glad that you have managed to resolve the issue in the context of your actual scenario.

In case you need further assistance please let me know.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ChartView
Asked by
Sergio
Top achievements
Rank 1
Answers by
Sergio
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or