Enhancements:

- added the `align` parameter to all topbar widgets, allowing for individual widgets to be placed either on the left or right hand side of the topbar.
- Disabled QtChart’s context menu by default.

Bug Fixes:
- The `screenshot` method now works for subcharts.
- Tables will still render if a `NoneType` is passed to them as a value.
- Qt and Wx charts no longer throw an error when using the toolbox.
This commit is contained in:
louisnw
2023-09-14 10:51:10 +01:00
parent 8f65a7fc96
commit b1f007f6d0
12 changed files with 104 additions and 71 deletions

View File

@ -1,5 +1,6 @@
import asyncio
import os
from base64 import b64decode
from datetime import datetime
from typing import Union, Literal, List
import pandas as pd
@ -871,6 +872,15 @@ class AbstractChart(Candlestick, Pane):
) -> Table:
return self.win.create_table(width, height, headings, widths, alignments, position, draggable, func)
def screenshot(self) -> bytes:
"""
Takes a screenshot. This method can only be used after the chart window is visible.
:return: a bytes object containing a screenshot of the chart.
"""
self.run_script(f'_~_~RETURN~_~_{self.id}.chart.takeScreenshot().toDataURL()')
serial_data = self.win._return_q.get()
return b64decode(serial_data.split(',')[1])
def create_subchart(self, position: FLOAT = 'left', width: float = 0.5, height: float = 0.5,
sync: Union[str, bool] = None, scale_candles_only: bool = False,
toolbox: bool = False) -> 'AbstractChart':