I am new in using the JavaScript version of TChart. So far I have used the VCL version. I would like to transfer a dynamic chart from VCL to JavaScript. The following picture shows the chart. The green point can be moved by the cursor. The coordinates of the position and some calculated values are displayed in separate boxes next to the chart.
As a test I created a chart with a PointXY series, added two points and a DragTool. That worked so far but the points can be dragged only vertically. What must I add that they can be dragged in all directions? And how can I avoid that other series can be dragged too? drag.series = [Chart1.series.item[0]] ?
Code: Select all
type="text/javascript"></script>
<script type="text/javascript">
function draw() {
Chart1 = new Tee.Chart("canvas");
s1 = Chart1.addSeries(new Tee.PointXY());
Chart1.axes.bottom.setMinMax(0, 50);
Chart1.axes.left.setMinMax(0, 200);
s1.data.values = [10, 100];
s1.data.x = [10, 20];
drag = Chart1.tools.add(new Tee.DragTool(Chart1));
//drag = new DragTool(Chart1);
//drag.series =
Chart1.series.items[0].pointer.style = "ellipse";
Chart1.legend.visible = false;
Chart1.panel.format.gradient.visible = false;
Chart1.panel.format.fill = "White";
Chart1.title.text = "Test to drag a point";
//Chart1.panel.format.fill = "rgb(230,230,230)";
Chart1.draw();
}
Thanks for any hints!
Rolf
PS. I found some examples in the demos (intro/gantt.htm, series/area/smootharea.htm, basic\canvasalign.htm) but in all only vertical drag is possible. So, I guess it's by design only vertically. Possibly there is another solution to move interactively a single point in the chart (Point class?).