| View previous topic :: View next topic |
| Author |
Message |
xconeis2 Newbie

Joined: 15 May 2009 Posts: 2
|
Posted: Tue May 19, 2009 5:58 am Post subject: How to change the type of line in a chart |
|
|
Hello:
i have a chart , and i need to change the type f line, how to do that?
the code: | Code: |
Sub nicer_chart
Dim oRange as Object
Dim oSheet as Object
Dim oCharts as Object
Dim oChart As Object
Dim cTitle as String
Dim oRect As New com.sun.star.awt.Rectangle
Dim oRangeAddress(1) As New com.sun.star.table.CellRangeAddress
cTitle = "PPI Cases"
oRange = thisComponent.getCurrentSelection.getRangeAddress
oSheet = thisComponent.CurrentSelection.getSpreadsheet
oCharts = oSheet.Charts
if oCharts.hasByName(cTitle) Then
oCharts.RemoveByname(cTitle)
end if
'Set Y azis Data
oRangeAddress(1).Sheet = oRange.Sheet
oRangeAddress(1).StartColumn = oRange.StartColumn
oRangeAddress(1).EndColumn = oRange.StartColumn
oRangeAddress(1).StartRow = oRange.StartRow
oRangeAddress(1).EndRow = oRange.EndRow
'Set X axis Data
oRangeAddress(0).Sheet = oRange.Sheet
oRangeAddress(0).StartColumn = oRange.StartColumn + 1
oRangeAddress(0).EndColumn = oRange.EndColumn
oRangeAddress(0).StartRow = oRange.StartRow
oRangeAddress(0).EndRow = oRange.EndRow
'The default chart is a little small - so make it bigger
oRect.Width = 20000
oRect.Height = 10000
oCharts.addNewByName(cTitle,oRect,oRangeAddress(),TRUE, TRUE)
oChart = oCharts.getByName(cTitle).embeddedObject
oChart.HasMainTitle = True
oChart.Title.string = cTitle
'More formating
oChart.diagram.XAxis.TextRotation = 27000
oChart.diagram.XAxis.TextBreak = False
oChart.diagram.HasXAxisTitle = True
oChart.diagram.XAxisTitle.string = "Date"
oChart.diagram.HasYAxisTitle = True
oChart.diagram.YAxisTitle.string = "Number of Cases"
End Sub
|
the probleme es with com.sun.star.drawing.LineStyle, is correct to add the line:
| Code: | | oChart.diagram.LineStyle = com.sun.star.drawing.LineStyle.DASH |
Thank friends... |
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
Posted: Tue May 19, 2009 2:27 pm Post subject: |
|
|
Hi,
the following changes the line style in an XY Diagram under OO 3.0
Good luck,
ms777
| Code: | Sub Main
oSheet = ThisComponent.sheets.getByIndex(0)
oChart = oSheet.Charts.getByIndex(0).EmbeddedObject
'for a 'normal' line diagram you probably have to change the 1 to 0
oYValueProps = oChart.Diagram.getDataRowProperties(1)
oYValueProps.LineStyle = com.sun.star.drawing.LineStyle.DASH
'oYValueProps.LineDashName = "Fine Dashed" 'or anything else
End Sub |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|