Ability to save drawings

- Added `toolbox` to the common methods.
- `toolbox.save_drawings_under` can save drawings under a specific `topbar` widget. eg `chart.toolbox.save_drawings_under(chart.topbar[’symbol’]`)
- `toolbox.load_drawings` will load and display drawings stored under the tag/string given.
- `toolbox.export_drawings` will export all currently saved drawings to the given file path.
- `toolbox.import_drawings` will import the drawings stored at the given file path.

Fixes/Enhancements:
- `update` methods are no longer case sensitive.
- HorizontalLines no longer throw cyclic structure errors in the web console.
- `API` methods can now be normal methods or coroutines.
This commit is contained in:
louisnw
2023-07-20 21:52:17 +01:00
parent b2ceae59b7
commit 527130e618
10 changed files with 166 additions and 55 deletions

View File

@ -1,7 +1,7 @@
project = 'lightweight-charts-python'
copyright = '2023, louisnw'
author = 'louisnw'
release = '1.0.14.1'
release = '1.0.14.2'
extensions = ["myst_parser"]

View File

@ -325,7 +325,7 @@ ___
Sets the data for the line.
When not using the `name` parameter, the columns should be named: `time | value`.
When not using the `name` parameter, the columns should be named: `time | value` (Not case sensitive).
Otherwise, the method will use the column named after the string given in `name`. This name will also be used within the legend of the chart. For example:
```python
@ -469,6 +469,7 @@ The ID shown above will change depending upon which pane was used to search, due
```{important}
* Search callbacks will always be emitted to a method named `on_search`
* `API` class methods can be either coroutines or normal methods.
```
___
@ -568,7 +569,33 @@ The following hotkeys can also be used when the Toolbox is enabled:
* Alt+H: Horizontal Line
* Alt+R: Ray Line
* Meta+Z or Ctrl+Z: Undo
___
### `save_drawings_under`
`widget: Widget`
Saves drawings under a specific `topbar` text widget. For example:
```python
chart.toolbox.save_drawings_under(chart.topbar['symbol'])
```
___
### `load_drawings`
`tag: str`
Loads and displays drawings stored under the tag given.
___
### `import_drawings`
`file_path: str`
Imports the drawings stored at the JSON file given in `file_path`.
___
### `export_drawings`
`file_path: str`
Exports all currently saved drawings to the JSON file given in `file_path`.
___
## QtChart