mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Fix compilation
This commit is contained in:
parent
a3ffc08d49
commit
b0f45f55a4
@ -81,8 +81,9 @@ qreal LinesChart::calculatePos(const AxisData &data, qreal value, qreal rectSize
|
||||
void LinesChart::paintSeries(QPainter *painter, SeriesItem *series, QRectF barsRect)
|
||||
{
|
||||
const AxisData &yAxisData = this->yAxisData();
|
||||
const AxisData &xAxisData = this->xAxisData();
|
||||
|
||||
const qreal xAxisDiff = std::max(1.0, maxXValue() - minXValue());
|
||||
const qreal xAxisDiff = std::max(1.0, xAxisData.maxValue() - xAxisData.minValue());
|
||||
const qreal hStep = barsRect.width() / xAxisDiff;
|
||||
const qreal topMargin = barsRect.top();
|
||||
|
||||
|
@ -143,7 +143,7 @@ ChartItem::ChartItem(QObject *owner, QGraphicsItem *parent)
|
||||
m_legendAlign(LegendAlignCenter), m_titleAlign(TitleAlignCenter),
|
||||
m_chartType(Pie), m_labelsField(""), m_isEmpty(true),
|
||||
m_showLegend(true), m_drawPoints(true), m_seriesLineWidth(4),
|
||||
m_horizontalAxisOnTop(false), m_legendStyle(LegendPoints)
|
||||
m_horizontalAxisOnTop(false)
|
||||
{
|
||||
m_labels<<"First"<<"Second"<<"Thrid";
|
||||
m_chart = new PieChart(this);
|
||||
@ -589,11 +589,11 @@ qreal AbstractSeriesChart::minValue()
|
||||
AxisData AbstractSeriesChart::yAxisData()
|
||||
{
|
||||
return m_yAxisData;
|
||||
qreal AbstractSeriesChart::minXValue()
|
||||
{
|
||||
return m_chartItem->xAxisData()->minValue();
|
||||
}
|
||||
|
||||
AxisData AbstractSeriesChart::xAxisData()
|
||||
{
|
||||
return m_xAxisData;
|
||||
}
|
||||
|
||||
void AbstractSeriesChart::updateMinAndMaxValues()
|
||||
@ -612,11 +612,8 @@ void AbstractSeriesChart::updateMinAndMaxValues()
|
||||
maxYValue = std::max(maxYValue, value);
|
||||
}
|
||||
if (series->data()->xAxisValues().isEmpty()) {
|
||||
// Grid plot starts from 0 on x axis so x range must be decresed by 1
|
||||
const bool startingFromZero = m_chartItem->chartType() == ChartItem::GridLines;
|
||||
const qreal valuesCount = this->valuesCount() - (startingFromZero ? 1 : 0);
|
||||
minXValue = std::min(0.0, minXValue);
|
||||
maxXValue = std::max(valuesCount, maxXValue);
|
||||
maxXValue = std::max((qreal)valuesCount(), maxXValue);
|
||||
} else {
|
||||
for (qreal value : series->data()->xAxisValues()){
|
||||
minXValue = std::min(value, minXValue);
|
||||
@ -627,6 +624,8 @@ void AbstractSeriesChart::updateMinAndMaxValues()
|
||||
}
|
||||
|
||||
m_yAxisData = AxisData(minYValue, maxYValue);
|
||||
m_xAxisData = AxisData(minXValue, maxXValue);
|
||||
m_xAxisData.setReverseDirection(true);
|
||||
}
|
||||
|
||||
qreal AbstractSeriesChart::hPadding(QRectF chartRect)
|
||||
|
@ -89,10 +89,10 @@ class AbstractSeriesChart: public AbstractChart{
|
||||
public:
|
||||
AbstractSeriesChart(ChartItem* chartItem);
|
||||
protected:
|
||||
AxisData yAxisData();
|
||||
AxisData xAxisData();
|
||||
qreal maxValue();
|
||||
qreal minValue();
|
||||
qreal maxXValue();
|
||||
qreal minXValue();
|
||||
void updateMinAndMaxValues();
|
||||
int valuesCount();
|
||||
int seriesCount();
|
||||
@ -113,7 +113,7 @@ protected:
|
||||
virtual QString verticalLabel(int i, qreal step, qreal min);
|
||||
|
||||
private:
|
||||
AxisData m_yAxisData;
|
||||
AxisData m_yAxisData, m_xAxisData;
|
||||
qreal m_designValues [9];
|
||||
};
|
||||
|
||||
|
@ -53,6 +53,16 @@ qreal AxisData::delta() const
|
||||
return m_delta;
|
||||
}
|
||||
|
||||
bool AxisData::reverseDirection() const
|
||||
{
|
||||
return m_reverseDirection;
|
||||
}
|
||||
|
||||
void AxisData::setReverseDirection(bool reverseDirection)
|
||||
{
|
||||
m_reverseDirection = reverseDirection;
|
||||
}
|
||||
|
||||
void AxisData::calculateValuesAboveMax(qreal minValue, qreal maxValue, int segments)
|
||||
{
|
||||
const int delta = maxValue - minValue;
|
||||
|
@ -20,9 +20,12 @@ public:
|
||||
qreal step() const;
|
||||
|
||||
qreal delta() const;
|
||||
|
||||
bool reverseDirection() const;
|
||||
void setReverseDirection(bool reverseDirection);
|
||||
|
||||
private:
|
||||
void calculateValuesAboveMax(qreal minValue, qreal maxValue, int segments);
|
||||
qreal calculateNiceNum(qreal range, bool round);
|
||||
|
||||
qreal m_rangeMin;
|
||||
qreal m_rangeMax;
|
||||
@ -31,6 +34,7 @@ private:
|
||||
qreal m_step;
|
||||
qreal m_delta;
|
||||
int m_segmentCount;
|
||||
bool m_reverseDirection;
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user