ChartStripLine

Hi, I want to add vertical lines at positions on the x-axis. I have tried the ChartStripLine and it does almost what I want. The problem I''m having is that the ChartStripLine works for a range, and has a width. This means that when resizing or zooming, the width of the line you see changes. A series with a line does not do this (or the grid lines in the chart), and i want the strip line to behave like a line series. In other words, the vertical line should have the same width regardless of chart size and zoom. Is there a way to achieve this? Regards Rune

8 Replies

GM Geetha M Syncfusion Team September 5, 2005 01:52 PM UTC

Hi Rune, Sorry for the delayed response. Please refer the sample attached below. ChartStripLines_1665.zip You can use the ChartAreaPaint event handler to draw and to maintain the width of the stripline as constant while Zooming. Please let me know if this helps. Thanks for your interest in Syncfusion products. Regards, Geetha.


RS Rune Selvaag September 6, 2005 07:11 AM UTC

Hi Geetha, Thank you for the reply and the sample. This is not quite what i was looking for. I need the line to stay fixed to a position on the axis. When you resize in the sample, the line changes position relativ to the axis. I also asked for a vertical line on the x-axis. I need it to behave like a strip line, but with constant width. Regards Rune


AD Administrator Syncfusion Team September 6, 2005 01:55 PM UTC

Hi Rune, Please refer to the sample linked to below. This sample uses the ChartAreaPaint event and calculates the coordinates based on where you want the vertical line to appear. ChartStatLines_6068.zip Thanks, Davis


RS Rune Selvaag September 8, 2005 06:15 AM UTC

Thanks Davis, I adjusted the sample so that the line was clipped, and only visible inside the axes (chart area). In your sample the line is also shown outside the chart area when zooming. I uses VisibleRange to achieve this: double xPos = 100; if ((xPos >= chart.PrimaryXAxis.VisibleRange.Min) && (xPos <= chart.PrimaryXAxis.VisibleRange.Max)) { ChartPoint pt1 = new ChartPoint(xPos, chart.PrimaryYAxis.VisibleRange.Min); ChartPoint pt2 = new ChartPoint(xPos, chart.PrimaryYAxis.VisibleRange.Max); Point lineStart = chart.ChartArea.GetPointByValue(pt1); PointF lineEnd = chart.ChartArea.GetPointByValue(pt2); e.Graphics.DrawLine(new Pen(Color.Red),lineStart, lineEnd); } Again, thank you for great support. Rune


UK U. Korsmit January 22, 2025 04:21 PM UTC

and how to do this now (preferably in vb.net?).


I get errors:

Severity Code Description Project File Line Suppression State

Error CS0266 Cannot implicitly convert type 'System.Windows.Forms.Orientation' to 'Syncfusion.Windows.Forms.Chart.ChartOrientation'. An explicit conversion exists (are you missing a cast?) ChartStatLines C:\Users\u\Downloads\ChartStatLines_6068\ChartStatLines\Form1.cs 76 Active

Error Unable to resolve type 'Syncfusion.Core.Licensing.LicensedComponent, Syncfusion.Core' ChartStatLines C:\Users\u\Downloads\ChartStatLines_6068\ChartStatLines\licenses.licx 1



And, how to do this without double values on the X-axis. I have string values, and the same string is present multiple times... The horizontal line must go from the primary Y-axis over the complete chart width.


Regards,


Udo



AJ Arul Jenith Berkmans Syncfusion Team January 23, 2025 05:34 AM UTC

Hi Korsmit,

 

After reviewing your query, we realized we need a bit more information to better assist you. Please provide the following details:

 

  • The platform you are using Winforms or WPF.
  • The version of the package you are working with.
  • Any specific configurations or settings you have implemented.

 

Additionally, if possible, could you please provide a code snippet related to your query, it would be greatly helpful. With this information, we can create a new ticket and follow your query more effectively.

 

Thank you for your understanding and cooperation.

 

Best regards,

Arul Jenith B.



UK U. Korsmit January 23, 2025 09:49 AM UTC

Hi Jenith,


The platform is winforms :vb.net.

The version is:  28.1.33

No special or other settings.


The code snippet is the snippet used above: ChartStatLines_6068.zip 

This is unfortunatly not in the correct language.


for the errors, I just deleted the form building line about the orientation.. This parameter does not seem to exists  (anymore).

For the license error, I removed the file with the license key (.licx) from the application. Then it worked.. The greatest question remain (the one that I was trying to solve reading this snippet...). So therefore, the snippet is not so relevant anymore but the only question that remains: 


And, how to do this without double values on the X-axis. I have string values, and the same string is present multiple times... The horizontal line must go from the primary Y-axis over the complete chart width.

the X-axis are string labels: 4,5,6,......52,1,2,3,4. These are weeknumbers, But no real numbers ofcourse!!!.. As you see, these values can not be sorted while they must stay in the order of the underlaying table. There is 2 times (Week) 4. (next week, it will be week 5).

So I can not work with min and max value but must be on coordinates or something. 

The sorting is off, while the graph is build in the order 


EDIT: Maybe I should ask this in another forum post: 

While the width of the chartstripline is not easy to control (I can not give ith a width of 0,01) I get big lines if I display something in smaller values. Therefore I want to go back in displaying the data in a line graph (and solving the above by getting all X-vaules from the similar datatable as the displayed columns). I can easiliy draw a nice controlled target line. However, on the drawn target line, I want to put on the line some text. That is easy with a chartstripline but not easy with a normal line.. How to do this? ChatGPT suggest annotations, but I can not find any annotation properties in syncfusion.



AJ Arul Jenith Berkmans Syncfusion Team January 24, 2025 11:59 AM UTC

Hi Korsmit,

 

Thank you for reaching out to us. To ensure a more efficient follow-up on your request, we have created a separate support thread for you. You can easily track the progress and stay updated by using the following link:

 

Ticket link - Winform strip line requirements - Branched from F 34133 | WinForms Forums | Syncfusion®

 

Thank you for your understanding and cooperation.

 

Best regards,

Arul Jenith B.


Loader.
Up arrow icon