mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Fix default values in axis property editor
This commit is contained in:
parent
f684acd53b
commit
55c5e577fb
@ -71,8 +71,6 @@ void VerticalBarChart::paintVerticalBars(QPainter *painter, QRectF barsRect)
|
||||
qreal hStep = (barsRect.width() / valuesCount()) / (barSeriesCount == 0 ? 1 : barSeriesCount);
|
||||
qreal topShift = (delta - (maxValue() - minValue())) * vStep + barsRect.top();
|
||||
|
||||
qDebug() << "vStep" << vStep << "hStep" << hStep;
|
||||
|
||||
if (!m_chartItem->series().isEmpty() && (m_chartItem->itemMode() != DesignMode)){
|
||||
int curSeries = 0;
|
||||
foreach (SeriesItem* series, m_chartItem->series()) {
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "ui_lrchartaxiseditor.h"
|
||||
#include "lraxisdata.h"
|
||||
|
||||
#include "lrbasedesignintf.h"
|
||||
|
||||
ChartAxisEditor::ChartAxisEditor(LimeReport::ChartItem *item, LimeReport::PageDesignIntf *page, bool isXAxis, QSettings *settings, QWidget *parent):
|
||||
QWidget(parent), ui(new Ui::ChartAxisEditor), m_chartItem(item), m_page(page),
|
||||
m_settings(settings), m_isXAxis(isXAxis)
|
||||
@ -59,9 +61,9 @@ void ChartAxisEditor::init()
|
||||
|
||||
LimeReport::AxisData *axisData = m_isXAxis ? m_chartItem->xAxisData() : m_chartItem->yAxisData();
|
||||
|
||||
ui->minimumSpinBox->setValue(axisData->rangeMin());
|
||||
ui->maximumSpinBox->setValue(axisData->rangeMax());
|
||||
ui->stepSpinBox->setValue(axisData->step());
|
||||
ui->minimumSpinBox->setValue(axisData->manualMinimum());
|
||||
ui->maximumSpinBox->setValue(axisData->manualMaximum());
|
||||
ui->stepSpinBox->setValue(axisData->manualStep());
|
||||
|
||||
ui->minimumCheckBox->setChecked(axisData->isMinimumAutomatic());
|
||||
ui->maximumCheckBox->setChecked(axisData->isMaximumAutomatic());
|
||||
@ -108,7 +110,11 @@ void ChartAxisEditor::on_pushButtonOk_clicked()
|
||||
|
||||
axisData->setCalculateAxisScale(ui->enableScaleCalculation_checkbox->isChecked());
|
||||
|
||||
axisData->update();
|
||||
if (m_chartItem->itemMode() == LimeReport::DesignMode) {
|
||||
axisData->updateForDesignMode();
|
||||
} else {
|
||||
axisData->update();
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,17 @@ void AxisData::update()
|
||||
calculateSimpleAxisScale();
|
||||
}
|
||||
m_delta = m_step * m_segmentCount;
|
||||
|
||||
// Update manual values if they are automatic
|
||||
if (m_isStepAutomatic) {
|
||||
m_manualStep = m_step;
|
||||
}
|
||||
if (m_isMinimumAutomatic) {
|
||||
m_manualMinimum = m_rangeMin;
|
||||
}
|
||||
if (m_isMaximumAutomatic) {
|
||||
m_manualMaximum = m_rangeMax;
|
||||
}
|
||||
}
|
||||
|
||||
void AxisData::update(qreal minValue, qreal maxValue)
|
||||
|
@ -18,6 +18,7 @@ class AxisData : public QObject
|
||||
public:
|
||||
AxisData(QObject *parent = nullptr);
|
||||
|
||||
QString toString() const;
|
||||
void copy(AxisData *other);
|
||||
void update();
|
||||
void update(qreal minValue, qreal maxValue);
|
||||
|
Loading…
Reference in New Issue
Block a user