Code Monkey home page Code Monkey logo

wsof401 / kschart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sevtin/kschart

0.0 0.0 0.0 38.78 MB

k线图/kline/kchart,已经集成MA/EMA/MACD/KDJ/BOLL/RSI/WR/AVG等指标,新增指标及其方便。适用于股票/区块链交易所等种类App。Swift5编写,CPU/内存占用率极低,60FPS稳定运行。示例集成websocket,并接入币安数据(需VPN)。

License: MIT License

Swift 74.45% Ruby 1.10% Objective-C 2.72% HTML 21.73%

kschart's Introduction

k线图/kline/kchart,已经集成MA/EMA/MACD/KDJ/BOLL/RSI/WR/AVG等指标,新增指标及其方便。适用于股票/区块链交易所等种类App。Swift5编写,CPU/内存占用率极低,60FPS稳定运行。示例集成websocket,并接入币安数据(需VPN)。项目采用CAShapelayer+UIBezierPath进行图形绘制,采用CATextLayer进行文本绘制。

KSChart 效果图

分时图

指标菜单

蜡烛图

选中单个蜡烛图

500多条K线数据,真机示例内存占用为11.8M(其中KSChart占用3M),机型不同CPU占用差异会比较大,老设备在滑动时帧数会略有下降

cpu占用率

memory占用率

如果觉得好用就打个赏呗

Alipay

WeChatPay

开发环境

  • Xcode 11.0+
  • Swift 5.1+

示例

请参考KSKChartView.swift

class KSKChartView: KSBaseView {
    
    lazy var klineData = [KSChartItem]()
    lazy var configure: KSChartConfigure = KSChartConfigure.init()
    
    weak var delegate: KSKChartViewDelegate?
    
    lazy var chartView: KSKLineChartView = {
        let chartView         = KSKLineChartView(frame: self.bounds)
        let style             = configure.loadConfigure()
        chartView.style       = style
        chartView.delegate    = self
        self.addSubview(chartView)
        return chartView
    }()
    ......
}

版本更新说明

5.1.8 稳定版
1、进一步优化CPU和内存占用率,CPU使用率降低20%以上;
2、精简代码KSKLineChartView代码;
3、分层管理k线视图的绘制内容;
4、重构边框与Y轴数值绘制代码;
5、修复已知bug。

5.1.9
1、新增WR/AVG指标
2、精简代码
3、优化API

5.1.10
1、优化时间线逻辑
2、精简代理方法
3、对外API统一风格

下个版本

1、重新添加最大最小值的显示

反馈/技术交流群:902071358

kschart's People

Contributors

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