[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/koffice-ko/kchart/shape
From: Mike Arthur <mike () mikearthur ! co ! uk>
Date: 2010-04-22 15:38:01
Message-ID: 20100422153801.AECF2AC8A0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1117605 by mikearthur:
Improve KChart Bubble and Stock support.
M +56 -4 Axis.cpp
--- branches/work/koffice-ko/kchart/shape/Axis.cpp #1117604:1117605
@@ -748,9 +748,9 @@
#if 0 // Stacked and Percent not supported by KDChart.
if ( plotAreaChartSubType == StackedChartSubtype )
- kdBarDiagram->setType( KDChart::PolarDiagram::Stacked );
+ kdRadarDiagram->setType( KDChart::PolarDiagram::Stacked );
else if ( plotAreaChartSubType == PercentChartSubtype )
- kdBarDiagram->setType( KDChart::PolarDiagram::Percent );
+ kdRadarDiagram->setType( KDChart::PolarDiagram::Percent );
#endif
plotArea->parent()->legend()->kdLegend()->addDiagram( kdRadarDiagram );
kdPolarPlane->addDiagram( kdRadarDiagram );
@@ -799,11 +799,34 @@
Q_ASSERT( kdStockDiagram == 0 );
kdStockDiagramModel = new KDChartModel;
- kdStockDiagramModel->setDataDimensions( 2 );
kdStockDiagram = new KDChart::StockDiagram( plotArea->kdChart(), kdPlane );
kdStockDiagram->setModel( kdStockDiagramModel );
registerDiagram( kdStockDiagram );
+
+#if 0 // Stacked and Percent not supported by KDChart.
+ if ( plotAreaChartSubType == StackedChartSubtype )
+ kdStockDiagram->setType( KDChart::StockDiagram::Stacked );
+ else if ( plotAreaChartSubType == PercentChartSubtype )
+ kdStockDiagram->setType( KDChart::StockDiagram::Percent );
+#endif
+
+ if ( isVisible )
+ kdStockDiagram->addAxis( kdAxis );
+ kdPlane->addDiagram( kdStockDiagram );
+
+ if ( !plotArea->kdChart()->coordinatePlanes().contains( kdPlane ) )
+ plotArea->kdChart()->addCoordinatePlane( kdPlane );
+
+ Q_ASSERT( plotArea );
+ foreach ( Axis *axis, plotArea->axes() ) {
+ if ( axis->dimension() == XAxisDimension )
+ if ( axis->isVisible() )
+ kdStockDiagram->addAxis( axis->kdAxis() );
+ }
+
+ plotArea->parent()->legend()->kdLegend()->addDiagram( kdStockDiagram );
+
}
void Axis::Private::createBubbleDiagram()
@@ -812,7 +835,7 @@
Q_ASSERT( kdBubbleDiagram == 0 );
kdBubbleDiagramModel = new KDChartModel;
- kdBubbleDiagramModel->setDataDimensions( 3 );
+ kdBubbleDiagramModel->setDataDimensions( 2 );
kdBubbleDiagram = new KDChart::Plotter( plotArea->kdChart(), kdPlane );
kdBubbleDiagram->setModel( kdBubbleDiagramModel );
@@ -1661,6 +1684,11 @@
d->kdLineDiagram->update();
}
+ if ( d->kdStockDiagram ) {
+ d->kdStockDiagram->doItemsLayout();
+ d->kdStockDiagram->update();
+ }
+
d->plotArea->parent()->requestRepaint();
}
@@ -1955,6 +1983,22 @@
}
#endif
break;
+ case StockChartType:
+ if ( d->kdStockDiagram ) {
+ KDChart::StockDiagram::Type type;
+ switch ( subType ) {
+#if 0
+ case StackedChartSubtype:
+ type = KDChart::StockDiagram::Candlestick; break;
+ case PercentChartSubtype:
+ type = KDChart::StockDiagram::OpenHighLowClose; break;
+#endif
+ default:
+ type = KDChart::StockDiagram::HighLowClose;
+ }
+ d->kdStockDiagram->setType( type );
+ }
+ break;
default:;
// FIXME: Implement more chart types
}
@@ -1970,6 +2014,10 @@
d->kdAreaDiagram->addAxis( axis );
if ( d->kdScatterDiagram )
d->kdScatterDiagram->addAxis( axis );
+ if ( d->kdStockDiagram )
+ d->kdStockDiagram->addAxis( axis );
+ if ( d->kdBubbleDiagram )
+ d->kdBubbleDiagram->addAxis( axis );
// FIXME: Add all diagrams here
}
@@ -1983,6 +2031,10 @@
d->kdAreaDiagram->takeAxis( axis );
if ( d->kdScatterDiagram )
d->kdScatterDiagram->takeAxis( axis );
+ if ( d->kdStockDiagram )
+ d->kdStockDiagram->takeAxis( axis );
+ if ( d->kdBubbleDiagram )
+ d->kdBubbleDiagram->takeAxis( axis );
// FIXME: Add all diagrams here
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic