[PyQt] PyQt Chart Documentation
Nick
napperley at gmail.com
Thu Aug 25 10:17:39 BST 2016
Thanks! Realised that there was an extra "s" that needed to be removed at
the end of the import. Got the Bar chart example working based on the one
in the Qt C++ documentation
<http://doc.qt.io/qt-5/qtcharts-barchart-example.html>. However the axis
legend doesn't appear. Below is the function that creates the QChart which
is used in the QChartView:
===================================================
def create_bar_chart(self):
set0 = QBarSet('Jane')
set1 = QBarSet('John')
series = QBarSeries()
chart = QChart()
axis = QBarCategoryAxis()
categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
set0.append([1, 2, 3, 4, 5, 6])
set1.append([5, 0, 0, 4, 0, 7])
series.append(set0)
series.append(set1)
chart.addSeries(series)
axis.append(categories)
chart.setTitle('Simple barchart example')
chart.createDefaultAxes()
chart.setAxisX(axis, series)
chart.legend().setAlignment(Qt.AlignBottom)
return chart
===================================================
On Thu, 25 Aug 2016 at 19:37 Phil Thompson <phil at riverbankcomputing.com>
wrote:
> On 25 Aug 2016, at 12:02 am, Nick <napperley at gmail.com> wrote:
> >
> > Been trying to find documentation on PyQt Chart (for PyQt 5.7) but it
> doesn't exist. There is mention of PyQt Chart examples but they don't
> appear to exist anywhere. What is the name of the PyQt Chart module? Tried
> to import PyQt Chart but to no avail.
> >
> > In need of a good PyQt Chart example for displaying a basic Bar chart
> (including the import line for PyQt Chart).
>
> The examples are in the source package. The module name is PyQt5.QtChart.
>
> Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160825/0d33e167/attachment.html>
More information about the PyQt
mailing list