I am evaluating NetAdvantage for WPF 2008 Vol. 2. Does xamChart has Zooming feature?
Regards,
Priya
Thanks Teodor. That should get me started.
Mike
Hi,
Try using this code:
<igCA:XamChart x:Name="xamChart"
View3D="True"
MouseLeftButtonDown="xamChart_MouseLeftButtonDown" >
<igCA:XamChart.Crosshairs>
<igCA:Crosshairs Enabled="True" />
</igCA:XamChart.Crosshairs>
<igCA:XamChart.Series>
<igCA:Series>
<igCA:Series.DataPoints>
<igCA:DataPoint Value="5" />
<igCA:DataPoint Value="2" />
<igCA:DataPoint Value="3" />
</igCA:Series.DataPoints>
</igCA:Series>
</igCA:XamChart.Series>
</igCA:XamChart>
…
private Viewport3D FindViewport3D(DependencyObject parent)
{
int count = VisualTreeHelper.GetChildrenCount(parent);
for (int i = 0; i < count; i++)
DependencyObject obj = VisualTreeHelper.GetChild(parent, i);
Viewport3D viewport3D = obj as Viewport3D;
if (viewport3D != null)
return viewport3D;
}
viewport3D = FindViewport3D(obj);
return null;
private void xamChart_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
Viewport3D viewport3D = FindViewport3D(this.xamChart);
PerspectiveCamera camera = viewport3D.Camera as PerspectiveCamera;
Point3D pt = camera.Position;
pt.X += 0.1;
camera.Position = pt;
Can you give an example of chaging the camera position using the Transform3D property? I just don't see how to do that.
Thanks,
you don't need to navigate the Visual Tree, you can access these settings via the Transform3D property of the chart control.
You can navigate the Visual Tree of the XamChart until you get the ViewPort3D object inside of it.
The ViewPort3D has a Camera property that will return a PerspectiveCamera object.
Right there you can do:
PerspectiveCamera camera = yourViewport3D.Camera as PerspectiveCamera;camera.Position = new Point3D(camera.Position.X, camera.Position.Y, camera.Position.Z - yourDelta);
Daniel