mirror of
				https://github.com/fralx/LimeReport.git
				synced 2025-10-27 20:04:55 +03:00 
			
		
		
		
	ChartItem has been fixed
This commit is contained in:
		| @@ -127,7 +127,7 @@ RCC_DIR        = $${ARCH_DIR}/$${BUILD_TYPE}/rcc | |||||||
|  |  | ||||||
| LIMEREPORT_VERSION_MAJOR = 1 | LIMEREPORT_VERSION_MAJOR = 1 | ||||||
| LIMEREPORT_VERSION_MINOR = 5 | LIMEREPORT_VERSION_MINOR = 5 | ||||||
| LIMEREPORT_VERSION_RELEASE = 24 | LIMEREPORT_VERSION_RELEASE = 25 | ||||||
|  |  | ||||||
| LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' | LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' | ||||||
| DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" | DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" | ||||||
|   | |||||||
| @@ -85,6 +85,8 @@ SeriesItem *SeriesItem::clone() | |||||||
|  |  | ||||||
| void SeriesItem::fillSeriesData(IDataSource *dataSource) | void SeriesItem::fillSeriesData(IDataSource *dataSource) | ||||||
| { | { | ||||||
|  |     m_data.clear(); | ||||||
|  |  | ||||||
|     if (dataSource){ |     if (dataSource){ | ||||||
|         dataSource->first(); |         dataSource->first(); | ||||||
|         int currentColorIndex = 0; |         int currentColorIndex = 0; | ||||||
| @@ -724,7 +726,7 @@ void VerticalBarChart::paintVerticalBars(QPainter *painter, QRectF barsRect) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     barSeriesCount = (m_chartItem->itemMode()==DesignMode) ? seriesCount() : barSeriesCount; |     barSeriesCount = (m_chartItem->itemMode()==DesignMode) ? seriesCount() : barSeriesCount; | ||||||
|  |     if (barSeriesCount < 1) return; | ||||||
|     painter->save(); |     painter->save(); | ||||||
|     painter->setRenderHint(QPainter::Antialiasing,false); |     painter->setRenderHint(QPainter::Antialiasing,false); | ||||||
|  |  | ||||||
| @@ -770,7 +772,7 @@ void VerticalBarChart::paintSerialLines(QPainter* painter, QRectF barsRect) | |||||||
|     qreal hStep = (barsRect.width() / valuesCount()); |     qreal hStep = (barsRect.width() / valuesCount()); | ||||||
|     qreal topShift = (delta - (maxValue()-minValue())) * vStep +barsRect.top(); |     qreal topShift = (delta - (maxValue()-minValue())) * vStep +barsRect.top(); | ||||||
|  |  | ||||||
|     if (!m_chartItem->series().isEmpty() && !m_chartItem->series().at(0)->data()->labels().isEmpty()){ |     if (!m_chartItem->series().isEmpty()){ | ||||||
|         foreach (SeriesItem* series, m_chartItem->series()) { |         foreach (SeriesItem* series, m_chartItem->series()) { | ||||||
|             if (series->preferredType() == SeriesItem::Line){ |             if (series->preferredType() == SeriesItem::Line){ | ||||||
|                 QPen pen(series->color()); |                 QPen pen(series->color()); | ||||||
| @@ -859,7 +861,7 @@ qreal AbstractSeriesChart::minValue() | |||||||
| int AbstractSeriesChart::valuesCount() | int AbstractSeriesChart::valuesCount() | ||||||
| { | { | ||||||
|     if (m_chartItem->itemMode()==DesignMode) return 3; |     if (m_chartItem->itemMode()==DesignMode) return 3; | ||||||
|     return (m_chartItem->series().isEmpty())?(0):(m_chartItem->series().at(0)->data()->labels().count()); |     return (m_chartItem->series().isEmpty())?(0):(m_chartItem->series().at(0)->data()->values().count()); | ||||||
| } | } | ||||||
|  |  | ||||||
| int AbstractSeriesChart::seriesCount() | int AbstractSeriesChart::seriesCount() | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ public: | |||||||
|     QList<qreal>& values(){ return m_values;} |     QList<qreal>& values(){ return m_values;} | ||||||
|     QList<QString>& labels(){ return m_labels;} |     QList<QString>& labels(){ return m_labels;} | ||||||
|     QList<QColor>& colors() { return m_colors;} |     QList<QColor>& colors() { return m_colors;} | ||||||
|  |     void clear(){ m_values.clear(); m_labels.clear(); m_colors.clear(); } | ||||||
| private: | private: | ||||||
|     QList<qreal> m_values; |     QList<qreal> m_values; | ||||||
|     QList<QString> m_labels; |     QList<QString> m_labels; | ||||||
| @@ -189,7 +190,7 @@ protected: | |||||||
|     void paintChartTitle(QPainter* painter, QRectF titleRect); |     void paintChartTitle(QPainter* painter, QRectF titleRect); | ||||||
|     virtual BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent); |     virtual BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent); | ||||||
|     //ICollectionContainer |     //ICollectionContainer | ||||||
|     QObject* createElement(const QString& collectionName,const QString& elementType); |     QObject* createElement(const QString& collectionName, const QString& elementType); | ||||||
|     int elementsCount(const QString& collectionName); |     int elementsCount(const QString& collectionName); | ||||||
|     QObject* elementAt(const QString& collectionName,int index); |     QObject* elementAt(const QString& collectionName,int index); | ||||||
|     void collectionLoadFinished(const QString& collectionName){Q_UNUSED(collectionName)}     |     void collectionLoadFinished(const QString& collectionName){Q_UNUSED(collectionName)}     | ||||||
| @@ -199,7 +200,6 @@ protected: | |||||||
|     bool isNeedUpdateSize(RenderPass pass) const; |     bool isNeedUpdateSize(RenderPass pass) const; | ||||||
| private: | private: | ||||||
|     QList<SeriesItem*> m_series; |     QList<SeriesItem*> m_series; | ||||||
| //    QList< QPointer<SeriesItem> > m_series; |  | ||||||
|     QString m_datasource; |     QString m_datasource; | ||||||
|     QPixmap m_chartImage; |     QPixmap m_chartImage; | ||||||
|     QString m_title; |     QString m_title; | ||||||
|   | |||||||
| @@ -1183,7 +1183,7 @@ void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){ | |||||||
| void ReportRender::secondRenderPass(ReportPages renderedPages) | void ReportRender::secondRenderPass(ReportPages renderedPages) | ||||||
| { | { | ||||||
|     if (!m_scriptEngineContext->tableOfContents()->isEmpty()){ |     if (!m_scriptEngineContext->tableOfContents()->isEmpty()){ | ||||||
|         for(int i=0; i<renderedPages.count(); ++i){ |         for(int i = 0; i < renderedPages.count(); ++i){ | ||||||
|             PageItemDesignIntf::Ptr page = renderedPages.at(i); |             PageItemDesignIntf::Ptr page = renderedPages.at(i); | ||||||
|             updateTOC(page.data(), m_pagesRanges.findPageNumber(i)); |             updateTOC(page.data(), m_pagesRanges.findPageNumber(i)); | ||||||
|             foreach(BaseDesignIntf* item, page->childBaseItems()){ |             foreach(BaseDesignIntf* item, page->childBaseItems()){ | ||||||
| @@ -1192,12 +1192,13 @@ void ReportRender::secondRenderPass(ReportPages renderedPages) | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     for(int i=0; i<renderedPages.count(); ++i){ |     for(int i = 0; i < renderedPages.count(); ++i){ | ||||||
|         PageItemDesignIntf::Ptr page = renderedPages.at(i); |         PageItemDesignIntf::Ptr page = renderedPages.at(i); | ||||||
|         m_datasources->setReportVariable("#PAGE",m_pagesRanges.findPageNumber(i)); |         m_datasources->setReportVariable("#PAGE",m_pagesRanges.findPageNumber(i)); | ||||||
|         m_datasources->setReportVariable("#PAGE_COUNT",m_pagesRanges.findLastPageNumber(i)); |         m_datasources->setReportVariable("#PAGE_COUNT",m_pagesRanges.findLastPageNumber(i)); | ||||||
|         foreach(BaseDesignIntf* item, page->childBaseItems()){ |         foreach(BaseDesignIntf* item, page->childBaseItems()){ | ||||||
|             item->updateItemSize(m_datasources, SecondPass); |             if (item->isNeedUpdateSize(SecondPass)) | ||||||
|  |                 item->updateItemSize(m_datasources, SecondPass); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user