mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-25 04:54:40 +03:00
ChartItem has been fixed
This commit is contained in:
parent
2cbd1b14df
commit
ed8e1eccb4
@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
|||||||
|
|
||||||
LIMEREPORT_VERSION_MAJOR = 1
|
LIMEREPORT_VERSION_MAJOR = 1
|
||||||
LIMEREPORT_VERSION_MINOR = 5
|
LIMEREPORT_VERSION_MINOR = 5
|
||||||
LIMEREPORT_VERSION_RELEASE = 51
|
LIMEREPORT_VERSION_RELEASE = 53
|
||||||
|
|
||||||
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
||||||
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
||||||
|
@ -28,6 +28,8 @@ void HorizontalBarChart::paintChart(QPainter *painter, QRectF chartRect)
|
|||||||
|
|
||||||
void HorizontalBarChart::paintHorizontalBars(QPainter *painter, QRectF barsRect)
|
void HorizontalBarChart::paintHorizontalBars(QPainter *painter, QRectF barsRect)
|
||||||
{
|
{
|
||||||
|
if (seriesCount() == 0) return;
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setRenderHint(QPainter::Antialiasing,false);
|
painter->setRenderHint(QPainter::Antialiasing,false);
|
||||||
int delta = int(maxValue()-minValue());
|
int delta = int(maxValue()-minValue());
|
||||||
|
@ -65,6 +65,8 @@ void LinesChart::drawDesignMode(QPainter* painter, qreal hStep, qreal vStep, qre
|
|||||||
|
|
||||||
void LinesChart::paintSerialLines(QPainter* painter, QRectF barsRect)
|
void LinesChart::paintSerialLines(QPainter* painter, QRectF barsRect)
|
||||||
{
|
{
|
||||||
|
if (valuesCount() == 0) return;
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setRenderHint(QPainter::Antialiasing,true);
|
painter->setRenderHint(QPainter::Antialiasing,true);
|
||||||
int delta = int(maxValue() - minValue());
|
int delta = int(maxValue() - minValue());
|
||||||
|
@ -70,7 +70,7 @@ void PieChart::paintChart(QPainter *painter, QRectF chartRect)
|
|||||||
drawPercent(painter, chartRect, currentDegree, sectorDegree);
|
drawPercent(painter, chartRect, currentDegree, sectorDegree);
|
||||||
currentDegree += sectorDegree;
|
currentDegree += sectorDegree;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (m_chartItem->itemMode() == DesignMode){
|
||||||
painter->setBrush(color_map[0]);
|
painter->setBrush(color_map[0]);
|
||||||
painter->drawPie(chartRect,0,260*16);
|
painter->drawPie(chartRect,0,260*16);
|
||||||
drawPercent(painter, chartRect, 0, 260);
|
drawPercent(painter, chartRect, 0, 260);
|
||||||
@ -122,7 +122,7 @@ void PieChart::paintChartLegend(QPainter *painter, QRectF legendRect)
|
|||||||
);
|
);
|
||||||
cw += painter->fontMetrics().height();
|
cw += painter->fontMetrics().height();
|
||||||
}
|
}
|
||||||
} else {
|
} else if (m_chartItem->itemMode() == DesignMode){
|
||||||
qreal cw = 0;
|
qreal cw = 0;
|
||||||
for (int i=0;i<m_designLabels.size();++i){
|
for (int i=0;i<m_designLabels.size();++i){
|
||||||
QString label = m_designLabels.at(i);
|
QString label = m_designLabels.at(i);
|
||||||
|
@ -47,6 +47,8 @@ void VerticalBarChart::paintChart(QPainter *painter, QRectF chartRect)
|
|||||||
void VerticalBarChart::paintVerticalBars(QPainter *painter, QRectF barsRect)
|
void VerticalBarChart::paintVerticalBars(QPainter *painter, QRectF barsRect)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (valuesCount() == 0) return;
|
||||||
|
|
||||||
int delta = int(maxValue() - minValue());
|
int delta = int(maxValue() - minValue());
|
||||||
delta = genNextValue(delta);
|
delta = genNextValue(delta);
|
||||||
|
|
||||||
@ -64,6 +66,8 @@ void VerticalBarChart::paintVerticalBars(QPainter *painter, QRectF barsRect)
|
|||||||
qreal hStep = (barsRect.width() / valuesCount()) / (barSeriesCount == 0 ? 1 : barSeriesCount);
|
qreal hStep = (barsRect.width() / valuesCount()) / (barSeriesCount == 0 ? 1 : barSeriesCount);
|
||||||
qreal topShift = (delta - (maxValue() - minValue())) * vStep + barsRect.top();
|
qreal topShift = (delta - (maxValue() - minValue())) * vStep + barsRect.top();
|
||||||
|
|
||||||
|
qDebug() << "vStep" << vStep << "hStep" << hStep;
|
||||||
|
|
||||||
if (!m_chartItem->series().isEmpty() && (m_chartItem->itemMode() != DesignMode)){
|
if (!m_chartItem->series().isEmpty() && (m_chartItem->itemMode() != DesignMode)){
|
||||||
int curSeries = 0;
|
int curSeries = 0;
|
||||||
foreach (SeriesItem* series, m_chartItem->series()) {
|
foreach (SeriesItem* series, m_chartItem->series()) {
|
||||||
@ -93,6 +97,8 @@ void VerticalBarChart::paintVerticalBars(QPainter *painter, QRectF barsRect)
|
|||||||
|
|
||||||
void VerticalBarChart::paintSerialLines(QPainter* painter, QRectF barsRect)
|
void VerticalBarChart::paintSerialLines(QPainter* painter, QRectF barsRect)
|
||||||
{
|
{
|
||||||
|
if (valuesCount() == 0 ) return;
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setRenderHint(QPainter::Antialiasing,true);
|
painter->setRenderHint(QPainter::Antialiasing,true);
|
||||||
int delta = int(maxValue() - minValue());
|
int delta = int(maxValue() - minValue());
|
||||||
|
@ -584,7 +584,10 @@ QSizeF AbstractSeriesChart::calcChartLegendSize(const QFont &font)
|
|||||||
return QSizeF(maxWidth+fm.height()*2,cw);
|
return QSizeF(maxWidth+fm.height()*2,cw);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractSeriesChart::verticalLabels(QPainter* painter, QRectF labelsRect){
|
bool AbstractSeriesChart::verticalLabels(QPainter* painter, QRectF labelsRect)
|
||||||
|
{
|
||||||
|
if (valuesCount() == 0) return false;
|
||||||
|
|
||||||
qreal hStep = (labelsRect.width() / valuesCount());
|
qreal hStep = (labelsRect.width() / valuesCount());
|
||||||
QFontMetrics fm = painter->fontMetrics();
|
QFontMetrics fm = painter->fontMetrics();
|
||||||
foreach(QString label, m_chartItem->labels()){
|
foreach(QString label, m_chartItem->labels()){
|
||||||
@ -597,6 +600,8 @@ bool AbstractSeriesChart::verticalLabels(QPainter* painter, QRectF labelsRect){
|
|||||||
|
|
||||||
void AbstractSeriesChart::paintHorizontalLabels(QPainter *painter, QRectF labelsRect)
|
void AbstractSeriesChart::paintHorizontalLabels(QPainter *painter, QRectF labelsRect)
|
||||||
{
|
{
|
||||||
|
if (valuesCount() == 0) return;
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
qreal hStep = (labelsRect.width() / valuesCount());
|
qreal hStep = (labelsRect.width() / valuesCount());
|
||||||
if (!m_chartItem->labels().isEmpty()){
|
if (!m_chartItem->labels().isEmpty()){
|
||||||
@ -623,6 +628,8 @@ void AbstractSeriesChart::paintHorizontalLabels(QPainter *painter, QRectF labels
|
|||||||
|
|
||||||
void AbstractSeriesChart::paintVerticalLabels(QPainter *painter, QRectF labelsRect)
|
void AbstractSeriesChart::paintVerticalLabels(QPainter *painter, QRectF labelsRect)
|
||||||
{
|
{
|
||||||
|
if (valuesCount() == 0) return;
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setFont(adaptLabelsFont(labelsRect.adjusted(0, 0, -hPadding(m_chartItem->rect()), 0),
|
painter->setFont(adaptLabelsFont(labelsRect.adjusted(0, 0, -hPadding(m_chartItem->rect()), 0),
|
||||||
painter->font()));
|
painter->font()));
|
||||||
@ -771,7 +778,7 @@ void AbstractBarChart::paintChartLegend(QPainter *painter, QRectF legendRect)
|
|||||||
);
|
);
|
||||||
cw += painter->fontMetrics().height();
|
cw += painter->fontMetrics().height();
|
||||||
}
|
}
|
||||||
} else {
|
} else if (m_chartItem->itemMode() == DesignMode){
|
||||||
qreal cw = 0;
|
qreal cw = 0;
|
||||||
for (int i=0;i<m_designLabels.size();++i){
|
for (int i=0;i<m_designLabels.size();++i){
|
||||||
QString label = m_designLabels.at(i);
|
QString label = m_designLabels.at(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user