Skip to content

Commit

Permalink
fix: resize
Browse files Browse the repository at this point in the history
  • Loading branch information
vcellu committed Nov 15, 2022
1 parent c6b7835 commit b2936b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ios/MiniChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class MiniChartRenderer {
var isHalfScale = false
var yAxis: YAxis?
var totalBandWidth = 0.0
var DEFAULT_HORIONTAL_PADDING = 8.0

init() {

Expand Down Expand Up @@ -110,8 +111,8 @@ class MiniChartRenderer {

func getBandWidth(rect: CGRect, data: Matrix) {
let count = data.qMatrix?.count ?? 1
let width = rect.width - horizontalPadding
totalBandWidth = min(width*0.1, width / CGFloat(count))
let width = rect.width - DEFAULT_HORIONTAL_PADDING
totalBandWidth = min(width * 0.1, width / CGFloat(count))
bandWidth = totalBandWidth * 0.8
padding = totalBandWidth * 0.1

Expand Down
1 change: 1 addition & 0 deletions ios/MiniSparkLineChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class MiniSparkLineChart: MiniChartRenderer {
override func render(_ ctx: CGContext, rect: CGRect) {
guard let data = data else {return}
guard let rows = data.qMatrix else {return}
DEFAULT_HORIONTAL_PADDING = 16
horizontalPadding = 16
verticalPadding = 16
linePath.removeAllPoints()
Expand Down

0 comments on commit b2936b7

Please sign in to comment.