vojtamolda / Plotly.swift

Interactive data visualization library for Swift
https://vojtamolda.github.io/Plotly.swift/
MIT License
82 stars 8 forks source link

Develop PlotlyView - A generally reusable UIView for displaying Figures #14

Open vojtamolda opened 4 years ago

vojtamolda commented 4 years ago

To make the library easier to use on Apple devices (i.e. iOS/iPadOS/macOS) it would be nice to develop a generally reusable UIView. Such UI component can then be used as a "LEGO block" that displays a chart within a larger app.

PlotlyView should be a subclass of WKWebView and expose it's model as a settable property of type Plotly.Figure. Simply setting the figure object should be everything one needs to display a chart.

Here's an example use:

import Plotly

let trace = Scatter(
    x: [1, 2, 3],
    y: [3, 4, 5]
)

var view = PlotlyView()
view.figure = Figure(data: [trace])

Developing PlotlyView helps a great deal with building the standalone viewer app per #7. For more details about the motivation and general background check out the discussion in #11.

vojtamolda commented 4 years ago

Here's a few pieces of code that may be helpful to read before getting started:

vojtamolda commented 4 years ago

Here's a suggestted task list: