SciChart Android 3D Tutorial - Cursors and Tooltips
In the previous tutorials we've showed how to Create a Simple 3D Chart and add some Zoom and Rotate interaction via the Chart Modifiers 3D API.
In this SciChart Android 3D tutorial we're going show how to add a cursor and tooltip to that 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
Let's define what is Cursor ant Tooltip:
- cursor — a tablet or cell phone obviously does not have a mouse. Instead the mouse is your finer and the cursor is where you place your finger. It appears as a small x (cross).
- tooltip — is text that displays when you push the cursor onto an object, like a point plotted on a chart. You have to push the cursor onto the coordinate for the text to appear. In the case of the example below you probably need to use two fingers to zoom into the chart to make the points appear large enough so that you can see them.
The TooltipModifier3D
We can add more renderable on the surface by simple adding them into renderableSeries collection property. Similarly we can an add additional modifiers, such as a Tooltip Modifier 3D, which provides in SciChart.
In addition to modifiers we added in the previous tutorial, we are going to add TooltipModifier3D similarly, with the code below:
final TooltipModifier3D tooltipModifier = new TooltipModifier3D();
tooltipModifier.setExecuteOnPointerCount(2);
Collections.addAll(surface.getChartModifiers(),
new OrbitModifier3D(),
new ZoomExtentsModifier3D(),
new PinchZoomModifier3D(),
tooltipModifier
);
Note
We used executeOnPointerCount = 2
for OrbitModifier3D to omit conflict while using TooltipModifier3D
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 - Plotting Realtime Data
Of course, this is not the maximum limit 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