ChartsOrg / Charts

Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.
Apache License 2.0
27.43k stars 5.96k forks source link

CandleStick Chart display out off bounds #5075

Open LFate opened 1 year ago

LFate commented 1 year ago

This is config code

        chartView.autoScaleMinMaxEnabled = true
        chartView.doubleTapToZoomEnabled = false
        chartView.scaleYEnabled = false
        chartView.minOffset = 0
        chartView.highlightPerDragEnabled = false
        chartView.dragDecelerationEnabled = false
        chartView.dragDecelerationFrictionCoef = 0
        chartView.legend.enabled = false        
        chartView.rightAxis.labelCount = 4
        chartView.rightAxis.spaceTop = 0.1
        chartView.rightAxis.yOffset = -5.0
        chartView.noDataText = "No data".localized
        chartView.noDataFont = UIFont.systemFont(ofSize: 14.0, weight: .medium)
        chartView.noDataTextColor = .systemGray
        chartView.drawOrder = [CombinedChartView.DrawOrder.candle.rawValue, CombinedChartView.DrawOrder.line.rawValue]

When I drag chart, content will be clipped

https://github.com/danielgindi/Charts/assets/11941730/c795a2c5-30aa-4c87-aa9f-781e8bd6db38

Did I set something wrong?

DGCharts Environment

DGCharts version: 4.1.0 - 5.0.0 Xcode version: 14.0 Swift version: 5.0 Platform(s) running DGCharts: iOS

developerjet commented 8 months ago

doubleTapToZoomEnabled

您好啊,请问解决了么。你的K线完整Demo代码可以发我参考一下不,我最近也在用Chars绘制股票K线,谢谢了。

LFate commented 8 months ago

doubleTapToZoomEnabled

您好啊,请问解决了么。你的K线完整Demo代码可以发我参考一下不,我最近也在用Chars绘制股票K线,谢谢了。

没解决😂,旧版本正常显示,新版本没找到解决方法

yiweiwoshiniya commented 3 months ago

@LFate 您好,请问解决了吗

yiweiwoshiniya commented 3 months ago

@developerjet 您好,请问解决了吗

LFate commented 3 months ago

@yiweiwoshiniya 没有,后续我没再跟进,我现在用的是旧版本的

yiweiwoshiniya commented 3 months ago

@LFate hello,谢谢回复,我换成了4.1.0版本,y轴自动更新还是显示不全,你单独时时计算y轴最大和最小值了吗

LFate commented 3 months ago

@LFate hello,谢谢回复,我换成了4.1.0版本,y轴自动更新还是显示不全,你单独时时计算y轴最大和最小值了吗

我用的应该是3.6的版本,好像从4.0开始就有这个问题。我这边用的旧版本并在ChartDataSet中补充了下面的方法才算能正常使用

    public func replaceSubrange<C>(_ subrange: Swift.Range<Int>, with newElements: C) where C : Collection, ChartDataEntry == C.Element {
            entries.replaceSubrange(subrange, with: newElements)
            notifyDataSetChanged()
    }
yiweiwoshiniya commented 3 months ago

@LFate hello,谢谢回复,我换成了4.1.0版本,y轴自动更新还是显示不全,你单独时时计算y轴最大和最小值了吗

我用的应该是3.6的版本,好像从4.0开始就有这个问题。我这边用的旧版本并在ChartDataSet中补充了下面的方法才算能正常使用

    public func replaceSubrange<C>(_ subrange: Swift.Range<Int>, with newElements: C) where C : Collection, ChartDataEntry == C.Element {
            entries.replaceSubrange(subrange, with: newElements)
            notifyDataSetChanged()
    }

谢谢,收到,我试试去