Meet cute and very flexibility library for iOS application for different data view in one circle diagram.

Overview

SMDiagramViewSwift

Meet cute and very flexibility library for iOS application for different data view in one circle diagram. The opportunity of transformation of this sample make application interactive, colorful with wow-effect.

CocoaControls

Images

Requirements

  • Xcode 9
  • iOS 9.x+
  • Swift 4

Be sure to read all instructions carefully.

Installing with CocoaPods

use_frameworks! 

pod 'SMDiagramViewSwift', '~> 1.0'

Usage

Add a UIView instance in your .storyboard or .xib, set SMDiagramView class, connect IBOutlet and add DataSource

import SMDiagramViewSwift

class ViewController: UIViewController, SMDiagramViewDataSource {
    
    let dataSource = [1, 2, 3, 4, 5]
    
    @IBOutlet weak var diagramView: SMDiagramView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        diagramView.dataSource = self
    }
}

Setup SMDiagramView if need

    override func viewDidLoad() {
        super.viewDidLoad()
        
        diagramView.dataSource = self
        diagramView.minProportion = 0.1
        diagramView.diagramViewMode = .arc // or .segment
        diagramView.diagramOffset = .zero
        diagramView.radiusOfSegments = 80.0
        diagramView.radiusOfViews = 130.0
        diagramView.arcWidth = 6.0 //Ignoring for SMDiagramViewMode.segment
        diagramView.startAngle = -.pi/2
        diagramView.endAngle = 2.0 * .pi - .pi/2.0
        diagramView.colorOfSegments = .black
        diagramView.viewsOffset = .zero
        diagramView.separatorWidh = 1.0
        public var separatorColor = .white
}

DataSource functions

    //Required
    func numberOfSegmentsIn(diagramView: SMDiagramView) -> Int {
        return dataSource.count
    }
    
    //Optional
    func diagramView(_ diagramView: SMDiagramView, proportionForSegmentAtIndex index: NSInteger) -> CGFloat {
        return CGFloat(1/dataSource.count)
    }
    func diagramView(_ diagramView: SMDiagramView, colorForSegmentAtIndex index: NSInteger, angle: CGFloat) -> UIColor? {
        return .black
    }
    func diagramView(_ diagramView: SMDiagramView, viewForSegmentAtIndex index: NSInteger, colorOfSegment color:UIColor?, angle: CGFloat) -> UIView? {
        return UIView()
    }
    func diagramView(_ diagramView: SMDiagramView, offsetForView view: UIView?, atIndex index: NSInteger, angle: CGFloat) -> CGPoint {
        return .zero
    }
    func diagramView(_ diagramView: SMDiagramView, radiusForView view: UIView?, atIndex index: NSInteger, radiusOfSegment radius: CGFloat, angle: CGFloat) -> CGFloat {
        return 130.0
    }
    func diagramView(_ diagramView: SMDiagramView, radiusForSegmentAtIndex index: NSInteger, proportion: CGFloat, angle: CGFloat) -> CGFloat {
        return 80.0
    }
    func diagramView(_ diagramView: SMDiagramView, lineWidthForSegmentAtIndex index: NSInteger, angle: CGFloat) -> CGFloat {
        //not called for SMDiagramViewModeSegment
        return 6.0
    }

Compatibility

  • IOS 9-11

Changelog

Version: 1.0

  • Initial Build

Contributors

  • Contributors and stars are welcome.

License

Copyright 2017 VRG Soft

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
Simple and intuitive iOS chart library. Contribution graph, clock chart, and bar chart.
Simple and intuitive iOS chart library. Contribution graph, clock chart, and bar chart.

TEAChart Simple and intuitive iOS chart library, for Pomotodo app. Contribution graph, clock chart, and bar chart. Supports Storyboard and is fully ac

A charting library to visualize and interact with a vector map on iOS. It's like Geochart but for iOS!
A charting library to visualize and interact with a vector map on iOS. It's like Geochart but for iOS!

FSInteractiveMap A charting library to visualize data on a map. It's like geochart but for iOS! The idea behind this library is to load a SVG file of

ANDLineChartView is easy to use view-based class for displaying animated line chart.
ANDLineChartView is easy to use view-based class for displaying animated line chart.

ANDLineChartView for iOS ANDLineChartView is easy to use view-based class for displaying animated line chart. Usage API is simple. Just implement foll

SwiftChart - A simple line and area charting library for iOS.
SwiftChart - A simple line and area charting library for iOS.

SwiftChart A simple line and area charting library for iOS. πŸ“ˆ Line and area charts 🌞 Multiple series πŸŒ’ Partially filled series 🏊 Works with signed

 SwiftCharts - Easy to use and highly customizable charts library for iOS
SwiftCharts - Easy to use and highly customizable charts library for iOS

SwiftCharts Easy to use and highly customizable charts library for iOS Features: Bars - plain, stacked, grouped, horizontal, vertical Scatter Lines (s

iOS-based charting library for both line and bar graphs.
iOS-based charting library for both line and bar graphs.

JBChartView Introducing JBChartView - Jawbone's iOS-based charting library for both line and bar graphs. It is easy to set-up, and highly customizable

Dr-Charts Easy to use, customizable and interactive charts library for iOS in Objective-C
Dr-Charts Easy to use, customizable and interactive charts library for iOS in Objective-C

dr-charts Easy to use, customizable and interactive charts library for iOS in Objective-C Features: Multiple chart types Line / Multiple lines / Lines

Easy to use and highly customizable pie charts library for iOS
Easy to use and highly customizable pie charts library for iOS

PieCharts Easy to use and highly customizable pie charts library for iOS Swift 4.2, iOS 8+ Video Features: Customizable slices Add overlays using simp

FLCharts: Easy to use and highly customizable charts library for iOS
FLCharts: Easy to use and highly customizable charts library for iOS

FLCharts Requirements Xcode 11 / Swift 5 iOS = 11.0 Installation FLCharts is av

Comments
  • Carthage Support

    Carthage Support

    Description

    I use Carthage as dependency manager (CocoaPods alternative) and needs to add support to this library.

    Solution

    Add Carthage files to support library as https://github.com/Carthage/Carthage#supporting-carthage-for-your-framework

    opened by rafaelsachetto 0
  • Clear Color support for Separators

    Clear Color support for Separators

    Hi,

    I just wanted to have support for clear separators. So I had to improve the drawings of the initial arcs.

    Leave a comment if I can improve my work.

    Thanks Martin

    opened by jagge1988 0
Owner
VRG Soft
VRG Soft
VRG Soft
Demo-implementation of 5 different Chart Libraries in SwiftUI

Comparison of Chart Libraries for SwiftUI Read the entire blog post including images on jannikarndt.de! I want to add charts to my SwiftUI iOS App, Ze

Jannik Arndt 73 Oct 12, 2022
An overview of the different types of charts you can make with Swift Charts

Swift Charts Examples This repo aims to provide sample code for lots of different chart types for you to use as inspiration for your own projects. We

Jordi Bruin 1.2k Dec 30, 2022
A powerful πŸš€ Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.

⚑ A powerful & easy to use chart library for Android ⚑ Charts is the iOS version of this library Table of Contents Quick Start Gradle Maven Documentat

Philipp Jahoda 36k Jan 5, 2023
Delta is an all-in-one classic video game emulator for non-jailbroken iOS devices.

Delta Delta is an all-in-one classic video game emulator for non-jailbroken iOS devices. Delta is an iOS application that allows you to emulate and pl

Riley Testut 1.7k Jan 6, 2023
SwiftyOpenGraph - A swift library that retrieves structured open graph data from webpages.

SwiftyOpenGraph Usage Initialization Base Properties Types Installation License Usage Initialization You use SwiftyOpenGraph by initializing OpenGraph

Quintschaf 1 Jan 6, 2022
Simple iOS Application built using UIKit displaying the list of Cryptocurrencies and a detailed screen with a line graph.

CryptoViewer Simple iOS Application built using UIKit displaying the list of Cryptocurrencies and a detailed screen with a line graph. Home Screen: Di

null 0 Jun 14, 2022
Eat fit is a component for attractive data representation inspired by Google Fit

EatFit Check this article on our blog. Purpose Eat fit is a component for attractive data representation inspired by Google Fit. It is based on PageVi

Yalantis 657 Jan 5, 2023
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift.

ScrollableGraphView Announcements 9-7-2017 - Version 4: Version 4 was released which adds multiple plots, dynamic reloading of values, more reference

Phillip 5.3k Jan 5, 2023
Light weight charts view generater for iOS. Written in Swift.

# ###Light weight charts view generater for iOS. Written in Swift. Requirements iOS 8.0+ XCode 7.3+ Installation CocoaPods $ pod init specify it in yo

Recruit Holdings. Media Technology Lab 982 Nov 16, 2022