Add a Vertical Line Today dynamically

I want to add a Vertical Line Today dynamically based on the current month. How do I do that. Can you please provide a demo in React Functional Based Component. 


Looking forward to hear from you.


1 Reply

SB Swetha Babu Syncfusion Team June 21, 2022 06:55 AM UTC

Hi Randhir,


Greetings from Syncfusion.


We suggest you to use the stripLine to render the Line in the Chart component. We have created a simple React application to demonstrate the same. Please find the below stackblitz link for your sample reference.


Sample link: https://stackblitz.com/edit/react-vwy2cw?file=index.js


Code Snippet:


onClick(e) {

        this.chartInstance.primaryXAxis.stripLines = [{

            start: 6, end: 6.1, visible: true, color: "red"

        }];

    }


Screenshot:



When you click on the Add Line button, then the Line gets added based on the start and end value of the StripLine.


Kindly, revert us if you have any concerns.


Regards,

Swetha


Loader.
Up arrow icon