OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Example<br />
The Structure of Charts<br />
The following example creates a line chart. The color for the rear wall of the chart is set to white. Both the X and<br />
Y-axes have a gray grid for visual orientation. The minimum value of the Y-axis is fixed to 0 and the maximum<br />
value is fixed to 100 so that the resolution of the chart is retained even if the values are changed. The X-axis<br />
points in reverse direction from right to left. And a title for the X-axis was added.<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 />
Doc = ThisComponent<br />
Charts = Doc.Sheets(0).Charts<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 />
Charts.addNewByName("MyChart", Rect, RangeAddress(), True, True)<br />
Chart = Charts.getByName("MyChart").embeddedObject<br />
Chart.Diagram = Chart.createInstance("com.sun.star.chart.LineDiagram")<br />
Chart.Diagram.Wall.FillColor = RGB(255, 255, 255)<br />
Chart.Diagram.HasXAxisGrid = True<br />
Chart.Diagram.XMainGrid.LineColor = RGB(192, 192, 192)<br />
Chart.Diagram.HasYAxisGrid = True<br />
Chart.Diagram.YMainGrid.LineColor = RGB(192, 192, 192)<br />
Chart.Diagram.YAxis.Min = 0<br />
Chart.Diagram.YAxis.Max = 100<br />
Chart.Diagram.XAxis.ReverseDirection = true 'needs <strong>OpenOffice</strong>.<strong>org</strong> 2.4 or newer<br />
Chart.Diagram.HasXAxisTitle = true<br />
Chart.Diagram.XAxisTitle.String = "Reversed X Axis Example"<br />
3D Charts<br />
Most charts in <strong>OpenOffice</strong>.<strong>org</strong> can also be displayed with 3D graphics. The following properties are provided for<br />
3D charts at the Diagram object:<br />
Dim3D (Boolean)<br />
activates 3D display<br />
Deep (Boolean)<br />
the series will be arranged behind each other in z-direction<br />
RightAngledAxes (Boolean)<br />
activates a 3D display mode where X- and Y-axes form a right angle within the projection. (available since<br />
<strong>OpenOffice</strong>.<strong>org</strong> 2.3)<br />
D3DScenePerspective (Enum)<br />
defines whether the 3D objects are to be drawn in perspective or parallel projection.(values according to<br />
com.sun.star.drawing.ProjectionMode)<br />
Perspective (Long)<br />
Perspective of 3D charts ( [0,100] ) (available since <strong>OpenOffice</strong>.<strong>org</strong> 2.4.1)<br />
RotationHorizontal (Long)<br />
Horizontal rotation of 3D charts in degrees ( [-180,180] ) (available since <strong>OpenOffice</strong>.<strong>org</strong> 2.4.1)<br />
RotationVertical (Long)<br />
Vertical rotation of 3D charts in degrees ( [-180,180] ) (available since <strong>OpenOffice</strong>.<strong>org</strong> 2.4.1)<br />
Chapter 9 · Charts (Diagrams) 139