Visualize Surface Charts in WPF with Direct3D Rendering

Deliver the highest performance charting possible with DirectX rendering. The C1Chart3D control supports a Direct3D render mode which takes advantage of hardware acceleration features supported by graphics accelerators. DirectX rendering allows you to display more data more quickly without sacrificing performance. To take advantage of Direct3D rendering, simply set the RenderMode property on the control to Direct3D.

chart3D.RenderMode = RenderMode3D.Direct3D;  

Chart3D_Charts The alternative, and previously the only render mode, is Default, which uses XAML rendering on the UI layer. It’s more costly due to memory consumption. To see a benchmark comparison of how much faster the Direct3D rendering is, take a look at this table.

Number of points




2.5 s

< 1 s


9 s

1 s


30 s

3 s

>> Download C1Chart3DSample <<

Adding Interaction

Also new in the 2013 v3 release, we’ve improved the interaction in the C1Chart3D control. You can now enable dragging interaction by mouse. The new properties AzimuthAction and ElevationAction enable the mouse to rotate the plot cube (the azimuth is modified by horizontal mouse movement and the elevation is changed by vertical mouse movement). Optionally it is possible to add keyboard modifier for action with AzimuthActionModifiers and ElevationActionModifiers properties.

// use left mouse button to rotate chart  
chart3D.AzimuthAction = ActionType.LeftMouseDrag;  
chart3D.ElevationAction = ActionType.LeftMouseDrag;  
// use alt + left mouse button to change chart elevation  
chart3D.ElevationAction = ActionType.LeftMouseDrag;  
chart3D.ElevationActionModifiers = ModifierKeys.Alt;  

We’ve also made it easier to determine the data point at any mouse position so you can display detailed tooltips and pop-ups to the user. There are two new Chart3D methods that perform coordinate conversion from data to control and vice versa. PointToData converts 2D screen control coordinates to 3D data coordinates. DataToPoint converts 3D data coordinates to 2D screen control coordinates. The conversion methods returns null if conversion is not possible (e.g. no data corresponds to the specified point).

Distributing DirectX Libraries

The built-in Direct3D rendering feature of C1Chart3D depends upon a few additional assemblies from SharpDX. These assemblies are installed with Studio for WPF, and will automatically be included with your compiled output. The following assemblies will be distributed along with your application:

  • SharpDX.D3DCompiler.dll
  • SharpDX.Direct3D9.dll
  • SharpDX.Direct3D10.dll
  • SharpDX.dll
  • SharpDX.DXGI.dll

During development these assemblies should be found in the same directory as the C1.WPF.C1Chart3D assembly but do not need to be directly referenced by the project. If you are referencing the installed C1Chart3D assembly then you should not have to do anything.

Troubleshooting Direct3D

If you find that the plot area renders nothing, then your graphics card may not support Direct3D. There are two key requirements you need to check:

  • DirectX Version 10.0 or higher
  • D3D9 Overlay Support

You can determine your version of DirectX by running the DirectX Diagnostic Tool (dxdiag.exe). You can determine if your card supports D3D9 overlay by running the following from a command prompt:

dxdiag.exe /t dxinfo.txt

In the output text file, search for “D3D9 Overlay” and check that it is supported or enabled. Also note that the Direct3D mode does not work on some virtual machines (Hyper-V) and through remote desktop connections since the required hardware layer is not supported in such cases. If your users may not support Direct3D rendering you can always allow a fallback to the default rendering. It may be slower, but it will work anywhere WPF can run.

ComponentOne Product Manager Greg Lutz

Greg Lutz

comments powered by Disqus