[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/plugins-chartshape_improvements-erione] plugins/chartshape: Fix bug: 271771 - Lines in the
From:       Brijesh Patel <brijesh3105 () gmail ! com>
Date:       2012-05-28 6:54:19
Message-ID: 20120528065419.DBCE0A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 7b1b6153f217cb036691ebf98bd15bc06679783c by Brijesh Patel.
Committed on 28/05/2012 at 08:38.
Pushed by patel into branch 'plugins-chartshape_improvements-erione'.

Fix bug: 271771 - Lines in the chart should be displayed
Fix bug: 288537 - Combined Bar and Line Charts only show bars (Trendlines not supported)
load/save chart type for each dataset
BUG: 271771
BUG: 288537

M  +3    -2    plugins/chartshape/Axis.cpp
M  +17   -0    plugins/chartshape/DataSet.cpp

http://commits.kde.org/calligra/7b1b6153f217cb036691ebf98bd15bc06679783c

diff --git a/plugins/chartshape/Axis.cpp b/plugins/chartshape/Axis.cpp
index 9fafeac..ffd4a98 100644
--- a/plugins/chartshape/Axis.cpp
+++ b/plugins/chartshape/Axis.cpp
@@ -270,9 +270,8 @@ Axis::Private::~Private()
 {
     Q_ASSERT(plotArea);
 
-    delete numericStyleFormat;
-
     delete kdBarDiagram;
+    delete kdLineDiagram;
     delete kdAreaDiagram;
     delete kdCircleDiagram;
     delete kdRingDiagram;
@@ -283,6 +282,8 @@ Axis::Private::~Private()
     delete kdSurfaceDiagram;
     delete kdGanttDiagram;
 
+    delete numericStyleFormat;
+
     delete kdAxis;
 
     foreach(DataSet *dataSet, dataSets)
diff --git a/plugins/chartshape/DataSet.cpp b/plugins/chartshape/DataSet.cpp
index ad11689..1a6290b 100644
--- a/plugins/chartshape/DataSet.cpp
+++ b/plugins/chartshape/DataSet.cpp
@@ -1401,6 +1401,18 @@ bool DataSet::loadOdf(const KoXmlElement &n,
         setLabelDataRegion(CellRegion(helper->tableSource, region));
     }
 
+    if (n.hasAttributeNS(KoXmlNS::chart, "class") && !ignoreCellRanges) {
+        const QString chartClass = n.attributeNS(KoXmlNS::chart, "class", QString());
+        KChart::ChartType chartType = KChart::BarChartType;
+        for (int type = 0; type < (int)LastChartType; ++type) {
+            if (chartClass == odfCharttype(type)) {
+                chartType = (ChartType)type;
+                setChartType(chartType);
+                break;
+            }
+        }
+    }
+
     d->readValueLabelType(styleStack);
 
     if (styleStack.hasProperty(KoXmlNS::chart, "symbol-type")) {
@@ -1612,6 +1624,11 @@ void DataSet::saveOdf(KoShapeSavingContext &context) const
     if (!label.isEmpty())
         bodyWriter.addAttribute("chart:label-cell-address", label);
 
+    int charttype = (chartType() < LastChartType) ? chartType() : 0;
+    QString chartClass = odfCharttype(charttype);
+    if (!chartClass.isEmpty())
+        bodyWriter.addAttribute("chart:class", chartClass);
+
     if (chartType() == KChart::CircleChartType || chartType() == KChart::RingChartType) {
         for (int j=0; j<yDataRegion().cellCount(); ++j) {
             bodyWriter.startElement("chart:data-point");
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic