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