TKRadarChart - A customizable radar chart in Swift

Overview

TKRadarChart

A customizable radar chart in Swift

Xcode 9.0+ iOS 8.0+ Swift 4.0+ Build Status CocoaPods Carthage compatible License MIT

Requirements

  • iOS 8.0+
  • Xcode 9.0
  • Swift 4.0

Installation

CocoaPods

You can use CocoaPods to install TKRadarChart by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'TKRadarChart'

To get the full benefits import TKRadarChart wherever you import UIKit

import UIKit
import TKRadarChart

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/TKRadarChart.framework to an iOS project.

github "tbxark/TKRadarChart"

Manually

  1. Download and drop TKRadarChart.swift in your project.
  2. Congratulations!

Usage example

Base

Base Description Demo
Step Background polygon laps(min 1) image image
Row Number of edges of polygon (min 3) image image
Section At the same time show the number of data image image

TKRadarChartConfig

This structure is used for custom charts

    var radius: CGFloat    
    var minValue: CGFloat
    var maxValue: CGFloat

    var showPoint: Bool
    var showBorder: Bool
    var fillArea: Bool
    var clockwise: Bool
    var autoCenterPoint: Bool

TKRadarChartDataSource

This protocol represents the data model object. as such, it supplies no information about appearance

protocol TKRadarChartDataSource: class {
    func numberOfStepForRadarChart(_ radarChart: TKRadarChart) -> Int
    func numberOfRowForRadarChart(_ radarChart: TKRadarChart) -> Int
    func numberOfSectionForRadarChart(_ radarChart: TKRadarChart) -> Int

    func titleOfRowForRadarChart(_ radarChart: TKRadarChart, row: Int) -> String
    func valueOfSectionForRadarChart(withRow row: Int, section: Int) -> CGFloat
}

TKRadarChartDelegate

This represents the display and behaviour of the TKRadarChart.

protocol TKRadarChartDelegate: class {
    func colorOfTitleForRadarChart(_ radarChart: TKRadarChart) -> UIColor
    func colorOfLineForRadarChart(_ radarChart: TKRadarChart) -> UIColor
    func colorOfFillStepForRadarChart(_ radarChart: TKRadarChart, step: Int) -> UIColor

    func colorOfSectionFillForRadarChart(_ radarChart: TKRadarChart, section: Int) -> UIColor
    func colorOfSectionBorderForRadarChart(_ radarChart: TKRadarChart, section: Int) -> UIColor
}

Release History

  • 1.4.3 Upgrade to swift 4.2

  • 1.4.2 Fix bugs that can not change the title font

  • 1.4.1 Fix warnign

  • 1.4.0 Upgrade to swift 4.0

  • 1.3.1 Upgrade framework config

  • 1.3.0 Support swift 3.0

  • 1.0.1 Complete basic functions, add Cocoapod and Carthage support

Contribute

We would love for you to contribute to TKRadarChart, check the LICENSE file for more info.

Meta

TBXark – @tbxark[email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/TBXark

You might also like...
Line Chart library for iOS written in Swift
Line Chart library for iOS written in Swift

Swift LineChart Usage var lineChart = LineChart() lineChart.addLine([3, 4, 9, 11, 13, 15]) Features Super simple Highly customizable Auto scaling Touc

 FlowerChart - custom chart written in Swift
FlowerChart - custom chart written in Swift

FlowerChart - custom chart written in Swift Fully vector flower-shaped chart written in Swift Flower-shaped chart written in Swift, this repo is a sam

Using Swift Charts and Voiceover Chart Descriptor to compose music. 🤯
Using Swift Charts and Voiceover Chart Descriptor to compose music. 🤯

Chart de lune 🎵 Using Swift Charts and Voiceover Chart Descriptor to compose music. 🤯 Image source: https://hadikarimi.com/portfolio/claude-debussy-

SwiftUI Bar Chart
SwiftUI Bar Chart

SwiftUI BarChart Lightweight and easy to use SwiftUI chart library for all Apple platforms Features Scaling on both axes Fully customizable axes (labe

A simple and beautiful chart lib used in Piner and CoinsMan for iOS
A simple and beautiful chart lib used in Piner and CoinsMan for iOS

PNChart You can also find swift version at here https://github.com/kevinzhow/PNChart-Swift A simple and beautiful chart lib with animation used in Pin

iOS Chart. Support animation, click, scroll, area highlight.
iOS Chart. Support animation, click, scroll, area highlight.

XJYChart XJYChart - A High-performance, Elegant, Easy-to-integrate Charting Framework. The Best iOS Objc Charts. chart more beautiful support chart sc

A simple and animated Pie Chart for your iOS app.

XYPieChart XYPieChart is an simple and easy-to-use pie chart for iOS app. It started from a Potion Project which needs an animated pie graph without i

iOS/iPhone/iPad Chart, Graph. Event handling and animation supported.
iOS/iPhone/iPad Chart, Graph. Event handling and animation supported.

#EChart A highly extendable, easy to use chart with event handling, animation supported. ##Test How To Use Download and run the EChartDemo project is

FSLineChart  A line chart library for iOS.
FSLineChart A line chart library for iOS.

FSLineChart A line chart library for iOS. Screenshots Installing FSLineChart Add the contents of the FSLineChart project to your directory or simply a

Comments
  • Better Installation Section

    Better Installation Section

    Hey, your library is really interesting.

    The only problem I found was the README.md, which needs a better Installation Section. I created this iOS Open source Readme Template so you can take a look on how to easily make the Installation Section better. If you want, I can help you to organize the lib.

    What are your thoughts? 😄

    opened by lfarah 2
  • Fix Typo / Typing Error

    Fix Typo / Typing Error

    Hello! I found two issues.

    1. function spec of protocol TKRadarChartDataSource, TKRadarChartDelegate in README.md is different from real function spec.
    2. I feel lindWidth is typing error of lineWidth. So I replaced all lind to line. Thank you for your great library :)
    opened by pilgwon 0
  • Chart is too small and not centered?

    Chart is too small and not centered?

    Screen Shot 2020-09-10 at 13 19 52

    I expect the chart to fill the entire space within the white border, and that it's centered?

    Code:

    import Reusable
    import TKRadarChart
    import UIKit
    
    final class ReportSpiderChart: UITableViewCell, Reusable, NibLoadable {
      let labels = ["ARTISTS", "TRACKS", "ALBUMS"]
    
      @IBOutlet private var chartView: TKRadarChart!
      private var data: ReportData?
    
      override func awakeFromNib() {
        super.awakeFromNib()
        chartView.configuration.borderWidth = 1
        chartView.dataSource = self
        chartView.delegate = self
        chartView.layer.borderWidth = 1
        chartView.layer.borderColor = UIColor.white.cgColor
      }
    
      func configure(data: ReportData) {
        self.data = data
        chartView.configuration.maxValue = CGFloat(max(data.artists, data.albums, data.tracks, data.previousArtists, data.previousAlbums, data.previousTracks))
        chartView.reloadData()
      }
    }
    
    extension ReportSpiderChart: TKRadarChartDataSource {
      func numberOfStepForRadarChart(_ radarChart: TKRadarChart) -> Int {
        return 3
      }
    
      func numberOfRowForRadarChart(_ radarChart: TKRadarChart) -> Int {
        return 3
      }
    
      func numberOfSectionForRadarChart(_ radarChart: TKRadarChart) -> Int {
        return 2
      }
    
      func titleOfRowForRadarChart(_ radarChart: TKRadarChart, row: Int) -> String {
        return labels[row]
      }
    
      func valueOfSectionForRadarChart(withRow row: Int, section: Int) -> CGFloat {
        guard let data = data else {
          return 0
        }
    
        if row == 0 {
          return CGFloat(section == 0 ? data.artists : data.previousArtists)
        }
    
        if row == 1 {
          return CGFloat(section == 0 ? data.albums : data.previousAlbums)
        }
    
        if row == 2 {
          return CGFloat(section == 0 ? data.tracks : data.previousTracks)
        }
    
        return 0
      }
    }
    
    extension ReportSpiderChart: TKRadarChartDelegate {
      func colorOfLineForRadarChart(_ radarChart: TKRadarChart) -> UIColor {
        return .reportDivider
      }
    
      func colorOfFillStepForRadarChart(_ radarChart: TKRadarChart, step: Int) -> UIColor {
        return .black
      }
    
      func colorOfSectionFillForRadarChart(_ radarChart: TKRadarChart, section: Int) -> UIColor {
        return section == 0 ? UIColor.reportRed.withAlphaComponent(0.75) : UIColor.reportChartInactive.withAlphaComponent(0.75)
      }
    
      func fontOfTitleForRadarChart(_ radarChart: TKRadarChart) -> UIFont {
        return .systemFont(ofSize: 11, weight: .semibold)
      }
    
      func colorOfTitleForRadarChart(_ radarChart: TKRadarChart) -> UIColor {
        return .reportGrayText
      }
    }
    
    opened by kevinrenskers 1
  • Custom legend

    Custom legend

    Hello,

    I use your spider chart, it works perfectly well, except I want to custom just a little more the legend of my chart. change the color, the number of line and the font.

    If is it possible, How can I do you it ?

    opened by JonathanRamier 2
Releases(1.4.3)
Owner
TBXark
iOS Developer, Swift programmer.
TBXark
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

柳东原 · Dongyuan Liu 1.2k Nov 29, 2022
Easy to use Spider (Radar) Chart library for iOS written in Swift.

DDSpiderChart Easy to use Spider (Radar) Chart library for iOS written in Swift. Requirements iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ Xcode

Deniz Adalar 82 Nov 14, 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
an iOS open source Radar Chart implementation

JYRadarChart an open source iOS Radar Chart implementation ##Screenshots Requirements Xcode 5 or higher iOS 5.0 or higher ARC CoreGraphics.framework D

Johnny Wu 416 Dec 31, 2022
Repositório com o app exemplo para o uso do gráfico radar.

RadarExample Repositório com o app exemplo para o uso do gráfico radar. É um método gráfico de apresentar dados multivariáveis, na forma de um gráfico

null 0 Nov 5, 2021
This is pie chart that is very easy to use and customizable design.

CSPieChart Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation CSPieCh

iOSCS 40 Nov 29, 2022
JTChartView is the new lightweight and fully customizable solution to draw a chart

JTChartView JTChartView is the new lightweight and fully customizable solution to draw a curve and fill the space underneath it with a gradient. The r

Jakub Truhlář 124 Sep 7, 2022
Fully customizable line chart for SwiftUI 🤩

?? CheesyChart Create amazing Crypto and Stock charts ?? ?? Looking for an easy to use and fully customizable charting solution written in SwiftUI? Th

adri567 13 Dec 14, 2022
A simple and beautiful chart lib used in Piner and CoinsMan for iOS(https://github.com/kevinzhow/PNChart) Swift Implementation

PNChart-Swift PNChart(https://github.com/kevinzhow/PNChart) Swift Implementation Installation This isn't on CocoaPods yet, so to install, add this to

Kevin 1.4k Nov 7, 2022
Flower-like chart written in Swift

FlowerChart - custom chart written in Swift Fully vector flower-shaped chart written in Swift Flower-shaped chart written in Swift, this repo is a sam

Alexander Telegin 15 Jun 9, 2021