Code Monkey home page Code Monkey logo

linechartview's Introduction

LineChartView

LineChartView is a subclass of NSView. It can be used to easily represent numeric values on a line graph.

let ratesValues = [19.10, 19.34, 19.25, 19.50, 19.30, 19.70, 19.55, 19.60, 19.20, 19.3, 19.10, 19.0]
let xValues = Array(1...12)
let frame = CGRect(x: 0, y: 0, width: 400, height: 600)

Create an instance of LineChartView:

let diagram = LineChartView<Int, Double>(frame: frame)
diagram.data(xPoints: xValues, yPoints: ratesValues)

or

let diagram = LineChartView<Int, Double>(frame: diagramView.frame, xValues: xValues, yValues: ratesValues)

Default uncustomized

Style LineChartView by changing properties

diagram.chartLineWidth = 0.4
diagram.chartLineColour = NSColor(red: 1, green: 0.5, blue: 1, alpha: 1)
diagram.chartPointColour = NSColor(red: 1, green: 0.3, blue: 1, alpha: 1)
diagram.yAxisLabelsNumberOfDecimal = 1
diagram.chartPointRadius = 4
diagram.yAxisUnitStep = 0.21
diagram.padding = 40
diagram.labelsColor(color: NSColor(red: 0.55, green: 1, blue: 0.4, alpha: 1))

Customized 1

diagram.hideYGridlines = true
diagram.hideXGridlines = true
diagram.hideYAxisLabels = true

let font = NSFont.systemFont(ofSize: 8, weight: .ultraLight)
diagram.editAttributes(font: font, color: NSColor(red: 1, green: 1, blue: 0, alpha: 1))

Customized 2

linechartview's People

Watchers

 avatar  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.