Coder Social home page Coder Social logo

cheesychart's Introduction

πŸ§€ CheesyChart

Create amazing Crypto and Stock charts πŸ“ˆπŸ“‰

Looking for an easy to use and fully customizable charting solution written in SwiftUI? Then check out CheesyChart – it’s a Swift Package that makes it simple to create beautiful charts in your own projects. With just a few lines of code, you can create prefect line charts. And if you need to display the current value of the chart, there’s an interactive label for that too. 😩

Since the latest update, you can use CheesyChart not only for stocks!

So whether you want to create a simple chart or a more complex one, CheesyChart has you covered!

πŸ›  Installation

CheesyChart requires iOS 14 and Xcode 12.

1️⃣ In Xcode go to File ➀ Add Packages...

2️⃣ In the top right corner, paste https://github.com/adri567/CheesyChart.git πŸ§€ and press Enter.

3️⃣ Choose CheesyChart from the list ➀ Add Package

This was easy, or? Now you can use CheesyChart in your project! πŸ“ˆπŸ“‰

πŸ“Š Here are some examples

πŸͺ› Usage

Copy this code ⬇️

import CheesyChart

Example 1

/// You need a @State var if you want to use the tapPoint to show the current price of the stock or coin in a extra TextView
@State var value: Int? = 0

let setup = SetupChart(
           name: (stock or coin name),
           data:  (price data),
           image: UIImage(named: "Image"),
           chartHeight: 250,
           animateChart: true,
           chartBackground: .cb5,
           chartBackgroundColor: Color(UIColor.systemGroupedBackground).opacity(0.3),
           showYAxiesStats: true,
           yAxiesStatsColor: .black,
           showShadow1: true,
           showShadow2: true,
           chartPriceLabelColor: Color(UIColor.systemGroupedBackground).opacity(0.3),
           chartPriceLabelFontColor: .black
       )

CheesyChart(setup: setup, tapPoint: $value)

Example 2

let setup = SetupChart(
               data: data,
               animateChart: true,
               startAnimationAfterAppear: 0.2,
               chartBackground: .cb2,
               chartBackgroundColor: Color.theme.background,
               showYAxiesStats: true,
               yAxiesStatsColor: Color.theme.accent,
               showShadow1: true,
               showShadow2: true,
               showShadow3: true,
               showShadow4: true,
               chartPriceLabelColor: Color.theme.background,
               chartPriceLabelFontColor: Color.theme.accent,
               chartPriceLabelShadow: Color.theme.accent
           )

CheesyChart(setup: setup)

All setup possibilities with it's standard values πŸ”₯

name: String = "" // Name of the coin or stock

data: [Double] = [] // Price data

currencyIdentifier: String = "en_US" // Default is USD. For more information: https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html

forCurrency: Bool = true // Default is set to a currency chart

label: String = "" // Is forCurrency = false, you can use your own ending

image: UIImage? = UIImage(systemName: "bitcoinsign.circle.fill") // Standart image if image is shown
       
showChartHeader: Bool = false // Default chart header

chartHeaderFontColor: Color = .black // Font color of the chart

chartHeaderColor: Color = .clear // Whole color of the chart

showHeaderImage: Bool = false // Show header image
       
chartWidth: Double = UIScreen.main.bounds.width // Width of the chart

chartHeight: Double = 200 // Height of the chart
       
animateChart: Bool = false // Line animation (from 0 to 1)

startAnimationAfterAppeariance: CGFloat = 0.1 // Animation after the appearance of the chart

chartAnimationDuration: CGFloat = 1.0 // Duration of the animation
       
chartBackground: Background = .none // Chart backgrounds (choose between .none, .cb1, .cb2, .cb3, .cb4, .cb5)

chartBackgroundColor: Color = .white // Whole background color of the chart

chartBackgroundDividerColor: Color = Color(UIColor.lightGray).opacity(0.2) // X axies divider color

showYAxiesStats: Bool = false // Price stats on the left across the y axies

yAxiesStatsColor: Color = .black // Color of the stats

yAxiesStatsAlignment: YAxiesAlignment = .leading // Position of the y axies stats
       
chartLineColorOnHigh: Color = .green // Chart color if the price goes up

chartLineColorOnLow: Color = .red // Chart color if the price goes down

chartLineWidth: CGFloat = 2 // Width of the chart line
       
showShadow1: Bool = false // Shadow 1 of the line

showShadow2: Bool = false // Shadow 2 of the line

showShadow3: Bool = false // Shadow 3 of the line

showShadow4: Bool = false // Shadow 4 of the line
       
chartPriceLabelColor: Color = .clear // Color of the drag price label

chartPriceLabelFontColor: Color = .black // Font color of the drag price label

chartPriceIndicatorColor: Color = Color(UIColor.lightGray) // Color of the price y axies indicator

chartPriceLabelYAxies: CGFloat = 40.0 // Position of the price label on the y axies

chartPriceLabelCornerRadius: CGFloat = 5 // Corner radius of the price label

chartPriceLabelShadow: Color = .clear // Shadow of the price label

cheesychart's People

Contributors

adri567 avatar fuermosi777 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cheesychart's Issues

Does it have to be $$$?

Hello,

I recently came across this beautiful chart in the SwiftUI libraries and was impressed by its rarity. However, I noticed that it seems to be specifically designed for building price charts, as the value labels are always displayed with a "$" symbol and a currency format.

I was wondering if it would be possible to provide an option for users to modify the format of the value labels. This would make the library more accessible and appealing to a wider range of users globally.

Thank you for your time and consideration.

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.