Skip to content

Commit 94e9e0a

Browse files
authored
Merge pull request #24 from tradingview/feature/migrate_to_3.6
Migrate backend to 3.6.1
2 parents 8aaf009 + 86fdc67 commit 94e9e0a

File tree

11 files changed

+142
-11
lines changed

11 files changed

+142
-11
lines changed

Example/LightweightCharts/Example/FloatingTooltipViewController.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ class FloatingTooltipViewController: UIViewController {
2626

2727
private func setupUI() {
2828
let options = ChartOptions(
29-
layout: LayoutOptions(backgroundColor: "#ffffff", textColor: "#333"),
29+
layout: LayoutOptions(
30+
background: .solid(color: "#ffffff"),
31+
textColor: "#333"
32+
),
3033
rightPriceScale: VisiblePriceScaleOptions(
3134
scaleMargins: PriceScaleMargins(
3235
top: 0.2,
@@ -39,6 +42,9 @@ class FloatingTooltipViewController: UIViewController {
3942
grid: GridOptions(
4043
verticalLines: GridLineOptions(color: "#ffffff"),
4144
horizontalLines: GridLineOptions(color: "#eee")
45+
),
46+
kineticScroll: KineticScrollOptions(
47+
touch: false, mouse: false
4248
)
4349
)
4450
let chart = LightweightCharts(options: options)
@@ -79,7 +85,8 @@ class FloatingTooltipViewController: UIViewController {
7985
topColor: "rgba(0, 150, 136, 0.56)",
8086
bottomColor: "rgba(0, 150, 136, 0.04)",
8187
lineColor: "rgba(0, 150, 136, 1.0)",
82-
lineWidth: .two
88+
lineWidth: .two,
89+
lastPriceAnimation: .continuous
8390
)
8491
let series = chart.addAreaSeries(options: options)
8592
let data = [

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- LightweightCharts (3.5.0)
2+
- LightweightCharts (3.6.1)
33

44
DEPENDENCIES:
55
- LightweightCharts (from `../`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
99
:path: "../"
1010

1111
SPEC CHECKSUMS:
12-
LightweightCharts: 9a374056b466a14aba9513907af6c6763a209cc3
12+
LightweightCharts: f4f71d444412003d793ba5dee4c38dc7aea66097
1313

1414
PODFILE CHECKSUM: 10aa45b030d82b96cfc0e4e3b143c5488576107b
1515

LightweightCharts.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'LightweightCharts'
4-
s.version = '3.5.0'
4+
s.version = '3.6.1'
55
s.summary = 'LightweightCharts for iOS.'
66
s.description = 'LightweightCharts pod. Swift wrapper above JavaScript library.'
77
s.homepage = 'https://tradingview.com'
@@ -19,9 +19,9 @@ Pod::Spec.new do |s|
1919
:script => 'LIBRARY=${TEMP_DIR}/lightweight-charts.js
2020
2121
if [ "${CONFIGURATION}" = "Release" ]; then
22-
curl -o $LIBRARY https://unpkg.com/lightweight-charts@3.5.0/dist/lightweight-charts.standalone.production.js
22+
curl -o $LIBRARY https://unpkg.com/lightweight-charts@3.6.1/dist/lightweight-charts.standalone.production.js
2323
else
24-
curl -o $LIBRARY https://unpkg.com/lightweight-charts@3.5.0/dist/lightweight-charts.standalone.development.js
24+
curl -o $LIBRARY https://unpkg.com/lightweight-charts@3.6.1/dist/lightweight-charts.standalone.development.js
2525
fi
2626
2727
cp -f $LIBRARY ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/lightweight-charts.js'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Foundation
2+
3+
public enum ColorType: String, Codable {
4+
case solid = "solid"
5+
case verticalGradient = "gradient"
6+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Foundation
2+
3+
/**
4+
This enum is used to specify the type of the last price animation for series such as area or line
5+
*/
6+
public enum LastPriceAnimationMode: Int, Codable {
7+
/**
8+
Animation is always disabled
9+
*/
10+
case disabled
11+
12+
/**
13+
Animation is always enabled
14+
*/
15+
case continuous
16+
17+
/**
18+
Animation is active some time after data update
19+
*/
20+
case onDataUpdate
21+
}

LightweightCharts/Classes/LightweightChartsModels/Options/ChartOptions/ChartOptions.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ public struct ChartOptions: Codable {
6969
Structure that describes scaling behavior or boolean flag that disables/enables all kinds of scales
7070
*/
7171
public var handleScale: TogglableOptions<HandleScaleOptions>?
72+
73+
/**
74+
Structure that describes kinetic scroll behavior
75+
*/
76+
public var kineticScroll: KineticScrollOptions?
7277

7378
public init(width: Double? = nil,
7479
height: Double? = nil,
@@ -82,7 +87,8 @@ public struct ChartOptions: Codable {
8287
grid: GridOptions? = nil,
8388
localization: LocalizationOptions? = nil,
8489
handleScroll: HandleScrollOptions? = nil,
85-
handleScale: TogglableOptions<HandleScaleOptions>? = nil) {
90+
handleScale: TogglableOptions<HandleScaleOptions>? = nil,
91+
kineticScroll: KineticScrollOptions? = nil) {
8692
self.width = width
8793
self.height = height
8894
self.watermark = watermark
@@ -96,6 +102,7 @@ public struct ChartOptions: Codable {
96102
self.localization = localization
97103
self.handleScroll = handleScroll
98104
self.handleScale = handleScale
105+
self.kineticScroll = kineticScroll
99106
}
100107

101108
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Foundation
2+
3+
/**
4+
You can disable or enable kinetic scroll via mouse or via touch gestures separately
5+
*/
6+
public struct KineticScrollOptions: Codable {
7+
8+
/**
9+
If true, kinetic scroll is enabled via touch gestures
10+
*/
11+
var touch: Bool?
12+
13+
/**
14+
If true, kinetic scroll is enabled via mouse
15+
*/
16+
var mouse: Bool?
17+
18+
public init(touch: Bool? = nil, mouse: Bool? = nil) {
19+
self.touch = touch
20+
self.mouse = mouse
21+
}
22+
}

LightweightCharts/Classes/LightweightChartsModels/Options/ChartOptions/LayoutOptions.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ public struct LayoutOptions: Codable {
88
/**
99
Background color of the chart area and the scales
1010
*/
11+
@available(*, deprecated, message: "Use background instead")
1112
public var backgroundColor: ChartColor?
1213

14+
public var background: SurfaceColor?
15+
1316
/**
1417
Color of a text on the scales
1518
*/
@@ -26,13 +29,14 @@ public struct LayoutOptions: Codable {
2629
public var fontFamily: String?
2730

2831
public init(backgroundColor: ChartColor? = nil,
32+
background: SurfaceColor? = nil,
2933
textColor: ChartColor? = nil,
3034
fontSize: Double? = nil,
3135
fontFamily: String? = nil) {
3236
self.backgroundColor = backgroundColor
37+
self.background = background
3338
self.textColor = textColor
3439
self.fontSize = fontSize
3540
self.fontFamily = fontFamily
3641
}
37-
3842
}

LightweightCharts/Classes/LightweightChartsModels/Options/SeriesOptions/Options/AreaSeriesOptions.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public struct AreaSeriesOptions: SeriesOptionsCommon {
2727
public var crosshairMarkerRadius: Double?
2828
public var crosshairMarkerBorderColor: ChartColor?
2929
public var crosshairMarkerBackgroundColor: ChartColor?
30+
public var lastPriceAnimation: LastPriceAnimationMode?
3031

3132
public init(lastValueVisible: Bool? = nil,
3233
title: String? = nil,
@@ -51,7 +52,8 @@ public struct AreaSeriesOptions: SeriesOptionsCommon {
5152
crosshairMarkerVisible: Bool? = nil,
5253
crosshairMarkerRadius: Double? = nil,
5354
crosshairMarkerBorderColor: ChartColor? = nil,
54-
crosshairMarkerBackgroundColor: ChartColor? = nil) {
55+
crosshairMarkerBackgroundColor: ChartColor? = nil,
56+
lastPriceAnimation: LastPriceAnimationMode? = nil) {
5557
self.lastValueVisible = lastValueVisible
5658
self.title = title
5759
self.priceScaleId = priceScaleId
@@ -76,6 +78,7 @@ public struct AreaSeriesOptions: SeriesOptionsCommon {
7678
self.crosshairMarkerRadius = crosshairMarkerRadius
7779
self.crosshairMarkerBorderColor = crosshairMarkerBorderColor
7880
self.crosshairMarkerBackgroundColor = crosshairMarkerBackgroundColor
81+
self.lastPriceAnimation = lastPriceAnimation
7982
}
8083

8184
}

LightweightCharts/Classes/LightweightChartsModels/Options/SeriesOptions/Options/LineSeriesOptions.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public struct LineSeriesOptions: SeriesOptionsCommon {
2626
public var crosshairMarkerRadius: Double?
2727
public var crosshairMarkerBorderColor: ChartColor?
2828
public var crosshairMarkerBackgroundColor: ChartColor?
29+
public var lastPriceAnimation: LastPriceAnimationMode?
2930

3031
public init(lastValueVisible: Bool? = nil,
3132
title: String? = nil,
@@ -49,7 +50,8 @@ public struct LineSeriesOptions: SeriesOptionsCommon {
4950
crosshairMarkerVisible: Bool? = nil,
5051
crosshairMarkerRadius: Double? = nil,
5152
crosshairMarkerBorderColor: ChartColor? = nil,
52-
crosshairMarkerBackgroundColor: ChartColor? = nil) {
53+
crosshairMarkerBackgroundColor: ChartColor? = nil,
54+
lastPriceAnimation: LastPriceAnimationMode? = nil) {
5355
self.lastValueVisible = lastValueVisible
5456
self.title = title
5557
self.priceScaleId = priceScaleId
@@ -73,6 +75,7 @@ public struct LineSeriesOptions: SeriesOptionsCommon {
7375
self.crosshairMarkerRadius = crosshairMarkerRadius
7476
self.crosshairMarkerBorderColor = crosshairMarkerBorderColor
7577
self.crosshairMarkerBackgroundColor = crosshairMarkerBackgroundColor
78+
self.lastPriceAnimation = lastPriceAnimation
7679
}
7780

7881
}

0 commit comments

Comments
 (0)