SciChart Android 3D Tutorial - Zooming and Rotating
So far, we have created a 3D chart, added XAxis, YAxis and ZAxis and 3D scatter series.
In this SciChart Android 3D tutorial we're going to add some interactivity for 3D chart, that at the end we should be able to zoom and rotate camera around the chart.
Getting Started
This tutorial is suitable for Java and Kotlin.
Note
Source code for this tutorial can be found at our Github Repository: Java and Kotlin Tutorials 3D Repository
First of all, make sure, you've read the Tutorial 01 - Create a simple Scatter Chart 3D and have a basic understanding of how to use SciChart 3D.
Now, let's give some definition for Zooming and Rotation:
- zoom — means to enlarge the chart by zooming in on a section. You use two fingers to do this. But it's more than just zooming into a 2D drawing, the perspective changes as you move throughout the 3D space, creating the illusion that you are moving inside the cube which is the chart.
- rotate — means to move rotate the camera and move it up and down. Remember that the camera is your perspective, or the projection from your eye of the chart onto the 2D surface of the screen.
3D ChartModifiers
In SciChart Amdroid 3D, chart interactions are defined by 3D ChartModifiers. In addition to the default SciChart modifiers you can write custom modifiers or extends existing ones.
Here is the list of modifiers available out of the box in SciChart:
- ZoomExtentsModifier3D
- PinchZoomModifier3D
- OrbitModifier3D
- FreeLookModifier3D
- VertexSelectionModifier3D
- TooltipModifier3D
- LegendModifier3D
- ModifierGroup3D
Adding 3D Chart Modifiers
Now we are going to create and configure a couple of modifiers and add a set of them as modifier collection of the SciChartSurface3D:
Collections.addAll(surface.getChartModifiers(),
new OrbitModifier3D(),
new ZoomExtentsModifier3D(),
new PinchZoomModifier3D());
Where to Go From Here?
You can download the final project from our Java and Kotlin Tutorials 3D Repository.
Also, you can found next tutorial from this series here - SciChart Android 3D Tutorial - Cursors and Tooltips
Of course, this is not the maximum of what you can achieve with the SciChart Android 3D. You can find more information about modifiers which are used in this tutorial in the articles below:
Finally, start exploring. The SciChart Android library and functionality is quite extensive. You can look into our SciChart Android Examples Suite which are full of 2D and 3D examples, which are also available on our GitHub