SChartCrosshairTooltip Class Reference

Inherits from UIView
Declared in SChartCrosshairTooltip.h
Availability
Related samples

Overview

A simple extension of the UIView class to use as the standard cross hair tooltip.

To create a custom tooltip - subclass this class and override the functions below. When the standard crosshair moves position it will call the following functions in order:

  1. setTooltipStyle:
  2. setDataPoint:fromSeries:fromChart:
  3. setPosition:onCanvas:

More information about using SChartCrosshairTooltip can be found in our tutorials ‘Customizing that Crosshair’ and ‘Data streaming, crosshairs and custom tooltips in ShinobiCharts’.

Properties

inset

The inset that is used in the implementation of layoutContents for all subviews.

@property (nonatomic, assign) CGFloat inset

Declared In

SChartCrosshairTooltip.h

label

The label that this tooltip uses to display the related data point info.

@property (nonatomic, retain) UILabel *label

Declared In

SChartCrosshairTooltip.h

style

The crosshair style object that defines the look and feel of the tooltip

@property (nonatomic, retain) SChartCrosshairStyle *style

Declared In

SChartCrosshairTooltip.h

Instance Methods

floatingAt:

Standard crosshair called-method.

- (void)floatingAt:(CGPoint)coords

Discussion

When the crosshair is in floating mode, this is called for the current floating-position. This is primarily for use in a subclass, where the label text can be set to a custom string. By default, no useful information is shown in the label.

Declared In

SChartCrosshairTooltip.h

layoutContents

This method is called everytime the tooltip needs to layout its contents and is called as part of setPosition:onCanvas:.

- (void)layoutContents

Declared In

SChartCrosshairTooltip.h

setDataPoint:fromSeries:fromChart:

Standard crosshair called-method.

- (void)setDataPoint:(id<SChartData>)dataPoint fromSeries:(SChartSeries *)series fromChart:(ShinobiChart *)chart

Discussion

Passes in information about the current crosshair data point. To convert dataPoint to a useful value - use the axis, eg:

[chart.xAxis stringForValue:dataPoint.x]

Declared In

SChartCrosshairTooltip.h

setDefaults

A method that is called to setup default properties of the tooltip (such as inset and label.)

- (void)setDefaults

Declared In

SChartCrosshairTooltip.h

setPosition:onCanvas:

Standard crosshair called-method.

Passes in the position of the crosshair target and the current canvas. This allows positioning of the tooltip, using the canvas to do border checks.

- (void)setPosition:(struct SChartPoint)pos onCanvas:(SChartCanvas *)canvas

Declared In

SChartCrosshairTooltip.h

setResolvedDataPoint:fromSeries:fromChart:

Standard crosshair called-method.

- (void)setResolvedDataPoint:(SChartPoint)dataPoint fromSeries:(SChartSeries *)series fromChart:(ShinobiChart *)chart

Discussion

Passes in information about the current crosshair data point’s resolved value.

You can use dataPoint to obtain the interpolated value.

Declared In

SChartCrosshairTooltip.h