This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
appBar: AppBar(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.xxmassdeveloper.mpchartexample; | |
import android.graphics.Color; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.Menu; | |
import android.view.MenuItem; | |
import android.view.MotionEvent; | |
import android.view.WindowManager; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground 2: Same as 1 with added container view and "random" changes of its size/position between zoom/pan. Everything works | |
import UIKit | |
import PlaygroundSupport | |
let domainPoint = CGPoint(x: 5, y: 5) | |
// The following variables are simplified ranges - all start with 0 | |
let xDomain: CGFloat = 10 | |
let yDomain: CGFloat = 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground 1: Simple setup, everything works. | |
import UIKit | |
import PlaygroundSupport | |
let domainPoint = CGPoint(x: 5, y: 5) | |
// The following variables are simplified ranges - all start with 0 | |
let xDomain: CGFloat = 10 | |
let yDomain: CGFloat = 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AreasExample.swift | |
// SwiftCharts | |
// | |
// Created by ischuetz on 04/05/15. | |
// Copyright (c) 2015 ivanschuetz. All rights reserved. | |
// | |
import UIKit | |
import SwiftCharts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: you may have to set the module in the storyboard to "SwiftCharts", otherwise the view may not be recognized correctly, which leads to axis, labels and guidelines not showing | |
class HelloWorld: UIViewController { | |
private var chart: Chart? // arc | |
@IBOutlet weak var chartView: ChartBaseView! | |
private var didLayout: Bool = false | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ScatterExample.swift | |
// Examples | |
// | |
// Created by ischuetz on 16/05/15. | |
// Copyright (c) 2015 ivanschuetz. All rights reserved. | |
// | |
import UIKit | |
import CoreGraphics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground containing the process I did today of looking for a generic way to get an object associated with a range, using Swift | |
// for example, given a mapping of range 0..<2 to a string "first range" and 2..<4 to a string "second range", we want to get the string for the value 3.4 | |
// I started thinking about this because in my work I had to map rating ranges to certain background colors. So for example if a user gives a 5.9 rating (very good!) this would be in the range 4.5 - 6.0 which has to be displayed with a dark green background, etc. Sadly I had to do this using objc. I wondered how I would do it with Swift. | |
// The most simple way: | |
let n = 3.4 | |
let found1:String? = {if n < 2 { | |
return "first" | |
} else if n < 4 { | |
return "second" |