FUIChartSummaryView

open class FUIChartSummaryView : FUIDrawingView, ChartObserver

Summary content view of Chart Floorplan, and related components.

Data Source

Developer should implement FUIChartSummaryDataSource to supply a summary item when user selects a category in the FUIChartFloorplan views.

Often, the Developer will want to pin an ‘aggregate’ summary item to the left of the summary view, which might sum values for each series over the range of categories in the chart, display the macro trend, etc. For this case, return an item for categoryIndex == -1.

Delegate

Developer may also optionally implement FUIChartSummaryDelegate, to handle user taps on summary items in the FUIChartSummaryView. According to the design guidelines, this should typically drill-down into the data slice for the selected category(ies).

Usage

let item = FUIChartSummaryItem()

// Category index `-1` used for 'aggregate' column.  True category indexes are requested by `dataSource`.
item.categoryIndex = -1
item.isEnabled = false

let values: [Double] = {
var values: [Double] = []
let seriesCount = chartData().count
   for i in 0..<seriesCount {
       values.append(chartData()[i].map({ $0 * 1000 }).suffix(from: 1).reduce(0, +))
   }
    return values
}()

item.valuesText = values.map { formattedTitleForDouble($0)! }
item.title.text = "TTM"

// If `chartView != nil`, supply an item to the `dataSource`.  Otherwise, add category index to selected set.
summaryView.addItem(at: item.category)

Attention

The delegate object with type FUIChartSummaryDelegate is declared as a weak reference. So on deallocation it will be automatically set to nil. To keep it alive as expected, developer should retain the delegate object during its whole execution scope.

  • Undocumented

    Declaration

    Swift

    public var seriesTitleText: [FUIText]
  • Force summary view to invoke its dataSource. You should not typically need to call this directly, as it is invoked on changes to the selected state of the chartView.

    Declaration

    Swift

    public func reloadData()
  • Get the set of current items

    Remark

    set method is obsoleted.

    Declaration

    Swift

    public var items: [FUIChartSummaryItemType] { get set }
  • Helper method, should ONLY be used, when the view’s chartView property is nil.

    Declaration

    Swift

    public func addItem(at categoryIndex: Int)

    Parameters

    categoryIndex

    The index of the category for which a summary item should be obtained. Use -1, to obtain a ‘fixed’ or ‘aggregate’ summary item.

  • Helper method, to remove an item from the set of selected summary items. Should ONLY be used, when the view’s chartView property is nil.

    Declaration

    Swift

    public func removeItem(at categoryIndex: Int)

    Parameters

    categoryIndex

    Index of category which should be removed from the set

  • Remove all summary items, whose categoryIndex is > -1. Should ONLY be used, when the view’s chartView property is nil.

    Declaration

    Swift

    public func removeDataCategoryItems()
  • Remove all summary items. Should ONLY be used, when the view’s chartView property is nil.

    Declaration

    Swift

    public func removeAll()