Superimpose charts with same coordinate system

Creating a macro - Writing a Script - Using the API

Superimpose charts with same coordinate system

Postby othmanelmoulat » Fri Aug 08, 2008 1:28 pm

Hi,
i have a standard OHLC chart which could be drawn on OO perfectly . OO could draw the OHLC chart but could not combine it with other line charts in the same graph. What i needed is a way to modify the OO code so that it could superimpose charts with same coordinate system to appear on the same graph.
The com:sun:star:chart API is very rigid on the chart type so i need to develop new chart type to take care of my needs and it is not flexible to use this approach.
The com:sum:star:chart2 API appears to be the answer as it has the infrastructure in place to allow me to draw more than one charttype on the same graph under the same coordinate system. However, I have never tried this feature out.

does anyone experimented the com:sum:star:chart2 API feature of superimposing two chart types?
i would appreciate any java snippet code showing how to achieve this feature with java UNO api.

thanks.
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Superimpose charts with same coordinate system

Postby Villeroy » Fri Aug 08, 2008 3:45 pm

Can you do what your want to do manually? If not, it is unlikely that a macro can do it.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27296
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Superimpose charts with same coordinate system

Postby othmanelmoulat » Fri Aug 08, 2008 7:16 pm

Villeroy wrote:Can you do what your want to do manually? If not, it is unlikely that a macro can do it.


we want to use java because we need this code to run on Linux, windows and Mac with the same code base.

if someone can show a java code snippet to combine two chart types , that would be great.

thanks.
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am

Re: Superimpose charts with same coordinate system

Postby foxcole » Fri Aug 08, 2008 9:55 pm

othmanelmoulat wrote:
Villeroy wrote:Can you do what your want to do manually? If not, it is unlikely that a macro can do it.


we want to use java because we need this code to run on Linux, windows and Mac with the same code base.

if someone can show a java code snippet to combine two chart types , that would be great.

What Villeroy is saying, I think, is that if you personally can't get the program to do what you're trying to do, meaning if you can't take a chart and place it in another chart, then the program does not have the facility to handle that kind of output. A macro won't do any good because the program does not support combining charts. If it did, you would be able to combine them using a tool or command already available in the program.

I thought that if what you're wanting to do is possible, the R project would have a way to do it, but apparently there isn't. Yet. Still, maybe you will find that a more useful tool.
Cheers!
---Fox

OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
User avatar
foxcole
Volunteer
 
Posts: 1507
Joined: Mon Oct 08, 2007 1:31 am
Location: Minneapolis, Minnesota

Re: Superimpose charts with same coordinate system

Postby Villeroy » Fri Aug 08, 2008 10:32 pm

Yes, the smart fox got me right again. You can not put a spell on something you don't even know.

- I can make a chart (x/y-scatter with points)
- name it "Master"
- note the position and size of the chart's shape on the sheet's draw page
- note the position and size of the inner chart's surface
- set the scaling to fixed values

Then I create another scatter-chart with connecting lines on top of the master (shape>bring to front)
- name it "Slave1"
- adjust the positions and sizes
- adjust the scaling
- move the legend a little bit offset
- set all surfaces 100% transparent (the shape and the inner chart)
- set all border-styles, lines, labels and numbers invisible.
-the only visible thing is the line which represents the data series.

The result is not satisfying because the slave's visible line overlaps with the visible scales of the master. The master's size includes the outer scales and labels whereas the slave's data range uses all the space. I keep this intermediate result in the attached file. I think you could keep the slave's scales and labels visible with the same color as the background, so they use up space without beeing visible actually. The navigator (F5) helps to select the right thing. You can also edit the charts side by side and finally adjust the shapes' position and size.
Once you got an idea how to set the adequate properties, you can start exploring the rather complex chart-API.
Attachments
combined_charts.ods
One transparent chart over the other.
(41.03 KiB) Downloaded 277 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27296
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Superimpose charts with same coordinate system

Postby othmanelmoulat » Sun Aug 17, 2008 2:03 pm

thanks for the reply (& sorry for delay to respond)
well what i understand from your reply is that we can manually do the combination of two chart types using OO charting wizard tools -am i correct ?

well actually my project aim is to extend the com:sun:star:chart2 module using a java OO extension (plugin).
i've been searching for some java sample code demonstrating the use of chart2 ; but i couldn't find even one single example!

let me here explain you guys the scope of my project :

I'm working on a java project which is an openoffice.org addon to draw a combined chart (candlestick+line) .
I wrote to Ingrid Halama author of com:sum:star:chart2 API but he discouraged me to use chart2 . he said "The ::com::sun::star:chart2 API is not intended for external use yet. It is an internal API that will change further."
i do not agree with Ingrid's approach. Consider that you are building a car, you need to do a lot of road test to ensure that the car would behave properly. Ingrid is building a car behind close door, it is never a good idea.
i believe The charting component is a major weakness in OO and i'm looking at ways to improve it to match the functionality of Excel.
i'm considering looking at com:sum:star:chart2 because i feel that SUN had already work on com:sum:star:chart2 for more than 2 years and they have already developed most of the infrastructure, what it needed is a way to extend it in UNO to suit my need.
However Ingrid & SUN people are not very helpful in this subject.. and it seems they don't want to cooperate on the com:sum:star:chart2 extension and want to keep it hidden from the developers community.

my first aim is to use the chart2 API to programatically draw an OO combined chart .( candlestick chart combined with line chart in same graph ).

2) i also thougth of a second approach :

It seems to me that in OO UNO all it matters is the interface. Therefore if i can redefine the interface, i may even use the jfreechart library behind the scene to draw the chart in the canvas. what do you think of this approach ? can you give me Ideas how to marry the OO chart API with the jfreechart library ? (http://www.jfree.org/jfreechart/ )
if i use the jfreechart library, i need a way to map the spreadsheet data to the format expected by jfreechart. I believe i need to marry the jfreechart with chart2 in UNO. The jfreechart library is a good candidate to physically draw the chart in the canvas while the chart2 interface already have the infrastructure in place to understand the data in the spreadsheet like range, columns etc.
can you please advise me how to rewrite the UNO interface so it can use jfreechart behind the scene to draw the complex chart type (using java ) ?

I Hope i could receive advice, Ideas and hopefully some sample java code from you Guys Regarding this issue.
I know this is a hard problem to solve . this is why i posted it in this forum & i'm looking forward to get help from smart people in this forum section.

Best Regards.
OOo 3.4 and LibreOffice 3.4 on openSuse 11.4 + windows 7
othmanelmoulat
 
Posts: 142
Joined: Sun Aug 03, 2008 4:39 am


Return to Macros and UNO API

Who is online

Users browsing this forum: Google [Bot] and 7 guests