##// END OF EJS Templates
Fix domain switching
Michal Klocek -
r2288:a12d6a605fab
parent child
Show More
@@ -189,7 +189,6 bool ChartDataSet::attachAxis(QAbstractSeries* series,QAbstractAxis *axis)
189 189
190 190 if(type == AbstractDomain::UndefinedDomain) return false;
191 191
192
193 192 if(domain->type()!=type){
194 193 domain = createDomain(type);
195 194 }
@@ -201,8 +200,10 bool ChartDataSet::attachAxis(QAbstractSeries* series,QAbstractAxis *axis)
201 200 series->d_ptr->m_axes<<axis;
202 201 axis->d_ptr->m_series<<series;
203 202
203 if(domain!=series->d_ptr->domain()){
204 204 series->d_ptr->setDomain(domain);
205 205 series->d_ptr->initializeDomain();
206 }
206 207 series->d_ptr->initializeAxes();
207 208 axis->d_ptr->initializeDomain(domain);
208 209
@@ -397,24 +398,37 QList<QAbstractSeries *> ChartDataSet::series() const
397 398 AbstractDomain::DomainType ChartDataSet::selectDomain(QList<QAbstractAxis*> axes)
398 399 {
399 400 enum Type {
401 Undefined = 0,
400 402 LogType = 0x1,
401 403 ValueType = 0x2
402 404 };
403 405
404 int horizontal(ValueType);
405 int vertical(ValueType);
406 int horizontal(Undefined);
407 int vertical(Undefined);
406 408
407 409 foreach(QAbstractAxis* axis, axes)
408 410 {
409 411 switch(axis->type()) {
410 412 case QAbstractAxis::AxisTypeLogValue:
411 axis->orientation()==Qt::Horizontal?horizontal:vertical|=LogType;
413
414 if(axis->orientation()==Qt::Horizontal) {
415 horizontal|=LogType;
416 }
417 if(axis->orientation()==Qt::Vertical) {
418 vertical|=LogType;
419 }
420
412 421 break;
413 422 case QAbstractAxis::AxisTypeValue:
414 423 case QAbstractAxis::AxisTypeBarCategory:
415 424 case QAbstractAxis::AxisTypeCategory:
416 425 case QAbstractAxis::AxisTypeDateTime:
417 axis->orientation()==Qt::Horizontal?horizontal:vertical|=ValueType;
426 if(axis->orientation()==Qt::Horizontal) {
427 horizontal|=ValueType;
428 }
429 if(axis->orientation()==Qt::Vertical) {
430 vertical|=ValueType;
431 }
418 432 break;
419 433 default:
420 434 qWarning()<<"Undefined type";
@@ -422,6 +436,9 AbstractDomain::DomainType ChartDataSet::selectDomain(QList<QAbstractAxis*> axes
422 436 }
423 437 }
424 438
439 if(vertical==Undefined) vertical=ValueType;
440 if(horizontal==Undefined) horizontal=ValueType;
441
425 442 if(vertical==ValueType && horizontal== ValueType) {
426 443 return AbstractDomain::XYDomain;
427 444 }
@@ -70,7 +70,6 QRectF ChartPresenter::geometry() const
70 70
71 71 void ChartPresenter::handleAxisAdded(QAbstractAxis *axis)
72 72 {
73 qDebug()<<__FUNCTION__;
74 73 axis->d_ptr->initializeGraphics(rootItem());
75 74 axis->d_ptr->initializeAnimations(m_options);
76 75 ChartAxis *item = axis->d_ptr->axisItem();
@@ -83,7 +82,6 void ChartPresenter::handleAxisAdded(QAbstractAxis *axis)
83 82
84 83 void ChartPresenter::handleAxisRemoved(QAbstractAxis *axis)
85 84 {
86 qDebug()<<__FUNCTION__;
87 85 ChartAxis *item = axis->d_ptr->m_item.take();
88 86 item->hide();
89 87 item->disconnect();
@@ -96,7 +94,6 void ChartPresenter::handleAxisRemoved(QAbstractAxis *axis)
96 94
97 95 void ChartPresenter::handleSeriesAdded(QAbstractSeries *series)
98 96 {
99 qDebug()<<__FUNCTION__;
100 97 series->d_ptr->initializeGraphics(rootItem());
101 98 series->d_ptr->initializeAnimations(m_options);
102 99 ChartItem *chart = series->d_ptr->chartItem();
@@ -112,7 +109,6 void ChartPresenter::handleSeriesAdded(QAbstractSeries *series)
112 109
113 110 void ChartPresenter::handleSeriesRemoved(QAbstractSeries *series)
114 111 {
115 qDebug()<<__FUNCTION__;
116 112 ChartItem *chart = series->d_ptr->m_item.take();
117 113 chart->hide();
118 114 chart->disconnect();
@@ -50,6 +50,7 void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
50 50 axisXChanged = true;
51 51 m_logMinX = log10(m_minX) / log10(m_logBaseX);
52 52 m_logMaxX = log10(m_maxX) / log10(m_logBaseX);
53 if(!m_signalsBlocked)
53 54 emit rangeHorizontalChanged(m_minX, m_maxX);
54 55 }
55 56
@@ -59,6 +60,7 void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
59 60 axisYChanged = true;
60 61 m_logMinY = log10(m_minY) / log10(m_logBaseY);
61 62 m_logMaxY = log10(m_maxY) / log10(m_logBaseY);
63 if(!m_signalsBlocked)
62 64 emit rangeVerticalChanged(m_minY, m_maxY);
63 65 }
64 66
@@ -47,7 +47,7 void LogXYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
47 47 axisXChanged = true;
48 48 m_logMinX = log10(m_minX) / log10(m_logBaseX);
49 49 m_logMaxX = log10(m_maxX) / log10(m_logBaseX);
50
50 if(!m_signalsBlocked)
51 51 emit rangeHorizontalChanged(m_minX, m_maxX);
52 52 }
53 53
@@ -55,6 +55,7 void LogXYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
55 55 m_minY = minY;
56 56 m_maxY = maxY;
57 57 axisYChanged = true;
58 if(!m_signalsBlocked)
58 59 emit rangeVerticalChanged(m_minY, m_maxY);
59 60 }
60 61
@@ -45,6 +45,7 void XLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
45 45 m_minX = minX;
46 46 m_maxX = maxX;
47 47 axisXChanged = true;
48 if(!m_signalsBlocked)
48 49 emit rangeHorizontalChanged(m_minX, m_maxX);
49 50 }
50 51
@@ -54,6 +55,7 void XLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
54 55 axisYChanged = true;
55 56 m_logMinY = log10(m_minY) / log10(m_logBaseY);
56 57 m_logMaxY = log10(m_maxY) / log10(m_logBaseY);
58 if(!m_signalsBlocked)
57 59 emit rangeVerticalChanged(m_minY, m_maxY);
58 60 }
59 61
General Comments 0
You need to be logged in to leave comments. Login now