diff --git a/limereport/items/lrchartitem.cpp b/limereport/items/lrchartitem.cpp index 3dbeafa..2bec388 100644 --- a/limereport/items/lrchartitem.cpp +++ b/limereport/items/lrchartitem.cpp @@ -971,13 +971,7 @@ QString AbstractSeriesChart::axisLabel(int i, const AxisData &axisData) { const qreal min = axisData.rangeMin(); const qreal step = axisData.step(); - qreal value = 0; - // For values below 0, axis is already reversed (value closer to 0 is higher) - if (axisData.reverseDirection() && min >= 0) { - value = min + (axisData.segmentCount() - i) * step; - } else { - value = min + i * step; - } + qreal value = min + i * step; if (std::floor(step) == step) { return QString::number(value); } diff --git a/limereport/items/lrchartitemeditor.cpp b/limereport/items/lrchartitemeditor.cpp index e51ed22..c609c46 100644 --- a/limereport/items/lrchartitemeditor.cpp +++ b/limereport/items/lrchartitemeditor.cpp @@ -23,8 +23,6 @@ ChartItemEditor::ChartItemEditor(LimeReport::ChartItem *item, LimeReport::PageDe readSetting(); init(); connect(m_colorButton, SIGNAL(clicked(bool)), this, SLOT(slotChangeSeriesColor())); - - // TODO_ES add field in editor for x axis field, like for labels } ChartItemEditor::~ChartItemEditor() @@ -108,6 +106,7 @@ void ChartItemEditor::init() for (int i=0;icolumnCount();++i){ ui->valuesFieldComboBox->addItem(ds->columnNameByIndex(i)); ui->labelsFieldComboBox->addItem(ds->columnNameByIndex(i)); + ui->xAxisFieldComboBox->addItem(ds->columnNameByIndex(i)); } } } @@ -122,8 +121,10 @@ void ChartItemEditor::init() #if QT_VERSION < 0x050000 ui->labelsFieldComboBox->setCurrentIndex(ui->labelsFieldComboBox->findText( m_charItem->labelsField())); + ui->xAxisFieldComboBox->setCurrentIndex(ui->xAxisFieldComboBox->findText( m_charItem->xAxisField())); #else ui->labelsFieldComboBox->setCurrentText(m_charItem->labelsField()); + ui->xAxisFieldComboBox->setCurrentText(m_charItem->xAxisField()); #endif if (!m_charItem->series().isEmpty()){ enableSeriesEditor(); @@ -289,3 +290,9 @@ void ChartItemEditor::on_seriesTypeComboBox_currentIndexChanged(const QString &a currentSeries()->setPreferredType(static_cast(enumerator.keysToValue(arg1.toLatin1()))); } } + +void ChartItemEditor::on_xAxisFieldComboBox_currentTextChanged(const QString &arg1) +{ + if (!m_initing) + m_charItem->setXAxisField(arg1); +} \ No newline at end of file diff --git a/limereport/items/lrchartitemeditor.h b/limereport/items/lrchartitemeditor.h index f24123f..64e0549 100644 --- a/limereport/items/lrchartitemeditor.h +++ b/limereport/items/lrchartitemeditor.h @@ -41,6 +41,8 @@ private slots: void slotChangeSeriesColor(); void on_seriesTypeComboBox_currentIndexChanged(const QString &arg1); + void on_xAxisFieldComboBox_currentTextChanged(const QString &arg1); + private: void readSetting(); void writeSetting(); diff --git a/limereport/items/lrchartitemeditor.ui b/limereport/items/lrchartitemeditor.ui index a745777..20a5f4b 100644 --- a/limereport/items/lrchartitemeditor.ui +++ b/limereport/items/lrchartitemeditor.ui @@ -144,16 +144,30 @@ - - + + + + + true + + + + Labels field - - + + + + X data field + + + + + true