Vertical Line in Chart

We have implementation of chart in WPF and Angular applications. In WPF we implemented Vertical line using Annotations property and VerticalLineAnnotation object.
Image_4766_1713896105861
The result is blue vertical line with label "30 Sep 2022".
Image_6054_1713896058402

In Angular we don't know how to do this, annotation is something different. Please help :)



5 Replies

SG Siegfried Gassner April 24, 2024 11:07 AM UTC

Any answer, please... it's urgent for us.



GV Gopalakrishnan Veeraraghavan Syncfusion Team April 24, 2024 12:28 PM UTC

Hi Siegfried Gassner,


We have analyzed your query and recommend using the stripline to add a vertical line in the chart. To create a vertical stripline, simply add the stripline to the horizontal axis and set the 'visible' option to true. Striplines are rendered within the specified start-to-end range. You can also create a dashed array stripline by using the 'dashArray' property, which renders the striplines with the specified dash array values. Furthermore, you can utilize the 'text' property to add text to the stripline and align it using the 'horizontalAlignment' and 'verticalAlignment' properties. We have attached a sample and screenshot for your reference. Please check the following code snippet.

.

public primaryYAxis: Object = {

        labelFormat: '{value}%',

        title: 'GDP (In Percentage)',

        edgeLabelPlacement: 'Shift',

        majorTickLines: { width: 0 },

        lineStyle: { width: 0 },

        stripLines:[

            { start: 7, size: 1, sizeType: 'Pixel', dashArray:"5,5", horizontalAlignment : "End", verticalAlignment : "Middle", color: "blue", text: "30 Sep 2022", textStyle: {color: "Black"}}

        ]

    };


Sample: https://stackblitz.com/edit/angular-gn3w8e-bjcgc8?file=src%2Fapp.component.ts

Screenshot:
A graph with black and blue bars

Regards,

Gopalakrishnan



SG Siegfried Gassner April 25, 2024 11:50 AM UTC

Thanks a lot on answer. This is really very useful. 

We added StripLines, but the lines did not appear.

  this.primaryXAxis.stripLines = [{

       visible: true,

       start: 1,

       size: 1,

       sizeType: 'Pixel',

       dashArray:"5,5",

       horizontalAlignment : "End",

       verticalAlignment : "Middle",

       color: "blue",

       text: "Test",

       textStyle: {color: "Black"}

  }];


Is there any other property that should be enabled or visible so that I can see the lines ?



SG Siegfried Gassner April 25, 2024 04:18 PM UTC

Dear, 
Ignore the previous comment. The problem is in our chart setup. Everything is solved, you can close the ticket.

Thanks Again, your help was valuable.



SB Swetha Babu Syncfusion Team April 29, 2024 04:43 AM UTC

Siegfried,


Most Welcome! Please get back to us if you need any other assistance.


Loader.
Up arrow icon