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