Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
385
Is it possible to embed a XamChart into a ViewPort3D object?
posted

It has been a week since I submitted this question to the Infragistics support and have had no response. Maybe someone on the forums has some ideas in this area. The question incident number is XCh15.

 

I have these questions:

1 - Does the Infra XamChart use the WPF 3D classes or does it implement the 3D look and feel with it's own classes?

2 - If it does use the WPF 3D classes, then how can I get the ViewPort3D instance which is housing the XamChart instance?

 

 

Parents
No Data
Reply
  • 739
    posted

     

    XamChart uses WPF 3D engine and this example shows how ViewPort3D from the chart could be used to add additional custom GeometryModel3D to the chart. The chart’s View3D property has to be set to "True"!

    GoranS

     C#:

    public Window1()

    {

    this.InitializeComponent();

     

    // Insert code required on object creation below this point.

    Btn.Click += new RoutedEventHandler(Btn_Click);

     

    }

    void Btn_Click(object sender, RoutedEventArgs e)

    {

    Canvas scenePane = this.Chart1.Scene.Content as Canvas;

    Canvas pane3D = scenePane.Children[0] as Canvas;

    Viewport3D viewPort3D = pane3D.Children[0] as Viewport3D;

    Visual3DCollection v3d = viewPort3D.Children;

    ModelVisual3D model3D = v3d[0] as ModelVisual3D;

    Model3DGroup modelGroup = model3D.Content as Model3DGroup;

    GeometryModel3D model = this.FindResource("ww") as GeometryModel3D;

    modelGroup.Children.Add(model);

    }

     XAML:

    <Window

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:igCA="http://infragistics.com/Chart"

    x:Class="UntitledProject4.Window1"

    x:Name="Window"

    Title="Window1"

    Width="640" Height="480">

    <Window.Resources>

    <GeometryModel3D x:Key="ww">

    <GeometryModel3D.Geometry>

    <MeshGeometry3D

    Positions="0,0.1,0 0.1,-0.1,0.1 -0.1,-0.1,0.1 0.1,-0.1,0.1 -0.1,-0.1,-0.1"

     

    Normals="0,1,0 -1,0,1 1,0,1 -1,0,-1 1,0,-1"

     

    TriangleIndices="0,2,1 0,3,1 0,3,4 0,2,4" />

    </GeometryModel3D.Geometry>

    <GeometryModel3D.Material>

    <DiffuseMaterial Brush="Aqua" />

    </GeometryModel3D.Material>

    <GeometryModel3D.BackMaterial>

    <DiffuseMaterial Brush="LightBlue"/>

    </GeometryModel3D.BackMaterial>

    </GeometryModel3D>

     

    </
    Window.Resources>

    <Grid x:Name="LayoutRoot">

    <Button Name="Btn" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Width="155" Height="42" Content="Button"/>

    <igCA:XamChart Name="Chart1" View3D="True" >

    <igCA:XamChart.Scene>

    <igCA:Scene>

    <igCA:Scene.GridArea>

    <igCA:GridArea Background="Red" RenderingMode="Performance"/>

    </igCA:Scene.GridArea>

    </igCA:Scene>

    </igCA:XamChart.Scene>

    <igCA:XamChart.Series>

    <igCA:Series ChartType="Column">

    <igCA:Series.DataPoints>

    <igCA:DataPoint Value="3"/>

    <igCA:DataPoint Value="9"/>

    <igCA:DataPoint Value="8"/>

    <igCA:DataPoint Value="5"/>

    <igCA:DataPoint Value="2"/>

    <igCA:DataPoint Value="7"/>

    <igCA:DataPoint Value="4"/>

    </igCA:Series.DataPoints>

    </igCA:Series>

    </igCA:XamChart.Series>

    </igCA:XamChart>

     

     

    </
    Grid>

    </Window>

Children
No Data