Sticky line marker in ejChart?
Is it possible to have the chart line marker sticky once clicked? ie. have the line stay put after clicking on the chart?
Alternatively, can I draw the line myself if I know where to put it?
SIGN IN To post a reply.
3 Replies
DD
Dharanidharan Dharmasivam
Syncfusion Team
January 9, 2018 04:34 PM UTC
Hi Pete,
Thanks for using Syncfusion products.
We have analyzed your query. Find the response for your queries below.
|
Query |
Response | |
|
Is it possible to have the chart line marker sticky once clicked? ie. have the line stay put after clicking on the chart? |
Yes, your requirement can be achieved as workaround using chartClick event. Kindly find the code snippet below to achieve this requirement.
Screenshot:
Sample for reference can be find from below link.
| |
|
Alternatively, can I draw the line myself if I know where to put it? |
Yes, you can able to draw a line in chart if you know the position as like above workaround. |
Kindly revert us, if you have any concerns.
Dharani.
PR
Pete Reeves
January 17, 2018 01:27 PM UTC
That's awesome, thanks for the reply.
One tiny extra question here, we have a crosshair/trackball line which snaps to the tick points. Is there a way of extracting the pre-calculated location of that line so I can draw it again?
I can probably figure out my own calc, but I know it must already be in the object somewhere.
Thanks again,
Pete.
DD
Dharanidharan Dharmasivam
Syncfusion Team
January 18, 2018 11:11 AM UTC
Hi Pete,
Thanks for the update.
We have analyzed your query. We have achieved your requirement as a workaround using mouseMoveEvent to get the nearest point location. Kindly find the code snippet to achieve this requirement.
|
JS:
$("#container").ejChart({
//…
chartMouseMove:'mouseMove',
}
function mouseMove(sender) {
var ser = [], series = sender.model.series[0];
//Get the closest point location using getNearestPoint method, so that you can draw a line
var nearPoint = getNearestPoint(ser, series, sender.data.location.x, sender.data.location.y);
alert("X location: " + nearPoint.point[0].location.X + "\nY Location: " +
nearPoint.point[0].location.Y);
}
|
Here using the chart mouse move event, we have obtained the location of nearest point and displayed an alert box with the locations. You can change this with respect to your requirement.
Sample for reference can be find from below link.
If this is not your exact scenario, kindly revert us with more information on your query.
Thanks,
Dharani.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
PR Pete Reeves
- Jan 8, 2018 09:48 AM UTC
- Jan 18, 2018 11:11 AM UTC