leftScale as new Chart parameter
This commit is contained in:
@ -781,7 +781,7 @@ class Candlestick(SeriesCommon):
|
|||||||
class AbstractChart(Candlestick, Pane):
|
class AbstractChart(Candlestick, Pane):
|
||||||
def __init__(self, window: Window, width: float = 1.0, height: float = 1.0,
|
def __init__(self, window: Window, width: float = 1.0, height: float = 1.0,
|
||||||
scale_candles_only: bool = False, toolbox: bool = False,
|
scale_candles_only: bool = False, toolbox: bool = False,
|
||||||
autosize: bool = True, position: FLOAT = 'left'):
|
autosize: bool = True, position: FLOAT = 'left', leftScale: bool = False):
|
||||||
Pane.__init__(self, window)
|
Pane.__init__(self, window)
|
||||||
|
|
||||||
self._lines = []
|
self._lines = []
|
||||||
@ -794,7 +794,7 @@ class AbstractChart(Candlestick, Pane):
|
|||||||
self.polygon: PolygonAPI = PolygonAPI(self)
|
self.polygon: PolygonAPI = PolygonAPI(self)
|
||||||
|
|
||||||
self.run_script(
|
self.run_script(
|
||||||
f'{self.id} = new Lib.Handler("{self.id}", {width}, {height}, "{position}", {jbool(autosize)})')
|
f'{self.id} = new Lib.Handler("{self.id}", {width}, {height}, "{position}", {jbool(autosize)}, {jbool(leftScale)})')
|
||||||
|
|
||||||
Candlestick.__init__(self, self)
|
Candlestick.__init__(self, self)
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='lightweight_charts',
|
name='lightweight_charts',
|
||||||
version='2.0.4',
|
version='2.0.5',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
python_requires='>=3.8',
|
python_requires='>=3.8',
|
||||||
install_requires=[
|
install_requires=[
|
||||||
|
|||||||
@ -58,7 +58,8 @@ export class Handler {
|
|||||||
innerWidth: number,
|
innerWidth: number,
|
||||||
innerHeight: number,
|
innerHeight: number,
|
||||||
position: string,
|
position: string,
|
||||||
autoSize: boolean
|
autoSize: boolean,
|
||||||
|
leftScale: boolean = false
|
||||||
) {
|
) {
|
||||||
this.reSize = this.reSize.bind(this)
|
this.reSize = this.reSize.bind(this)
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ export class Handler {
|
|||||||
this.wrapper.appendChild(this.div);
|
this.wrapper.appendChild(this.div);
|
||||||
window.containerDiv.append(this.wrapper)
|
window.containerDiv.append(this.wrapper)
|
||||||
|
|
||||||
this.chart = this._createChart();
|
this.chart = this._createChart(leftScale);
|
||||||
this.series = this.createCandlestickSeries();
|
this.series = this.createCandlestickSeries();
|
||||||
this.volumeSeries = this.createVolumeSeries();
|
this.volumeSeries = this.createVolumeSeries();
|
||||||
|
|
||||||
@ -119,7 +120,7 @@ export class Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createChart() {
|
private _createChart(leftScale: boolean = false) {
|
||||||
return createChart(this.div, {
|
return createChart(this.div, {
|
||||||
width: window.innerWidth * this.scale.width,
|
width: window.innerWidth * this.scale.width,
|
||||||
height: window.innerHeight * this.scale.height,
|
height: window.innerHeight * this.scale.height,
|
||||||
@ -135,7 +136,7 @@ export class Handler {
|
|||||||
scaleMargins: {top: 0.3, bottom: 0.25},
|
scaleMargins: {top: 0.3, bottom: 0.25},
|
||||||
},
|
},
|
||||||
leftPriceScale: {
|
leftPriceScale: {
|
||||||
visible:true,
|
visible:leftScale,
|
||||||
scaleMargins:{top:.3,bottom:.25}},
|
scaleMargins:{top:.3,bottom:.25}},
|
||||||
timeScale: {timeVisible: true, secondsVisible: false},
|
timeScale: {timeVisible: true, secondsVisible: false},
|
||||||
crosshair: {
|
crosshair: {
|
||||||
|
|||||||
Reference in New Issue
Block a user