##// END OF EJS Templates
Adaptive layout to legend. Tries to fit all items inside given maximum size
Adaptive layout to legend. Tries to fit all items inside given maximum size

File last commit:

r622:960bcf5125b7
r626:b05202e4f2ef
Show More
linechartitem.cpp
83 lines | 1.7 KiB | text/x-c | CppLexer
Michal Klocek
Fix naming convention for lineseries...
r144 #include "linechartitem_p.h"
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 #include "qlineseries.h"
Michal Klocek
Refactors qchart , adds line animation...
r131 #include "chartpresenter_p.h"
Michal Klocek
Refactor current draft to fit int current design specs...
r21 #include <QPainter>
Michal Klocek
Fix naming convention for lineseries...
r144
Michal Klocek
Refactor current draft to fit int current design specs...
r21
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
Michal Klocek
Refactor current draft to fit int current design specs...
r21
Michal Klocek
Fix commit 7b90ec69ce9a3353820d295c222ef3f79537484d
r391 //TODO: optimize : remove points which are not visible
Michal Klocek
Adds cliping and proper zoom handling for line chart
r150
Michal Klocek
Refactor line spline to common xyline...
r465 LineChartItem::LineChartItem(QLineSeries* series,QGraphicsItem *parent):XYChartItem(series,parent),
Michal Klocek
Fix commit 7b90ec69ce9a3353820d295c222ef3f79537484d
r391 m_series(series),
Michal Klocek
Adds clicked(Point) to lineSeries, changes visible points handling
r544 m_pointsVisible(false)
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
Michal Klocek
Adds ZOrder enum to presenter
r262 setZValue(ChartPresenter::LineChartZValue);
Michal Klocek
Adds area chart...
r421 QObject::connect(series,SIGNAL(updated()),this,SLOT(handleUpdated()));
Michal Klocek
Refactor domain model...
r439 handleUpdated();
Michal Klocek
Refactor current draft to fit int current design specs...
r21 }
Michal Klocek
Fix naming convention for lineseries...
r144 QRectF LineChartItem::boundingRect() const
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103 {
Michal Klocek
Refactors qchart , adds line animation...
r131 return m_rect;
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103 }
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85
Michal Klocek
Fix naming convention for lineseries...
r144 QPainterPath LineChartItem::shape() const
Michal Klocek
Add zoom support...
r67 {
Michal Klocek
Refactors qchart , adds line animation...
r131 return m_path;
}
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85
Michal Klocek
Unify naming setGeometry -> setLayout
r557 void LineChartItem::setLayout(QVector<QPointF>& points)
Michal Klocek
Refactors qchart , adds line animation...
r131 {
Marek Rosa
Added support for adding and removing data with model. Updated the example
r545 if(points.size()==0)
{
Michal Klocek
Unify naming setGeometry -> setLayout
r557 XYChartItem::setLayout(points);
Marek Rosa
Added support for adding and removing data with model. Updated the example
r545 return;
}
Michal Klocek
Refactors linechart update calls
r464
Michal Klocek
Refactor line spline to common xyline...
r465 QList<QGraphicsItem*> items = m_items.childItems();
Michal Klocek
Refactors linechart update calls
r464
Michal Klocek
Adds clicked(Point) to lineSeries, changes visible points handling
r544 QPainterPath linePath(points.at(0));
Michal Klocek
Refactors linechart update calls
r464
Michal Klocek
Refactor line spline to common xyline...
r465 for(int i=1; i< points.size();i++) {
Michal Klocek
Adds clicked(Point) to lineSeries, changes visible points handling
r544 linePath.lineTo(points.at(i));
Michal Klocek
Refactor line spline to common xyline...
r465 }
Michal Klocek
Refactors linechart update calls
r464
Michal Klocek
Refactor line spline to common xyline...
r465 prepareGeometryChange();
Michal Klocek
Adds clicked(Point) to lineSeries, changes visible points handling
r544 m_path = linePath;
m_rect = linePath.boundingRect();
Michal Klocek
Refactors qchart , adds line animation...
r131
Michal Klocek
Unify naming setGeometry -> setLayout
r557 XYChartItem::setLayout(points);
Michal Klocek
Improves spline interpolation...
r622
Michal Klocek
Refactor current draft to fit int current design specs...
r21 }
Michal Klocek
Adds updated handling for line series
r392 void LineChartItem::handleUpdated()
Michal Klocek
Rewrite animation hadnling in line series...
r389 {
Michal Klocek
Adds clicked(Point) to lineSeries, changes visible points handling
r544 m_pointsVisible = m_series->pointsVisible();
m_linePen = m_series->pen();
m_pointPen = m_series->pen();
m_pointPen.setWidthF(2*m_pointPen.width());
Michal Klocek
Refactored for MVP...
r139 update();
}
Michal Klocek
Fix commit 7b90ec69ce9a3353820d295c222ef3f79537484d
r391 //painter
void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Tero Ahola
Squashed bunch of warnings
r611 Q_UNUSED(widget)
Q_UNUSED(option)
Michal Klocek
Fix commit 7b90ec69ce9a3353820d295c222ef3f79537484d
r391 painter->save();
Michal Klocek
Adds clicked(Point) to lineSeries, changes visible points handling
r544 painter->setPen(m_linePen);
Michal Klocek
Refactor line spline to common xyline...
r465 painter->setClipRect(clipRect());
Michal Klocek
Fix commit 7b90ec69ce9a3353820d295c222ef3f79537484d
r391 painter->drawPath(m_path);
Michal Klocek
Adds clicked(Point) to lineSeries, changes visible points handling
r544 if(m_pointsVisible){
painter->setPen(m_pointPen);
painter->drawPoints(points());
}
Michal Klocek
Fix commit 7b90ec69ce9a3353820d295c222ef3f79537484d
r391 painter->restore();
}
Michal Klocek
Fix naming convention for lineseries...
r144 #include "moc_linechartitem_p.cpp"
Michal Klocek
Refactors qchart , adds line animation...
r131
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_END_NAMESPACE