How to change CursorTool position(both x and y-axis) onClick
How to change CursorTool position(both x and y-axis) onClick
I'm using ColorGrid for chart creation and i want to change CursorTool position(x-axis and y-axis coordinates) based on click. Can any one help us to achieve this. And is there any way that we can give position values for x-axis and y-axis so the cursortool can be re-arranged to that position. If any one has done already please give us solution.
Re: How to change CursorTool position(both x and y-axis) onClick
Hello,
You can call the CursortTool mousemove function at the Chart's mousedown event as follows:
You can call the CursortTool mousemove function at the Chart's mousedown event as follows:
Code: Select all
var t = new Tee.CursorTool(Chart1);
t.format.stroke.size=2;
t.format.stroke.fill="#BB0000";
t.render="layer";
t.followMouse=false;
Chart1.tools.add(t);
Chart1.mousedown=function(event) {
t.oldFollowMouse = t.followMouse;
t.followMouse = true;
var p = new Tee.Point(0, 0);
t.chart.calcMouse(event, p);
t.mousemove(p);
t.followMouse = t.oldFollowMouse;
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: How to change CursorTool position(both x and y-axis) onClick
Hello,
Thank you so much for your reply, it is working fine, only if we add "t.dragging = 0", otherwise it is not working. and how to set x-axis value to zero when chart is loading first time or how to change positions of x and y manually(might be the scenario is another buttons and i want to change x or y position by increment one by one).
Thank you so much for your reply, it is working fine, only if we add "t.dragging = 0", otherwise it is not working. and how to set x-axis value to zero when chart is loading first time or how to change positions of x and y manually(might be the scenario is another buttons and i want to change x or y position by increment one by one).
Yeray wrote:Hello,
You can call the CursortTool mousemove function at the Chart's mousedown event as follows:
Code: Select all
var t = new Tee.CursorTool(Chart1); t.format.stroke.size=2; t.format.stroke.fill="#BB0000"; t.render="layer"; t.followMouse=false; Chart1.tools.add(t); Chart1.mousedown=function(event) { t.oldFollowMouse = t.followMouse; t.followMouse = true; var p = new Tee.Point(0, 0); t.chart.calcMouse(event, p); t.mousemove(p); t.followMouse = t.oldFollowMouse; }
Re: How to change CursorTool position(both x and y-axis) onClick
Hello,
You can manually set a position knowing the pixel coordinates, or calculating them from the axis values. To do this, instead of this:
Do this:
You can manually set a position knowing the pixel coordinates, or calculating them from the axis values. To do this, instead of this:
Code: Select all
var p = new Tee.Point(0, 0);
t.chart.calcMouse(event, p);
Code: Select all
var p = new Tee.Point(Chart1.axes.bottom.calc(80), Chart1.axes.left.calc(80));
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: How to change CursorTool position(both x and y-axis) onClick
Thanks, it is working fine now.