Issue 24614 - enable reverse scales on axes
Summary: enable reverse scales on axes
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: chart (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial with 12 votes (vote)
Target Milestone: ---
Assignee: kla
QA Contact: issues@graphics
URL: http://specs.openoffice.org/chart/Cha...
Keywords: ms_interoperability, rfe_eval_ok
: 30593 69647 71174 (view as issue list)
Depends on:
Blocks: 68552 74660
  Show dependency tree
 
Reported: 2004-01-21 01:32 UTC by rmedlicott
Modified: 2013-02-24 21:20 UTC (History)
7 users (show)

See Also:
Issue Type: FEATURE
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
The attachment is the patch of issue 24614, thanks to Ingrid (30.40 KB, patch)
2007-07-03 02:28 UTC, liyuan
no flags Details | Diff
TCS (11.14 KB, text/html)
2007-10-09 15:50 UTC, kla
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description rmedlicott 2004-01-21 01:32:09 UTC
In calc the chart does not offer the ability to chart the y axis in reverse 
order, ie have the minimum value for the y axis at the top of the chart, and 
the maximum at the bottom.  This would be a helpful feature.

I am using openoffice version 1.1 on windows XP.  I appreciate the work that 
you have all put into this great bit of software.
Comment 1 kla 2004-02-09 10:44:57 UTC
Hi Bettina,
one for you.
tk
Comment 2 dellg 2004-10-12 15:41:05 UTC
Chart on x axis reverse order for numbers would also be very helpful for Civil 
engineering soil analysis.
Comment 3 bettina.haberer 2004-11-29 18:18:00 UTC
Reassigned to Ingrid.
Comment 4 IngridvdM 2005-02-15 09:55:54 UTC
Yes, this is a missing feature compared with similar products.
Comment 5 IngridvdM 2005-02-15 09:59:09 UTC
*** Issue 30593 has been marked as a duplicate of this issue. ***
Comment 6 IngridvdM 2005-02-15 10:16:17 UTC
accept issue
Comment 7 IngridvdM 2005-04-15 14:10:45 UTC
added keyword
Comment 8 flcs 2006-08-20 01:47:08 UTC
Is this that difficult to solve?
Where can I found this other functions like that in our source and i'll give a
try for that.
It's more than a year sinse reported and nothing is done, no one cares.
Where is it, I can do something, just show me where is it please.
Comment 9 IngridvdM 2006-08-21 12:34:18 UTC
Hi flcs.
There is nothing happening here because the chart team is still busy with
reimplement the whole chart from scratch. If you want to help implementing you
are very welcome. The new implementation is done on the CWS chart2mst3. Have a
look at the chart webpage for more details and further links:
http://graphics.openoffice.org/chart/chart.html if you like. 

To implement this feature additional GUI is needed at the Scale tabpage ( look
for the implementation in chart2/source/controller/tp_Scale.* on branch
chart2mst3 ) and a fileformat extension to save and load the settings (xmloff)
is also necessary. The new chart is in principle already able to reverse axis:
see ::com::sun::star::chart2::ScaleData and
::com::sun::star::chart2::AxisOrientation but there is some additional handling
around missing.
Comment 10 kpalagin 2006-11-08 05:39:19 UTC
*** Issue 71174 has been marked as a duplicate of this issue. ***
Comment 11 bjoern.milcke 2007-01-12 17:03:23 UTC
*** Issue 69647 has been marked as a duplicate of this issue. ***
Comment 12 IngridvdM 2007-04-03 17:47:37 UTC
changed target to 2.x
Comment 13 IngridvdM 2007-06-13 09:34:23 UTC
hint for development:
First we need a check box, where the user can switch the direction of the axes.
A good place might be the scale tabpage of the axis properties dialog.
The source code for this tabpage is in:
chart2/source/controller/dialogs/tp_Scale.hxx
chart2/source/controller/dialogs/tp_Scale.cxx
chart2/source/controller/dialogs/tp_Scale.src
chart2/source/controller/dialogs/TabPages.hrc
Look how the implementation works for the similar checkbox CBX_LOGARITHM on the
same page and try to introduce the new checkbox 'CBX_REVERSE'in the same way.
Comment 14 liyuan 2007-06-20 08:35:50 UTC
->iha I have added a checkbox on the the scale tabpage of the axis properties 
dialog.

and, the next step is 
Comment 15 liyuan 2007-06-20 09:55:37 UTC
->iha I have fixed the issue, I will send the patch to you to review later.
Comment 16 IngridvdM 2007-06-20 10:27:11 UTC
:-) The chart model is already prepared to keep the information 'reverse scale'.
It is in the member 'Orientation' in the ScaleData of each axis (see UNO
interface ::com::sun::star::chart2::XAxis and UNO struct
::com::sun::star::chart2::ScaleData and UNO enum
::com::sun::star::chart2::AxisOrientation). 
So the next step will be to transport the information from the dialog to the
chart model.
Many dialogs in OpenOffice are designed to get input and return output via
objects of type 'SfxItemSet' (you can find this class in module
svtools/inc/svtools/itemset.hxx). Multiple Items of different type can be stored
and accessed via Ids (nWhich). We only need a bool value thus a SfxBoolItem will
do. We also need to define a new ID SCHATTR_AXIS_REVERSE. Look how this is made
for the logarithmic state information (SCHATTR_AXIS_LOGARITHM). The SfxItemSet
for the axis is filled in the AxisItemConverter
(chart2/source/controller/itemsetwrapper/AxisItemConverter.hxx and cxx). Look
what is done there for SCHATTR_AXIS_LOGARITHM and introduce the transport of the
'reverse' information for the new ID SCHATTR_AXIS_REVERSE.

As the view already reads and reacts to the model information you should be able
to see the reverse axis when the transport of information from dialog to model
is working correctly.
Comment 17 IngridvdM 2007-06-20 18:23:20 UTC
I see you did the second step already. Fine.
So next we need to provide the new information at the old Chart UNO API as this
is used to load and save the axis information. The wrapper for the old Axis API
is in chart2/source/controller/chartapiwrapper/AxisWrapper.hxx and cxx. Look how
the similar property "Logarithmic" is offered and introduce a new optional
boolean property "ReverseDirection" for the service
::com::sun::star::chart::ChartAxis. The values are transported to and from the
new API via the class WrappedScaleProperty. Look how it is done for
SCALE_PROP_LOGARITHMIC there.
Comment 18 liyuan 2007-06-21 06:50:56 UTC
->iha
I have changed the patch file according to your suggestions. Please review it 
again.  :)
Comment 19 IngridvdM 2007-06-21 12:12:42 UTC
Fine, the next step will be to transport the new information from the API to the
file. This is be done in module /xml/xmloff in general.
The next version of ODF fileformat will allow a new attribute
"reverse-direction" for chart axes. In xmloff we need a new Token
XML_REVERSE_DIRECTION to represent this new XML attribute. It needs to be mapped
to the UNO property "ReverseDirection". Look how this is done for
XML_TEXT_OVERLAP. The only thing you can ignore about XML_TEXT_OVERLAP is what
is happening in /xmloff/source/transform/PropertyActionsOOo.cxx as this is only
necessary for old attributes and an older file format.
When you have done these changes the reverse setting can be saved and loaded.

Comment 20 bobharvey 2007-06-21 15:10:28 UTC
I have been following this discussion with considerable interest, and have
learned a lot from it.  I am grateful for the work being done to improve things.

Now we are talking about saving this attribute it appears, from context, as
though it will be saved in odf format spreadsheets by the method proposed.

What will that mean for "ms_interoperability"?  How about picking up the reverse
axis from excel files?

Frankly, I am not at all impressed with the way that Excel handles reversed axis
graphs, they end up looking a right mess....
Comment 21 IngridvdM 2007-06-21 15:39:19 UTC
Importing from and exporting to xcel is another step.
This is currently done in module sc in /sc/sc/source/filter.
The implementation for the reverse-axis feature is already prepared there. Just
set the define EXC_CHART2_REVERSE_AXIS to 1 or remove it completely and it
should work.
Comment 22 liyuan 2007-06-22 04:33:21 UTC
->iha 
Great, the reverse setting can be saved and loaded now.
I have sent the third version patch of the issue to you to view,
if it is ok, I will attach it to the issue. :)
Comment 23 IngridvdM 2007-06-22 09:47:30 UTC
Now there is the problem left, that the scale tabpage is only available for
value axes so far. Thus the user cannot set the reverse setting for category
axes (x axis in most charts except xy). I think we should show the scale page
also for category axes but then we need to hide and reorganize some controls.

Which pages are shown in the properties dialog for chart objects is managed by
the class ObjectPropertiesDialogParameter. We have a method HasScaleProperties()
there so far. This method should be replaced by two new methods to distinguish a
scale page for value axes from a scale page for category axes:
HasValueScaleProperties()
HasCategoryScaleProperties()

I think in a first step we can try to reuse the SchScaleYAxisTabPage for both
scenarios and make it dependent on a new parameter.

Then we need new factory methods to create the different scale pages:
replace static SfxTabPage* SchScaleYAxisTabPage::Create( Window* pParent, const
SfxItemSet& rInAttrs );
by twi new methods CreateValueScalePage and CreateCategroyScalePage.

If this is working we can cleanup the scale page for case of category axes thus
only those controls are shown that fit this case.
Comment 24 liyuan 2007-07-03 02:28:53 UTC
Created attachment 46460 [details]
The attachment is the patch of issue 24614, thanks to Ingrid
Comment 25 IngridvdM 2007-07-19 11:01:49 UTC
changed target
Comment 26 jack_dodds 2007-07-27 04:22:30 UTC
I hope that the axis reversal capability will include reversed logarithmic
horizontal ("X") axes.

I use OO 2.2 to display results of a geophysical survey technique known as
magnetotelluric sounding.  It is conventional in the industry to display the
results on a log-log graph, with the frequency (horizontal) axis being reversed
- low frequencies e.g. 0.00005 Hz on the left, and high frequencies e.g. 1,000
Hz on the right.  At present I fudge it by displaying 1/Frequency - but this is
a definite kludge!

Thanks for OO - I use it every day.
Comment 27 IngridvdM 2007-09-24 10:12:57 UTC
Fixed in CWS chart14.

I changed the scale specification according to this new feature:
http://specs.openoffice.org/chart/Chart_Scales_and_Intervals.odt

Furthermore I did correct an issue in the patch regarding the AllAxes-properties
dialog.
And did some more changes to reduced code complexity further.

jack_dodds: yes, also log x-axes can be reversed
Comment 28 IngridvdM 2007-10-02 16:00:31 UTC
->Thomas, please verify in CWS chart14.
Please also test the excel im-/export for this feature.
Comment 29 ht990332 2007-10-02 21:23:48 UTC
I tested the excel import for this feature and it works. 
I did a chart with Y axis reversed and X axis logarithmic and saved it as an
excel spreadsheet at university. I saved it on a usb drive and when I opened it
at home on my Linux computer with OpenOffice.org built with the patch, it
imported it correctly and the Y axis is still reversed.
Comment 30 kla 2007-10-09 15:50:53 UTC
Created attachment 48782 [details]
TCS
Comment 31 kla 2007-10-16 16:36:05 UTC
seen ok in cws chart 14 -> verified
Comment 32 kla 2007-11-29 12:56:51 UTC
seen ok in current master -> closed