mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Add x axis field combobox to chart editor
This commit is contained in:
parent
7a4b3646e3
commit
2452e37334
@ -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);
|
||||
}
|
||||
|
@ -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;i<ds->columnCount();++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<LimeReport::SeriesItem::SeriesItemPreferredType>(enumerator.keysToValue(arg1.toLatin1())));
|
||||
}
|
||||
}
|
||||
|
||||
void ChartItemEditor::on_xAxisFieldComboBox_currentTextChanged(const QString &arg1)
|
||||
{
|
||||
if (!m_initing)
|
||||
m_charItem->setXAxisField(arg1);
|
||||
}
|
@ -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();
|
||||
|
@ -144,16 +144,30 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="labelsFieldComboBox">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelsFieldLabel">
|
||||
<property name="text">
|
||||
<string>Labels field</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="labelsFieldComboBox">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="xAxisFieldLabel">
|
||||
<property name="text">
|
||||
<string>X data field</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="xAxisFieldComboBox">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user