I've a Basic macro that create a LineDiagram based on series of data stored in a Calc sheet.
Everything is ok but I'm not be able to change the width of the line that paint the diagram.
Can somebody help me ?
Here are my code:
Code: Select all
sub drawTrend(oSheetTrend as object, _
oSheetData as object, _
sTrendTitle as string, _
sRange as string _
)
dim oCharts, oChart, oDiagram, oCellRangeAddress as object
oCellRangeAddress = oSheetData.getCellRangeByName(sRange).getRangeAddress()
'xray oCellRangeAddress
oCharts = oSheetTrend.getCharts()
'xray oCharts
oCharts.addNewByName("Trend", MakeRectangle(0000, 0000, 24800, 15200 ), Array( oCellRangeAddress ),True, True )
oChart = oCharts.getByName( "Trend" ).getEmbeddedObject()
oDiagram = oChart.createInstance("com.sun.star.chart.LineDiagram")
oChart.HasMainTitle = True
oChart.Title.String = sTrendTitle
'oChart.HasSubTitle = True
'oChart.Subtitle.String = "Subtitle String"
oChart.HasLegend = True
oChart.Legend.Alignment = com.sun.star.chart.ChartLegendPosition.BOTTOM
'oChart.Legend.FillStyle = com.sun.star.drawing.FillStyle.SOLID
'oChart.Legend.FillColor = RGB(210, 210, 210)
oChart.Legend.CharHeight = 7
'oChart.Area.FillStyle = com.sun.star.drawing.FillStyle.BITMAP
'oChart.Area.FillBitmapName = "Sky"
'oChart.Area.FillBitmapMode = com.sun.star.drawing.BitmapMode.REPEAT
'oChart.Diagram.Wall.FillStyle = com.sun.star.drawing.FillStyle.SOLID
'oChart.Diagram.Wall.FillColor = RGB(00,132,209)
' Asse X
oDiagram.HasXAxisGrid = false
oDiagram.XMainGrid.LineColor = RGB(192, 192, 192)
'oChart.Diagram.XAxis.Min = 0
'oChart.Diagram.XAxis.Max = 2000
oDiagram.HasXAxisDescription = true
oDiagram.HasXAxisTitle = false
oDiagram.XAxisTitle.String = "Time"
oDiagram.XAxis.StepMain = 50
' Asse Y
oDiagram.HasYAxisGrid = True
oDiagram.YMainGrid.LineColor = RGB(192, 192, 192)
oDiagram.YAxis.Min = 0
oDiagram.YAxis.Max = 120
oDiagram.HasYAxisTitle = true
oDiagram.YAxisTitle.String = "Temperature °C"
oDiagram.YAxis.StepMain = 5.0
end sub