Forum Discussion
Hi eshaul ,
Please review the example scripts provided in the "How to Get a Vertical Line in the X-Axis in a Line Chart" article and let us know if it helps to achieve your goal.
Best,
Lily
- eshaul02-29-2024Data Storage
Hi Liliia_DevX ,
Thanks for your reply, i am familiar with this thread, already looked at it, it is not helping me with the 3 issues i mentioned
Thanks,
Erez.
- eshaul03-02-2024Data Storage
Hi @Liliia_DevX ,
As i wrote, the reference was not helpful, any other idea where can i look?
- Liliia_DevX03-04-2024Sisense Employee
Hi eshaul,
Please try to use the following script as an example to implement your own solution:
widget.on('processresult', function(w, ev) { let targetDates = ["2013-04-22T00:00:00", "2013-05-14T00:00:00"]; // Change these to your desired dates let indices = []; targetDates.forEach((targetDate) => { let currentDate = new Date(targetDate); ev.rawResult?.values.forEach((v, i) => { // Assuming the x-axis values are dates, compare them with the target date let dataDate = new Date(v[0].data); if (currentDate.getTime() === dataDate.getTime()) { indices.push(i); } }); }); if (indices.length > 0) { ev.result.xAxis.plotLines = indices.map((index) => { return { color: '#FF0000', width: 2, dashStyle: "dash", value: index }; }); } });
You need to adjust targetDates to make it work for the specific dates. It was tested with the following widget configuration:
I'm afraid we don't have a ready-to-use example script to show also labels and it requires a further development investigation and implementation.
Hope this code snippet helps!
Best Regards, Lily
- eshaul03-06-2024Data Storage
Dear Liliia_DevX thanks a lot - that is working for me.
Unfortunately, the label feature is a must, I tried to add it to the plotLines property, but it's not showing, any idea why?