Comments (4)
Thank you much sir!
I did it. i create a custom viewbox, custom axis, and put them to a plotitem and then put plotitem into plotwidget. I can fully custom all of them. it is so good.
from pglive.
To answer first part of your question. You can get viewbox by calling viewbox = plot.getViewBox()
. But if your aim is to modify mouse events, I would suggest to overload LivePlotWidget with your custom event handlers.
Here is an example (getting ViewBox is there as well):
import signal
from threading import Thread
import pglive.examples_pyqt5 as examples
from pglive.sources.data_connector import DataConnector
from pglive.sources.live_candleStickPlot import LiveCandleStickPlot
from pglive.sources.live_plot_widget import LivePlotWidget
from pyqtgraph import QtCore # type: ignore
"""
In this example candlestick plot is displayed.
"""
class CustomLivePlotWidget(LivePlotWidget):
def mouseMoveEvent(self, ev: QtCore.QEvent) -> None:
super().mouseMoveEvent(ev)
print("Mouse move:", ev.pos())
def wheelEvent(self, ev):
super().wheelEvent(ev)
print("Mouse wheel:", ev.angleDelta())
win = CustomLivePlotWidget(title="Candlestick Plot @ 10Hz")
plot = LiveCandleStickPlot()
win.addItem(plot)
data_connector = DataConnector(plot, max_points=50, update_rate=10)
# Get viewbox
viewbox = plot.getViewBox()
print(viewbox)
win.show()
Thread(target=examples.candle_generator, args=(data_connector,)).start()
signal.signal(signal.SIGINT, lambda sig, frame: examples.stop())
examples.app.exec()
examples.stop()
Regarding second part of the question. I have to have a look at this. I'm not sure if the numpy array is limiting factor here. I would say it's the drawing part itself, as pglive is plotting all items every time plot is redrawn. Maybe there is some way to optimize it by caching some objects. How many candles do you expect to plot in your app?
You may consider using https://github.com/domarm-comat/pglive#plot-speed-optimizations to limit number of candles by using LiveAxisRange
.
I will get back to you with this. I'm a bit busy right now, so please be patient :).
from pglive.
That's good to hear! You're welcome :).
Do you still have issue with the performance or you manage to optimize it to your liking?
from pglive.
I am still doing with my project, I will report and ask you if i have a problem. Thank for your time!
from pglive.
Related Issues (20)
- LiveAxisRange Multiple Plots Auto range if plot turned off. HOT 4
- Question: If using "Promoted Widget", How to add LivePlotWidget(title=...., axisItems=......, **kwargs) HOT 2
- "cb_append_data_point" leads to runtime error if no existing points are present HOT 7
- Support for "connect" attribute of pyqtgraph PlotDataItem/PlotCurveItem? HOT 2
- .removeItem() interferes with auto-range HOT 2
- can you add the function load old data for candlesticklive example? or how can to emplemt it? thank you HOT 6
- Question, possible issue HOT 8
- Feature request (continuation on the previous issue) HOT 6
- How to append data from list or array HOT 5
- Poetry Update HOT 4
- How to clear data from DataConnector? HOT 3
- Feature request: Add crosshair after LivePlotWidget constructor called HOT 2
- Understanding DataConnector update_rate and data append time HOT 9
- Tick strings on the bottom axis overlaps with its label HOT 3
- Roll on tick HOT 4
- ValueError: operands could not be broadcast together with shapes (2,) (0,) HOT 14
- Formatting x axis timestamp for Axis.TIME HOT 4
- TypeError: ufunc 'isfinite' not supported for the input types HOT 2
- Bug or Feature? LivePlotWidget "bottom" axis ticks labels disappear if string is more than simple one liner
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pglive.