Skip to content

wfreaks/metal_chart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

FMChart Documentation

FMChart is a charting framework that utilizes Metal API on A7+ iOS devices running iOS 8 or later.

Main Features

  • thin & light
  • flexible & customizable
  • fast
  • low CPU loads
  • explicit

Concepts & Models

In FMChart, a chart consists of :

  • Data space
  • Data series (in above space)
  • Projections (Data Space -> View)
  • Data Renderers (series+projection -> lines/points)
  • Attachment (Axis, label, plot area, etc)
  • Chart (container for above elements, view delegate)

You need to allocate them, configure their properties and relationships in order to fully manipulate a chart.
(You can use the utilities to omit conventional lines, though)

Sample Codes

See HealthKit sample. The view controller queries all systolic/diastolic blood pressures, weights and daily step counts from HealthKit, and then show them simultaneously.

Workflow

  1. Put a chart view (FMMetalView) on your storyboards / xibs.
  2. Create chart (and configurator if needed, configure view/delegate otherwise)
  3. Create dimensions, range filters, projection(range) updaters
  4. Create space by combining above dimensions
  5. Create data containers (series), insert data points if ready
  6. Create data renderers(FMRenderable) that hold the containers
  7. Create attachments (axis, labels, gridlines, plot area)
  8. Manage attributes(FMUniformXXXAttributes) and configurations
  9. Add renderers/attachments to chart (if not using configurator)
  10. (Re)Load data if necessary

Note that a FMChartConfigurator instance can perform almost all object allocations and initial settings.

Chart & Configurator

See

If you are not using FMChartConfigurator, you should follow :

  • Create FMSurfaceConfiguration instance FMEngine instance
  • Configure using [FMChartConfigurator configureMetalChart: view: preferredFps].
  • Set engine.device to view.device
  • Set chart as view.delegate
  • Create FMAnimator and FMGestureDispatcher, set relations

Creating Dimensions & Spaces

See

Adding Axes

See

Prefer using FMExclusiveAxis to FMSharedAxis when possible. You can share a range through dimension and updater even if you have multiple charts, space, axes and axis labels instances.

Adding Labels to Axes

See

FMAxisLabel requires Core Text and Core Graphics.
You can perform additional action to context before each text line rendering, and modify ranges of valid render cache (e.g. invalidate 3 labels from left side)

Adding Grid Lines

See

A grid line instance can be used without an axis (in this case you should manage configurations manually).

License

This software is released under the MIT License.

About

An iOS charting library using metal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published