[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [labplot] src: Power of Pi format for the plot axis
From: Minh Ngo <nlminhtl () gmail ! com>
Date: 2015-05-02 10:17:46
Message-ID: E1YoUUU-0004TD-S4 () scm ! kde ! org
[Download RAW message or body]
Git commit 8331f620f99b17d3d58c2883108f41109c3dc47d by Minh Ngo.
Committed on 02/05/2015 at 10:15.
Pushed by minhngo into branch 'master'.
Power of Pi format for the plot axis
Kick-off commit for starting contributions into the LabPlot project.
These changes provide a new "power of pi" format for the plot axis that
can be used with periodical functions.
REVIEW: 123591
M +6 -0 src/backend/worksheet/plots/cartesian/Axis.cpp
M +1 -1 src/backend/worksheet/plots/cartesian/Axis.h
M +1 -0 src/kdefrontend/dockwidgets/AxisDock.cpp
http://commits.kde.org/labplot/8331f620f99b17d3d58c2883108f41109c3dc47d
diff --git a/src/backend/worksheet/plots/cartesian/Axis.cpp \
b/src/backend/worksheet/plots/cartesian/Axis.cpp index 45de870..b37dc79 100644
--- a/src/backend/worksheet/plots/cartesian/Axis.cpp
+++ b/src/backend/worksheet/plots/cartesian/Axis.cpp
@@ -1318,6 +1318,12 @@ void AxisPrivate::retransformTickLabelStrings(){
str = labelsPrefix + str + labelsSuffix;
tickLabelStrings << str;
}
+ } else if (labelsFormat == Axis::FormatPowersPi) {
+ foreach(float value, tickLabelValues) {
+ str = "<span>"+ QString::number(value / M_PI,'f',labelsPrecision)+"</span>" + \
QChar(0x03C0); + str = labelsPrefix + str + labelsSuffix;
+ tickLabelStrings << str;
+ }
}
//recalculate the position of the tick labels
diff --git a/src/backend/worksheet/plots/cartesian/Axis.h \
b/src/backend/worksheet/plots/cartesian/Axis.h index 223cbf2..9916552 100644
--- a/src/backend/worksheet/plots/cartesian/Axis.h
+++ b/src/backend/worksheet/plots/cartesian/Axis.h
@@ -44,7 +44,7 @@ class Axis: public WorksheetElement {
public:
enum AxisOrientation {AxisHorizontal, AxisVertical};
enum AxisPosition {AxisTop, AxisBottom, AxisLeft, AxisRight, AxisCentered, AxisCustom};
- enum LabelsFormat {FormatDecimal, FormatScientificE, FormatPowers10, FormatPowers2, \
FormatPowersE}; + enum LabelsFormat {FormatDecimal, FormatScientificE, FormatPowers10, \
FormatPowers2, FormatPowersE, FormatPowersPi}; enum TicksFlags {
noTicks = 0x00,
ticksIn = 0x01,
diff --git a/src/kdefrontend/dockwidgets/AxisDock.cpp \
b/src/kdefrontend/dockwidgets/AxisDock.cpp index 858d3df..2241135 100644
--- a/src/kdefrontend/dockwidgets/AxisDock.cpp
+++ b/src/kdefrontend/dockwidgets/AxisDock.cpp
@@ -321,6 +321,7 @@ void AxisDock::init(){
ui.cbLabelsFormat->addItem( i18n("Powers of 10") );
ui.cbLabelsFormat->addItem( i18n("Powers of 2") );
ui.cbLabelsFormat->addItem( i18n("Powers of e") );
+ ui.cbLabelsFormat->addItem( i18n("Powers of \u03C0") );
m_initializing=false;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic