Giter Site home page Giter Site logo

danxnu / coregraphicsgraph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tmdvs/coregraphicsgraph

1.0 1.0 0.0 45 KB

Draw a line graph with CoreGraphics in Swift. This code is intended to be an example of how you could use CoreGraphics to draw graphs and other similar UI elements.

Swift 100.00%

coregraphicsgraph's Introduction

CoreGraphicsGraph

Example Draw a line graph with CGPath and Swift. This is really just the result of playing with Swift, and so I can't garuntee the code is production ready, or even very good.

// GraphView.swift example usage

let myData = [
    ["Mon" : 15],
    ["Tues" : 30],
    ["Weds" : 7],
    ["Thurs" : 60],
    ["Fri" : 30],
    ["Sat" : 15],
    ["Sun" : 45]
]

let graph = GraphView(frame: CGRect(x: 50, y: 50, width: 420, height: 200), data: myData)
self.view.addSubview(graph)

Graph customisation options

There isn't really that many…

  • showLines - whether or not to display lines from Y axis values
  • showPoints - whether or not to display points on the line graph
  • linesColor - The colour of Y axis lines if visible
  • xAxisColor - The colour of the X axis
  • yAxisColor - The colour of the X axis
  • graphColor - The colour of the actual line graph and points
  • labelFont - Axis label font
  • labelColor - The colour of the axis labels
  • originLabelText - Text placed origin point
  • originLabelText - The colour of originLabelText
  • xMargin - padding left of initial point and right of last point

coregraphicsgraph's People

Contributors

tmdvs avatar heeeeeeju avatar

Stargazers

Jeremy Legendre avatar

Watchers

Daniel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.