[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] PyQt Chart Documentation
From: Nick <napperley () gmail ! com>
Date: 2016-08-25 10:34:16
Message-ID: CAG_o7uOffuL7rO3=B3vFBMzr_s38dknRJNE3hMhN16c3nvcWdg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Did the trick, thanks.
On Thu, 25 Aug 2016 at 22:25 Phil Thompson <phil@riverbankcomputing.com>
wrote:
>
> > On 25 Aug 2016, at 10:17 am, Nick <napperley@gmail.com> wrote:
> >
> > 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. 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
> > ===================================================
>
> It's an ownership bug in PyQtChart. To work around do...
>
> axis = QBarCategoryAxis(chart)
>
> Phil
[Attachment #5 (text/html)]
<div dir="ltr">Did the trick, thanks.</div><br><div class="gmail_quote"><div \
dir="ltr">On Thu, 25 Aug 2016 at 22:25 Phil Thompson <<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"><br> > On 25 Aug 2016, at 10:17 \
am, Nick <<a href="mailto:napperley@gmail.com" \
target="_blank">napperley@gmail.com</a>> wrote:<br> ><br>
> 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. However the axis legend doesn't appear. Below is the \
function that creates the QChart which is used in the QChartView:<br> ><br>
> ===================================================<br>
> def create_bar_chart(self):<br>
> set0 = QBarSet('Jane')<br>
> set1 = QBarSet('John')<br>
> series = QBarSeries()<br>
> chart = QChart()<br>
> axis = QBarCategoryAxis()<br>
> categories = ['Jan', 'Feb', 'Mar', \
'Apr', 'May', 'Jun']<br> ><br>
> set0.append([1, 2, 3, 4, 5, 6])<br>
> set1.append([5, 0, 0, 4, 0, 7])<br>
> series.append(set0)<br>
> series.append(set1)<br>
> chart.addSeries(series)<br>
> axis.append(categories)<br>
><br>
> chart.setTitle('Simple barchart example')<br>
> chart.createDefaultAxes()<br>
> chart.setAxisX(axis, series)<br>
> chart.legend().setAlignment(Qt.AlignBottom)<br>
> return chart<br>
> ===================================================<br>
<br>
It's an ownership bug in PyQtChart. To work around do...<br>
<br>
axis = QBarCategoryAxis(chart)<br>
<br>
Phil</blockquote></div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic