| View previous topic :: View next topic |
| Author |
Message |
rebelxt OOo Enthusiast


Joined: 10 Dec 2006 Posts: 114 Location: StLouis
|
Posted: Sun Aug 03, 2008 6:09 pm Post subject: Simple chart from data array |
|
|
This is a small subroutine designed to demonstrate a chart created from data in an array rather than cells in a spreadsheet. The objective was the fewest number of lines possible.
| Code: | Sub SimpleChart
Dim aData(4,0)
aData(0,0) = 1
aData(1,0) = 2
aData(2,0) = 3
aData(3,0) = 2.5
aData(4,0) = .8
MakeChartZ(aData)
End Sub
Sub MakeChartZ(oData) ' oData is an array of numbers.
Dim oSheet, oCharts, oChartDoc
Dim aRect as new com.sun.star.awt.Rectangle
oSheet = ThisComponent.Sheets.getByIndex(0)
oCharts = oSheet.Charts
oCharts.addNewByName("chart1", aRect, Array(), False, True)
oChartDoc = oCharts.getByName( "chart1" ).EmbeddedObject
oChartDoc.lockControllers()
oChartDoc.setDiagram( oChartDoc.createInstance("com.sun.star.chart.LineDiagram") )
oChartDoc.Data.setData(oData())
oChartDoc.unlockControllers()
MsgBox("Close it")
oSheet.Charts.RemoveByName( "chart1" )
End Sub |
|
|
| Back to top |
|
 |
BDRJ General User

Joined: 02 Jul 2008 Posts: 18 Location: Italy
|
Posted: Fri Jul 24, 2009 12:39 am Post subject: |
|
|
Is this really possible?
When I try to execute this code OpenOffice crash and I have to restore file in use.
Debugging code I have noticed that is the line
oChartDoc.Data.setData(oData())
that made the program crash.
It's only my problem or it's the same for you?
Thanks |
|
| Back to top |
|
 |
rebelxt OOo Enthusiast


Joined: 10 Dec 2006 Posts: 114 Location: StLouis
|
Posted: Fri Jul 24, 2009 5:51 am Post subject: |
|
|
| This little routine was developed under OOo 2.x, and still works in that version. If someone knows why the setData method would fail in 3.1 under these circumstances, please tell. |
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
|
| Back to top |
|
 |
rebelxt OOo Enthusiast


Joined: 10 Dec 2006 Posts: 114 Location: StLouis
|
Posted: Tue Sep 15, 2009 4:07 pm Post subject: |
|
|
| I think you're right. I am watching that fix, which is scheduled to be implemented in the 3.2 release. |
|
| Back to top |
|
 |
ntvinh986 Newbie

Joined: 03 Nov 2009 Posts: 1 Location: bfjwefhueiwh
|
Posted: Tue Nov 03, 2009 12:02 am Post subject: |
|
|
| BDRJ wrote: | Is this really possible?
When I try to execute this code OpenOffice crash and I have to restore file in use.
Debugging code I have noticed that is the line
oChartDoc.Data.setData(oData())
that made the program crash.
It's only my problem or it's the same for you?
Thanks |
Hi guys, Im a newbie. Nice to join this forum.
__________________
Watch Anime Episodes |
|
| Back to top |
|
 |
rebelxt OOo Enthusiast


Joined: 10 Dec 2006 Posts: 114 Location: StLouis
|
Posted: Thu Feb 11, 2010 9:05 am Post subject: It's working now |
|
|
| This routine is working in release 3.2 |
|
| Back to top |
|
 |
|