Quick Start Guide > Tutorials (Java Android) > Tutorial 05 - Adding Tooltips and Legends
Tutorial 05 - Adding Tooltips and Legends

This article is a continuation of a tutorial series on how to create a chart using SciChart Android. So far we have created a new chart, added both X axis and Y axis, some series with data and also some zoom and pan behaviors. The previous tutorial can be found here: Tutorial 04 - Adding Zooming, Panning Behavior.

Source code for this tutorial can be found at our SciChart.Android.Examples Github Repository under v5.x > Tutorials

Adding a Chart Legend to the Chart

In SciChart, a chart legend can be created and configured via the LegendModifier:

Copy Code
// Create a LegendModifier and configure a chart legend
ModifierGroup legendModifier = sciChartBuilder.newModifierGroup()
        .withPosition(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 10)

// Add the LegendModifier to the SciChartSurface

Adding Series Tooltips

Similarly, to add series tooltips you have to create a corresponding modifier and add it to the ChartModifiers collection of a SciChartSurface. In this tutorial, we are going to add a CursorModifier to the chart:

Copy Code
// Create and configure a CursorModifier
ModifierGroup cursorModifier = sciChartBuilder.newModifierGroup()

// Add the CursorModifier to the SciChartSurface

CursorModifier adds a crosshair onto a SciChartSurface which can show series values in tooltips and chart coordinates at the intersection point:

Further Reading

To learn more about cursors and legends in SciChart please find links to the corresponding documentation articles below:

See Also