FUIChartFloorplanView

View implementation of FUIChartFloorplan. Shared by FUIChartFloorplanViewController and FUIChartFloorplanTableViewCell.

Composed of FUIChartTitleView, FUIChartSummaryView, FUIChartPlotView, and FUIChartLegendView. The FUIChartView of the FUIChartPlotView is exposed as a public property, and should be used directly by the developer.

Data Sources

Developer should implement the FUIChartViewDataSource to supply data to the FUIChartView.

Developer should implement the FUIChartSummaryDataSource to supply FUIChartSummaryItem instances to be displayed when users select categories in the chart view.

Delegates

Developer may optionally implement the FUIChartSummaryDelegate, to handle selection of the FUIChartSummaryItem(s).

Usage

self.title = "Sales Chart"
self.chartView.chartType = .bar
self.chartView.numberOfGridlines = 4
self.chartView.dataSource = self

self.summaryView.dataSource = self
self.titleText.text = "Total APE ($) by Salesperson"
self.status.text = "Updated 20m ago"
self.categoryAxisTitle.text = "Salesperson"
self.valuesAxisTitle.text = "Total APE ($)"

let item = FUIChartSummaryItem()
item.categoryIndex = -1
item.isEnabled = false
item.isPreservingTrendHeight = false

let values: [Double] = {
    var values: [Double] = []
    for series in chartView.series {
        let categoriesUpperBound = series.numberOfValues - 1
        if let valuesInSeries = series.valuesInCategoryRange((0...categoriesUpperBound), dimension: 0) {
            values.append(valuesInSeries.flatMap({ $0 }).reduce(0.0, +))
        }
    }
    return values
}()

let numberFormatter  = NumberFormatter()
numberFormatter.numberStyle = .currency
numberFormatter.maximumFractionDigits = 0

item.valuesText = values.map { "\(numberFormatter.string(from: $0 as NSNumber)!)k" }
item.titleText.text = "Team ($) APE"
self.summaryView.addItem(item)

Theming

Supported class paths:

fdlFUIChartFloorplanView_title {}
fdlFUIChartFloorplanView_subtitle {}
fdlFUIChartFloorplanView_status {}
fdlFUIChartFloorplanView_seriesTitles {}
fdlFUIChartFloorplanView_valuesAxisTitle {}
fdlFUIChartFloorplanView_secondaryValuesAxisTitle {}
fdlFUIChartFloorplanView_categoryAxisTitle {}

Supported properties:

font-color: Color;
font-style: UIFontTextStyle;
text-line-clamp: Integer;
text-align: NSTextAlignment;