From 3e2210ca02d8e8d4564e0184dafc9122e391accd Mon Sep 17 00:00:00 2001 From: louisnw Date: Sat, 8 Jun 2024 11:09:00 +0100 Subject: [PATCH] fix histogram not showing in legend --- lightweight_charts/abstract.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lightweight_charts/abstract.py b/lightweight_charts/abstract.py index f0a7f8a..aad9ab1 100644 --- a/lightweight_charts/abstract.py +++ b/lightweight_charts/abstract.py @@ -489,19 +489,17 @@ class Histogram(SeriesCommon): super().__init__(chart, name) self.color = color self.run_script(f''' - {self.id} = {{ - type: "histogram", - series: {chart.id}.chart.addHistogramSeries({{ + {self.id} = {chart.id}.createHistogramSeries( + "{name}", + {{ color: '{color}', lastValueVisible: {jbool(price_label)}, priceLineVisible: {jbool(price_line)}, priceScaleId: '{self.id}', priceFormat: {{type: "volume"}}, - }}), - name: '{name}', - color: '{color}', - precision: 2, - }} + }}, + // precision: 2, + ) {self.id}.series.priceScale().applyOptions({{ scaleMargins: {{top:{scale_margin_top}, bottom: {scale_margin_bottom}}} }})''')