All Projects → moQingTing → DepthChart

moQingTing / DepthChart

Licence: other
深度图

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to DepthChart

Klinechart
Android仿火币K线图实现(包含MA,BOLL,MACD,KDJ,RSI,WR指标)
Stars: ✭ 620 (+2114.29%)
Mutual labels:  chart, kline
Klinechart
📈Lightweight k-line chart that can be highly customized. Zero dependencies. Support mobile.(可高度自定义的轻量级k线图,无第三方依赖,支持移动端)
Stars: ✭ 303 (+982.14%)
Mutual labels:  chart, kline
Hycharts
柱状图、折/曲线图、K线图(主图、交易量图、辅助图), 图与图可以自由组合, 支持分页加载数据 -----> 低内存、低耗电、滑动缩放顺滑
Stars: ✭ 394 (+1307.14%)
Mutual labels:  chart, kline
Ggcharts
可以高度自定义的图表框架。柱状图、折线图、雷达图、饼图、K线图、分时图。
Stars: ✭ 713 (+2446.43%)
Mutual labels:  chart, kline
Kschart
k线图/kline/kchart,已经集成MA/EMA/MACD/KDJ/BOLL/RSI/WR/AVG等指标,新增指标及其方便。适用于股票/区块链交易所等种类App。Swift5编写,CPU/内存占用率极低,60FPS稳定运行。示例集成websocket,并接入币安数据(需VPN)。
Stars: ✭ 909 (+3146.43%)
Mutual labels:  chart, kline
PrincekinKlineFrame
一款用Swift开发的K线图和深度图组件,具有轻量、敏捷等特点,可供虚拟货币行业和金融行业使用
Stars: ✭ 72 (+157.14%)
Mutual labels:  kline, depthchart
Hqchart
HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据替换接口
Stars: ✭ 1,126 (+3921.43%)
Mutual labels:  chart, kline
StockView
股票相关控件(分时图、五日分时图、自选股迷你分时图、资金趋势图、盈亏额/盈亏率)- (曲线图、折线图)
Stars: ✭ 87 (+210.71%)
Mutual labels:  chart, kline
ZingChart-Demos
A collection of tutorials and demos for using ZingChart. Clone, fork, and get started with the best Javascript charting library.
Stars: ✭ 18 (-35.71%)
Mutual labels:  chart
chart.xkcd-vue
A xkcd styled chart component for Vue.js based on chart.xkcd.
Stars: ✭ 34 (+21.43%)
Mutual labels:  chart
general-reports
Bunch of general reports for Money Manager Ex
Stars: ✭ 63 (+125%)
Mutual labels:  chart
FancyCandles
An open source candlestick chart control for WPF.
Stars: ✭ 60 (+114.29%)
Mutual labels:  chart
open money tracker
Open Source accounting application for Android.
Stars: ✭ 19 (-32.14%)
Mutual labels:  chart
charts
HAProxy Ingress helm charts
Stars: ✭ 24 (-14.29%)
Mutual labels:  chart
RKPieChart
Pie Chart written in Swift 3
Stars: ✭ 67 (+139.29%)
Mutual labels:  chart
asciichart-sharp
C# port of asciichart
Stars: ✭ 27 (-3.57%)
Mutual labels:  chart
QT StockFigure
QT显示股票分时线
Stars: ✭ 16 (-42.86%)
Mutual labels:  kline
c3-rails
c3 for Rails
Stars: ✭ 15 (-46.43%)
Mutual labels:  chart
Social-Media-Monitor
Automatically monitor and log fan counters from social media(Facebook Pages, Twitter, Instagram, YouTube, Google+, OneSignal, Alexa) using APIs to Google Spreadsheet. Very useful for website admins and social media managers.
Stars: ✭ 36 (+28.57%)
Mutual labels:  chart
GJLineChartView
支持伸缩,长按显示数据的折线图、柱状图、饼状图。
Stars: ✭ 24 (-14.29%)
Mutual labels:  chart

DepthChart 深度图

注意:图1深度图横坐标是以档位为单位,纵坐标是以档位数量为单位 ,图2深度图横坐标是以价格占比进行划分,中间可能有缺口出现,纵坐标是以档位数量为单位(代码在DepthChart_price文件夹里)

image

image

Requirements

  • iOS 8+
  • Xcode 8+
  • Swift 4.0+
  • iPhone/iPad

1、实现代理

view.delegate = self
//MARK:深度图表
extension ViewController: CHKDepthChartDelegate {
    
    
    /// 图表的总条数
    /// 总数 = 买方 + 卖方
    /// - Parameter chart:
    /// - Returns:
    func numberOfPointsInDepthChart(chart: CHDepthChartView) -> Int {
        return self.depthDatas.count
    }
    
    
    /// 每个点显示的数值项
    ///
    /// - Parameters:
    ///   - chart:
    ///   - index:
    /// - Returns:
    func depthChart(chart: CHDepthChartView, valueForPointAtIndex index: Int) -> CHKDepthChartItem {
        return self.depthDatas[index]
    }
    
    
    /// y轴以基底值建立
    ///
    /// - Parameter depthChart:
    /// - Returns:
    func baseValueForYAxisInDepthChart(in depthChart: CHDepthChartView) -> Double {
        return 0
    }
    
    /// y轴以基底值建立后,每次段的增量
    ///
    /// - Parameter depthChart:
    /// - Returns:
    func incrementValueForYAxisInDepthChart(in depthChart: CHDepthChartView) -> Double {
        
        //计算一个显示4个辅助线的友好效果
        //        var step = self.maxAmount / 4
        //        var j = 0
        //        while step / 10 > 1 {
        //            j += 1
        //            step = step / 10
        //        }
        //
        //        //幂运算
        //        var pow: Int = 1
        //        if j > 0 {
        //            for _ in 1...j {
        //                pow = pow * 10
        //            }
        //        }
        //
        //        step = Float(lroundf(step) * pow)
        //
        //        return Double(step)
        let step = Double(self.maxAmount / 4)
        print("setp == \(step)")
        return step
    }
    /// 纵坐标值显示间距
    func widthForYAxisLabelInDepthChart(in depthChart: CHDepthChartView) -> CGFloat {
        return 30
    }
    /// 纵坐标值
    func depthChart(chart: CHDepthChartView, labelOnYAxisForValue value: CGFloat) -> String {
        if value >= 1000{
            let newValue = value / 1000
            return newValue.ch_toString(maxF: 0) + "K"
        }else {
            return value.ch_toString(maxF: 1)
        }
    }
    
    /// 价格的小数位
    func depthChartOfDecimal(chart: CHDepthChartView) -> Int {
        return 4
    }
    
    /// 量的小数位
    func depthChartOfVolDecimal(chart: CHDepthChartView) -> Int {
        return 6
    }
    
    //    /// 自定义点击显示信息view
    //    func depthChartShowItemView(chart: CHDepthChartView, Selected item: CHKDepthChartItem) -> UIView? {
    //        let view = UIView(frame: CGRect(x: 0, y: 0, width: 60, height: 60))
    //        view.backgroundColor = UIColor.red
    //        return view
    //    }
    //    /// 点击标记图
    //    func depthChartTagView(chart: CHDepthChartView, Selected item: CHKDepthChartItem) -> UIView? {
    //        let view = UIView(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
    //        view.backgroundColor = UIColor.blue
    //        return view
    //    }
}

2、自定义点击显示view

/**
     自定义点击显示信息view
     - parameter chart:
     
     - returns:
     */
    @objc optional func depthChartShowItemView(chart: CHDepthChartView,Selected item: CHKDepthChartItem) -> UIView?
    
    /**
     自定义点击选中view
     - parameter chart:
     
     - returns:
     */
    @objc optional func depthChartTagView(chart: CHDepthChartView,Selected item: CHKDepthChartItem) -> UIView?

3、自定义样式

// MARK: - 扩展样式
extension CHKLineChartStyle {
    
    
    /// 深度图样式
    static var depthStyle: CHKLineChartStyle = {
        
        let style = CHKLineChartStyle()
        //字体大小
        style.labelFont = UIFont.systemFont(ofSize: 10)
        //分区框线颜色
        style.lineColor = UIColor(white: 0.7, alpha: 1)
        //背景颜色
        style.backgroundColor = UIColor.white
        //文字颜色
        style.textColor = UIColor(white: 0.5, alpha: 1)
        //整个图表的内边距
        style.padding = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
        //Y轴是否内嵌式
        style.isInnerYAxis = false
        //Y轴显示在右边
        style.showYAxisLabel = .right
        
        /// 买单居右
        style.bidChartOnDirection = .left
        
        //边界宽度
        style.borderWidth = (0, 0, 0, 0)
        
        //是否允许手势点击
        style.enableTap = true
        
        //买方深度图层的颜色 UIColor(hex:0xAD6569) UIColor(hex:0x469777)
        style.bidColor = (UIColor(hex:0xAD6569), UIColor(hex:0xAD6569), 1)
        //        style.askColor = (UIColor(hex:0xAD6569), UIColor(hex:0xAD6569), 1)
        //买方深度图层的颜色
        style.askColor = (UIColor(hex:0x469777), UIColor(hex:0x469777), 1)
        //        style.bidColor = (UIColor(hex:0x469777), UIColor(hex:0x469777), 1)
        
        return style
        
    }()
}

该项目属于二次开发,基于一个swiftK线 项目开发

项目地址

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].