qtcharts

QML crash in Qt 5.9 - help to read stack trace

心已入冬 提交于 2020-07-15 08:17:22
问题 I am writing an app using Qt 5.9 with C++ main and QML UI on the top. Everything fine (including sending signals from C++ to QML) but when I add ChartView to the UI, I am seeing a crash. The stripped-down version of the ChartView looks like the following; when I omit it from the code, no crash. ChartView { id: _chartView LineSeries { name: "avgZ" XYPoint { x: 0; y: 0} } } This is the stack trace (via excellent backward-cpp): Stack trace (most recent call last): #27 Object "", at

How not to display all x axis coordinate labels pyqt5

最后都变了- 提交于 2020-06-23 14:20:24
问题 From time to time I returned to the code that eyllanesc helped me with. Need to display every 6 placemarks on the axis. It would also be better to display datetime( date ) [datetime.date(1991, 2, 4) datetime.date(1991, 2, 5) datetime.date(1991, 2, 6) ... datetime.date(2019, 7, 31) datetime.date(2019, 8, 1) datetime.date(2019, 8, 2)] instead of indexes (0, 1, 2, 3....70) When displaying datetime data in C#, I used string data, since on weekends datetime was also displayed and empty spaces on

How not to display all x axis coordinate labels pyqt5

三世轮回 提交于 2020-06-23 14:20:08
问题 From time to time I returned to the code that eyllanesc helped me with. Need to display every 6 placemarks on the axis. It would also be better to display datetime( date ) [datetime.date(1991, 2, 4) datetime.date(1991, 2, 5) datetime.date(1991, 2, 6) ... datetime.date(2019, 7, 31) datetime.date(2019, 8, 1) datetime.date(2019, 8, 2)] instead of indexes (0, 1, 2, 3....70) When displaying datetime data in C#, I used string data, since on weekends datetime was also displayed and empty spaces on

Show percentage in Qt Pie Charts?

大城市里の小女人 提交于 2020-06-08 13:50:49
问题 How to show percentage in Qt Pie charts on chart like this? 回答1: To do this task you have to enable to make the labels visible and place the position as LabelInsideHorizontal, in the following code the solution is shown. series->setLabelsVisible(); series->setLabelsPosition(QPieSlice::LabelInsideHorizontal); for(auto slice : series->slices()) slice->setLabel(QString("%1%").arg(100*slice->percentage(), 0, 'f', 1)); PyQt5: import sys from PyQt5 import QtCore, QtGui, QtWidgets, QtChart if __name

Can't include <QtCharts/QLineSeries>

天涯浪子 提交于 2020-05-08 04:12:30
问题 It seems I can't find a way to include <QtCharts/QLineSeries> in my header so Qt knows about the QLineSeries class. I added Qt += charts to my .pro file. I added #include <QtCharts/QLineSeries> to MainWindow.h Then I delete .pro.user file and any builds I've done. And then reopen the .pro file to reconfigure the project in the cleanest way. Finally I set the build mode to Release , run QMake by right-clicking the project and selecting it and Run it. I get the message: ...\PlottingCharts

Can't include <QtCharts/QLineSeries>

落爺英雄遲暮 提交于 2020-05-08 04:12:26
问题 It seems I can't find a way to include <QtCharts/QLineSeries> in my header so Qt knows about the QLineSeries class. I added Qt += charts to my .pro file. I added #include <QtCharts/QLineSeries> to MainWindow.h Then I delete .pro.user file and any builds I've done. And then reopen the .pro file to reconfigure the project in the cleanest way. Finally I set the build mode to Release , run QMake by right-clicking the project and selecting it and Run it. I get the message: ...\PlottingCharts

Attach colors of my choosing to each slice of QPieSeries

有些话、适合烂在心里 提交于 2019-12-12 21:00:44
问题 I want to make each slice of a pie chart a color of my choosing. I need to know the snytax of QPieSlice (if that is what I use) and how to attach a color to a particular slice of the pie. For example, I want the "Auto" slice to be '#00FF00', the "Employment" slice to be '#1A8CFF", etc. Below are the pieces of my pie. I have tried various things like: QPieSlice.setBrush(QPieSlice.setColor(QColor('#00FF00'))) but it does not work, and even if it did, I do not know how to attach it to a

How to set zoom origin for a QML Chart View

痴心易碎 提交于 2019-12-11 08:37:17
问题 I am developing a data presentation application using QT QML with QTCharts. I am using a ChartView and a line series to show XY data. Everything works apart from pinching and zooming the graph. The application is targeting mobile touch device. I want to be able to pinch and zoom the graph and set the zoom origin to the center of the pinch. Currently, I have it working but the graph only zooms from the center of the graph at all times. Is this possible in QML? Thanks for any help. 回答1: The

QChartView, RubberBand and right mouse button behaviour

拟墨画扇 提交于 2019-12-11 02:00:39
问题 I have class, derived from QChartView , and I have enabled rubber band selection in it MyChartView::MyChartView(QChart* chart) :QChartView(chart) { setMouseTracking(true); setInteractive(true); setRubberBand(RectangleRubberBand); } Qt documentation says that If left mouse button is released and the rubber band is enabled then event is accepted and the view is zoomed into the rect specified by the rubber band. If it is a right mouse button event then the view is zoomed out. I don't want to

How to make only one point label visible for QLineSeries/QXYSeries

╄→尐↘猪︶ㄣ 提交于 2019-12-08 09:45:52
问题 I am using the qtcharts module of qt. I am using c++ but it does not matter if the solution comes for another language (I will translate it afterwards). Problem: I plot a bunch of QLineSeries in a QChart and I want to display the point labels only when hovering them. I planned to use the signal QXYSeries::hovered() to detect when the mouse moves over a point (the same when the mouse moves away the point). I know that there exists a member function QXYSeries::setPointLabelsVisible() but it