Hi,
I am trying to zoom user selected portion of chart.
user can draw rectangle or square by dragging mouse mouse.
startPosition : Mouse Down
End Position : Mouse Up or MouseMove
i draw rectangle from startPosition to End Position in FillSceneGraph event.
basically on MouseMove event i store EndPosition as current mouse location and call InvalidateLayers function on chart.
In FillSceneGraph event i draw rectangle from startPosition to EndPosition and add it to SceneGraph.
Every thing works fine except the delay in displaying rectangle.
is there any way to avoid the delay..or is FillSceneGraph is right place to add primitives on mousemove event.
as mousemove event is called for every few milliseconds ..
Thanks,
Kk
You can use OuterBound property of the chart layer to get the bounds rectangle instead of GridLayerBounds:Rectangle bounds = ultraChart1.CompositeChart.ChartLayers[0].ChartLayer.OuterBound;Also, when using a composite chart, remember to get the right Grid to avoid the axes being null:ChartLayer layer = ultraChart1.CompositeChart.ChartLayers[0].ChartLayer;IAdvanceAxis xAxis = (IAdvanceAxis)layer.Grid[0];IAdvanceAxis yAxis = (IAdvanceAxis)layer.Grid[1];
Hi, I tried to use it in an CompositeChart, but the calculation of scaleX and scaleY goes always wrong because the GridLayerBounds.Width and the GridLayerBounds.Height are always zero. I added a snippet:
try 1:
scaleX = xAxis.Scale * box.rect.Width / e.ChartCore.GridLayerBounds.Width; scaleY = yAxis.Scale * box.rect.Height / e.ChartCore.GridLayerBounds.Height;
try2:
offsetX = (this.ultraChart.CompositeChart.ChartLayers[0].ChartLayer.ChartCore.GridLayerBounds.Width / xAxis.Scale - this.ultraChart.CompositeChart.ChartLayers[0].ChartLayer.ChartCore.GridLayerBounds.Width) * xAxis.Scroll; offsetY = (this.ultraChart.CompositeChart.ChartLayers[0].ChartLayer.ChartCore.GridLayerBounds.Height / yAxis.Scale - this.ultraChart.CompositeChart.ChartLayers[0].ChartLayer.ChartCore.GridLayerBounds.Height) * yAxis.Scroll;
Does anybody know how it will work?
oh,thts great ...thnx fr ur immediate reply.
You cannot prevent zooming into a region with no data points. There's no way to tell if there are shapes drawn inside a particular rectangle, but you can do something to prevent zooming in when you just have a mouse click.
For this you can change the conditions of when the selection rectangle is valid. For example, you can force the rectangle to be at least 5x5 pixels:if the box's width and height are less than 5 set valid to false, and you shouldn't see the click problem.
Thnx fr the reply.If we drag the region where data is there,it is working great,and tht is the ultimate.
Suppose if I select an empty region,there also it is zooming..and tht time we will see empty chart only.
Is there any way to prevent the user to select that empty region.
And one more thing,if I click on any data column..then also it is getting zoomed.But i dont want to zoom tht in click.Because Iam doing drill down in tht click,and it is getting effected.
Is there any way to prevent zooming in the click of data column.
Iam very curios like how it will work....:):)