21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The Structure of Charts 184<br />

angle of rotation of text in 100ths of a degree<br />

The legend (<br />

com.sun.star.chart.ChartLegend<br />

) contains the following additional property:<br />

Alignment (Enum)<br />

position at which the legend appears (value of type<br />

com.sun.star.chart.ChartLegendPosition<br />

)<br />

The following example creates a chart with a title "Main Title String", a subtitle "Subtitle<br />

String" and a legend. The legend has a gray background color, is placed at the bottom of<br />

the chart, and has a character size of 7 points.<br />

Dim Doc As Object<br />

Dim Charts As Object<br />

Dim Chart as Object<br />

Dim Rect As New com.sun.star.awt.Rectangle<br />

Dim RangeAddress(0) As New com.sun.star.table.CellRangeAddress<br />

Rect.X = 8000<br />

Rect.Y = 1000<br />

Rect.Width = 10000<br />

Rect.Height = 7000<br />

RangeAddress(0).Sheet = 0<br />

RangeAddress(0).StartColumn = 0<br />

RangeAddress(0).StartRow = 0<br />

RangeAddress(0).EndColumn = 2<br />

RangeAddress(0).EndRow = 12<br />

Doc = StarDesktop.CurrentComponent<br />

Charts = Doc.Sheets(0).Charts<br />

Charts.addNewByName("MyChart", Rect, RangeAddress(), True, True)<br />

Chart = Charts.getByName("MyChart").EmbeddedObject<br />

Chart.HasMainTitle = True<br />

Chart.Title.String = "Main Title String"<br />

Chart.HasSubTitle = True<br />

Chart.Subtitle.String = "Subtitle String"<br />

Chart.HasLegend = True<br />

Chart.Legend.Alignment = com.sun.star.chart.ChartLegendPosition.BOTTOM<br />

Chart.Legend.FillStyle = com.sun.star.drawing.FillStyle.SOLID<br />

Chart.Legend.FillColor = RGB(210, 210, 210)<br />

Chart.Legend.CharHeight = 7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!