Comments (4)
Thanks for using pglive!
I've created new pull request Designer example
, which includes example for both PyQt5 and 6 designers.
Have a look and if it works for Your project, I will merge it into main branch.
In short: promote QWidget
to LivePlotWidget
and set header file to pglive.sources.live_plot_widget
from pglive.
Thanks for the additional examples.
I had difficulty applying the graph to the promoted widget, but that's likely due to me being brand new to PYQT.
I have never used pyqtgraph before so my experience is limited.
What I did instead of using a promoted widget is create an empty layout.
In the code I placed the widget into that empty layout. Seems to work for me.
9 lines of code was all it took.
Thanks for this super cool chart. I have 5 charts in a tab widget and it really make's the program an excellent tool.
Do you see any issue with making max points 24 hours with a update of 1 second intervals?
At that rate do you think the program can run for extended (days?) periods of time?
How are those accumulated point's stored?
from pglive.
Well, I did eventually figure it out. However, The previous method of the empty layout seems preferable to me.
Maybe because I dont convert the .ui file to a .py file. I load the .ui. in the main window .py file.
No need to promote the widget. just add it to the empty layout.
Chart Solar Watts
watts_plot = LiveLinePlot(pen="orange")
# Data connectors for each plot
self.watts_connector = DataConnector(watts_plot, max_points=86400) # 24 hours in seconds
# Setup bottom axis with TIME tick format
# use Axis.DATETIME to show date
bottom_axis = LiveAxis("bottom", **{Axis.TICK_FORMAT: Axis.TIME})
# Create plot itself. Skip this if using promoted widget
self.Solar_graph_Widget = LivePlotWidget(title="Solar Watts 24 Hrs", axisItems={'bottom': bottom_axis})
# Show grid
self.Solar_graph_Widget.showGrid(x=True, y=True, alpha=0.3)
# Set labels
#self.Solar_graph_Widget.setLabel('bottom', 'Datetime', units='*')
self.Solar_graph_Widget.setLabel('left', 'Watts')
# Add Line
self.Solar_graph_Widget.addItem(watts_plot)
# Add chart to Empty Layout made in Qt Designer. # skip this if using promoted widget
self.Chart_Watts_Layout.addWidget(self.Solar_graph_Widget)
# Place in the update function
timestamp = time.time()
self.watts_connector.cb_append_data_point(SolarWatts, timestamp)
from pglive.
I see. I always use pyuic converter to produce .py files from templates. But it's a matter of preference.
Adding widgets programmatically is much more convenient. Using Frames or Layouts with Designer as a placeholder for widgets is usually the best approach and easier to implement than promoting widgets.
Regarding Your other questions:
Number of points displayed depends on multiple factors. I think the safe bet would be to always set maximum displayed points per plot (as You already does). Try to set some limit which makes sense, usually big number of values are anyway hard to read by the user.
More limiting factor is update rate. With more parallel plots You should decrease update freq, 100Hz should be Your max.
In Your example code Your update rate is 1Hz which should be handled without issues.
Accumulated points are stored in deque. So if You set max_points=86400
, this will create two deques for x and y. When max points is reached, first point is then discarded from the deque. So it's safe to run it for extended period of time.
As things are working for You now, I will merge it and close this issue.
Feel free to suggest another improvements and good luck with Your project :).
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
- Custom ViewBox HOT 4
- 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.