ChartItem has been fixed

This commit is contained in:
Alexander Arin 2019-12-18 23:13:33 +03:00
parent 824419eb5d
commit 8328e0146b
4 changed files with 12 additions and 9 deletions

View File

@ -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}\\\"

View File

@ -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()

View File

@ -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;
@ -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;

View File

@ -1197,6 +1197,7 @@ void ReportRender::secondRenderPass(ReportPages renderedPages)
m_datasources->setReportVariable("#PAGE",m_pagesRanges.findPageNumber(i));
m_datasources->setReportVariable("#PAGE_COUNT",m_pagesRanges.findLastPageNumber(i));
foreach(BaseDesignIntf* item, page->childBaseItems()){
if (item->isNeedUpdateSize(SecondPass))
item->updateItemSize(m_datasources, SecondPass);
}
}