|
@@
-10,8
+10,7
static int label_padding = 5;
|
|
10
|
|
|
10
|
|
|
11
|
QTCOMMERCIALCHART_BEGIN_NAMESPACE
|
|
11
|
QTCOMMERCIALCHART_BEGIN_NAMESPACE
|
|
12
|
|
|
12
|
|
|
13
|
Axis::Axis(QChartAxis* axis,ChartPresenter* presenter,AxisType type) :
|
|
13
|
Axis::Axis(QChartAxis* axis,ChartPresenter* presenter,AxisType type) : Chart(presenter),
|
|
14
|
Chart(presenter),
|
|
|
|
|
15
|
m_chartAxis(axis),
|
|
14
|
m_chartAxis(axis),
|
|
16
|
m_type(type),
|
|
15
|
m_type(type),
|
|
17
|
m_labelsAngle(0),
|
|
16
|
m_labelsAngle(0),
|
|
@@
-30,8
+29,8
m_ticksCount(0)
|
|
30
|
m_shades.setZValue(ChartPresenter::ShadesZValue);
|
|
29
|
m_shades.setZValue(ChartPresenter::ShadesZValue);
|
|
31
|
m_grid.setZValue(ChartPresenter::GridZValue);
|
|
30
|
m_grid.setZValue(ChartPresenter::GridZValue);
|
|
32
|
|
|
31
|
|
|
33
|
QObject::connect(m_chartAxis,SIGNAL(updated()),this,SLOT(handleAxisUpdated()));
|
|
32
|
connect(m_chartAxis,SIGNAL(updated()),this,SLOT(handleAxisUpdated()));
|
|
34
|
QObject::connect(m_chartAxis->categories(),SIGNAL(updated()),this,SLOT(handleAxisCategoriesUpdated()));
|
|
33
|
connect(m_chartAxis->categories(),SIGNAL(updated()),this,SLOT(handleAxisCategoriesUpdated()));
|
|
35
|
|
|
34
|
|
|
36
|
handleAxisUpdated();
|
|
35
|
handleAxisUpdated();
|
|
37
|
}
|
|
36
|
}
|
|
@@
-72,8
+71,9
void Axis::updateLayout(QVector<qreal>& layout)
|
|
72
|
{
|
|
71
|
{
|
|
73
|
if(animator()){
|
|
72
|
if (animator()) {
|
|
74
|
animator()->updateLayout(this,layout);
|
|
73
|
animator()->updateLayout(this,layout);
|
|
|
|
|
74
|
} else {
|
|
|
|
|
75
|
setLayout(layout);
|
|
75
|
}
|
|
76
|
}
|
|
76
|
else setLayout(layout);
|
|
|
|
|
77
|
}
|
|
77
|
}
|
|
78
|
|
|
78
|
|
|
79
|
bool Axis::createLabels(QStringList& labels,qreal min, qreal max,int ticks) const
|
|
79
|
bool Axis::createLabels(QStringList& labels,qreal min, qreal max,int ticks) const
|
|
@@
-91,8
+91,7
bool Axis::createLabels(QStringList& labels,qreal min, qreal max,int ticks) cons
|
|
91
|
qreal value = min + (i * (max - min)/ (ticks-1));
|
|
91
|
qreal value = min + (i * (max - min)/ (ticks-1));
|
|
92
|
labels << QString::number(value,'f',n);
|
|
92
|
labels << QString::number(value,'f',n);
|
|
93
|
}
|
|
93
|
}
|
|
94
|
}
|
|
94
|
} else {
|
|
95
|
else {
|
|
|
|
|
96
|
QList<qreal> values = categories->values();
|
|
95
|
QList<qreal> values = categories->values();
|
|
97
|
for(int i=0; i< ticks; i++) {
|
|
96
|
for (int i=0; i< ticks; i++) {
|
|
98
|
qreal value = (min + (i * (max - min)/ (ticks-1)));
|
|
97
|
qreal value = (min + (i * (max - min)/ (ticks-1)));
|
|
@@
-357,30
+356,25
void Axis::handleAxisUpdated()
|
|
357
|
|
|
356
|
|
|
358
|
if(m_chartAxis->isAxisVisible()) {
|
|
357
|
if (m_chartAxis->isAxisVisible()) {
|
|
359
|
setAxisOpacity(100);
|
|
358
|
setAxisOpacity(100);
|
|
360
|
}
|
|
359
|
} else {
|
|
361
|
else {
|
|
|
|
|
362
|
setAxisOpacity(0);
|
|
360
|
setAxisOpacity(0);
|
|
363
|
}
|
|
361
|
}
|
|
364
|
|
|
362
|
|
|
365
|
if(m_chartAxis->isGridLineVisible()) {
|
|
363
|
if(m_chartAxis->isGridLineVisible()) {
|
|
366
|
setGridOpacity(100);
|
|
364
|
setGridOpacity(100);
|
|
367
|
}
|
|
365
|
} else {
|
|
368
|
else {
|
|
|
|
|
369
|
setGridOpacity(0);
|
|
366
|
setGridOpacity(0);
|
|
370
|
}
|
|
367
|
}
|
|
371
|
|
|
368
|
|
|
372
|
if(m_chartAxis->labelsVisible())
|
|
369
|
if(m_chartAxis->labelsVisible()) {
|
|
373
|
{
|
|
|
|
|
374
|
setLabelsOpacity(100);
|
|
370
|
setLabelsOpacity(100);
|
|
375
|
}
|
|
371
|
} else {
|
|
376
|
else {
|
|
|
|
|
377
|
setLabelsOpacity(0);
|
|
372
|
setLabelsOpacity(0);
|
|
378
|
}
|
|
373
|
}
|
|
379
|
|
|
374
|
|
|
380
|
if(m_chartAxis->shadesVisible()) {
|
|
375
|
if (m_chartAxis->shadesVisible()) {
|
|
381
|
setShadesOpacity(m_chartAxis->shadesOpacity());
|
|
376
|
setShadesOpacity(m_chartAxis->shadesOpacity());
|
|
382
|
}
|
|
377
|
} else {
|
|
383
|
else {
|
|
|
|
|
384
|
setShadesOpacity(0);
|
|
378
|
setShadesOpacity(0);
|
|
385
|
}
|
|
379
|
}
|
|
386
|
|
|
380
|
|