Difference between revisions of "NL/Documentation/BASIC Guide/Structure of Charts"

From Apache OpenOffice Wiki
Jump to: navigation, search
Line 71: Line 71:
 
== Achtergrond ==
 
== Achtergrond ==
  
Every chart has a background area. The <tt>Chart</tt> object provides the property <tt>Area</tt> to format the background:
+
Elk diagram heeft een gedeelte voor de achtergrond. Het object <tt>Chart</tt> verschaft de eigenschap <tt>Area</tt> om de achtergrond op te maken:
  
;<tt>Area (Object)</tt>:background area of the chart (supports <idl>com.sun.star.chart.ChartArea</idl> service)
+
;<tt>Area (Object)</tt>:gebied voor de achtergrond van het diagram (ondersteunt de service <idl>com.sun.star.chart.ChartArea</idl>)
  
The background of a chart covers its complete area, including the area under the title, subtitle and legend. The associated <idl>com.sun.star.chart.ChartArea</idl> service supports line and fill properties.
+
De achtergrond van een diagram beslaat zijn complete gebied, inclusief het gebied onder de titel, sub-titel en diagram-legenda. De geassocieerde service <idl>com.sun.star.chart.ChartArea</idl> ondersteunt eigenschappen voor lijn en vulling.
  
 
== Diagram ==
 
== Diagram ==
  
The <tt>Chart</tt> object provides the property <tt>Diagram</tt> which forms the coordinate system with axes and grids, where the data finally is displayed:
+
Het object <tt>Chart</tt> verschaft de eigenschap <tt>Diagram</tt> die het coördinatensysteem vormt met assen en raster, waar de gegevens uiteindelijk wordne weergegeven:
  
;<tt>Diagram (Object)</tt>:object forming the coordinate system where the data is plotted. It supports <idl>com.sun.star.chart.Diagram</idl> service and:
+
;<tt>Diagram (Object)</tt>:object dat het coördinatensysteem vormt waar de gegevens worden geplot. Het ondersteunt de service <idl>com.sun.star.chart.Diagram</idl> en:
 
:* <idl>com.sun.star.chart.StackableDiagram</idl>
 
:* <idl>com.sun.star.chart.StackableDiagram</idl>
 
:* <idl>com.sun.star.chart.ChartAxisXSupplier</idl>
 
:* <idl>com.sun.star.chart.ChartAxisXSupplier</idl>
Line 89: Line 89:
 
:* <idl>com.sun.star.chart.ChartTwoAxisYSupplier</idl>
 
:* <idl>com.sun.star.chart.ChartTwoAxisYSupplier</idl>
  
Different services are supported depending on the chart type (see
+
verschillende services worden ondersteund, afhanbkelijk van het type diagram (zie
[[Documentation/BASIC_Guide/Chart_Types|Chart Types]]).
+
[[NL/Documentation/BASIC_Guide/Chart_Types|Typen diagram]]).
  
== Wall and Floor ==
+
== Wanden en vloer ==
  
 
The chart wall is the background of the coordinate system where the data is plotted.
 
The chart wall is the background of the coordinate system where the data is plotted.

Revision as of 15:50, 10 March 2013

Book.png


De structuur van een diagram, en daaropvolgend de lijst van daardoor ondersteunde services en interfaces, is afhankelijk van het type. De methoden en eigenschappen van de Z-as, zijn bijvoorbeeld alleen beschikbaar in 3D-diagrammen, maar niet in 2D-diagrammen. In taart-diagrammen zijn er geen interfaces voor het werken met assen.

Titel, subtitel en legenda

Een titel, sub-titel en legenda vormen een deel van de basiselementen van elk diagram. Diagrammen verschaffen hun eigen objecten voor elk van deze elementen. Het object Chart verschaft de volgende eigenschappen het beheren van deze elementen:

HasMainTitle (Boolean)
activeert de titel
Title (Object)
object met gedetailleerde informatie over de titel van het diagram (ondersteunt de service com.sun.star.chart.ChartTitle)
HasSubTitle(Boolean)
activeert de subtitel
Subtitle (Object)
object met gedetailleerde informatie over de subtitel van het diagram (ondersteunt de service com.sun.star.chart.ChartTitle)
HasLegend (Boolean)
activeert de legenda
Legend (Object)
object met gedetailleerde informatie over de legenda van het diagram (ondersteunt de service com.sun.star.chart.ChartLegend)

Beide services com.sun.star.chart.ChartTitle en com.sun.star.chart.ChartLegend ondersteunen de service com.sun.star.drawing.Shape. Dit maakt het mogelijk om de positie en grootte van de elementen te bepalen met behulp van de eigenschappen Position en Size. Omdat de grootte van de legenda en de titels automatisch wordt berekend gebaseerd op de huidige inhoud en bijvoorbeeld de hoogte van de tekens, verschaft de eigenschap size alleen toegang om te lezen.

Eigenschappen voor vulling en lijnen (services com.sun.star.drawing.FillProperties en com.sun.star.drawing.LineProperties) net als eigenschappen voor tekens (service com.sun.star.style.CharacterProperties) worden verschaft voor het verder opmaken van de elementen.

com.sun.star.chart.ChartTitle bevat niet alleen de opgesomde eigenschappen voor opmaak, maar ook twee andere eigenschappen:

String (String)
tekst welke moet worden getoond als de titel of subtitel
TextRotation (Long)
draaihoek van de tekst in 100-en van graden

De legenda (com.sun.star.chart.ChartLegend) bevat de volgende aanvullende eigenschap:

Alignment (Enum)
positie waar de legenda moet verschijnen (waarde van het type com.sun.star.chart.ChartLegendPosition)

Het volgende voorbeeld maakt een diagram en wijst daar de titel "Test", de subtitel "Test 2" en een legenda aan toe. De legenda heeft een grijze achtergrondkleur, staat aan de onderzijde van het diagram en heeft een tekengrootte van 7 punten.

Dim Doc As Object
Dim Diagrammen As Object
Dim Diagram as Object
Dim Recht As New com.sun.star.awt.Rectangle
Dim CelBereik(0) As New com.sun.star.table.CellRangeAddress
 
Recht.X = 8000
Recht.Y = 1000
Recht.Width = 10000
Recht.Height = 7000
CelBereik(0).Sheet = 0
CelBereik(0).StartColumn = 0 
CelBereik(0).StartRow = 0
CelBereik(0).EndColumn = 2
CelBereik(0).EndRow = 12
 
Doc = ThisComponent
 
Diagrammen = Doc.Sheets(0).Charts
Diagrammen.addNewByName("MijnDiagram", Recht, CelBereik(), True, True)
Diagram = Diagrammen.getByName("MijnDiagram").EmbeddedObject
Diagram.HasMainTitle = True
Diagram.Title.String = "Test"
Diagram.HasSubTitle = True
Diagram.Subtitle.String = "Test 2"
Diagram.HasLegend = True 
Diagram.Legend.Alignment = com.sun.star.chart.ChartLegendPosition.BOTTOM
Diagram.Legend.FillStyle = com.sun.star.drawing.FillStyle.SOLID
Diagram.Legend.FillColor = RGB(210, 210, 210)
Diagram.Legend.CharHeight = 7

Achtergrond

Elk diagram heeft een gedeelte voor de achtergrond. Het object Chart verschaft de eigenschap Area om de achtergrond op te maken:

Area (Object)
gebied voor de achtergrond van het diagram (ondersteunt de service com.sun.star.chart.ChartArea)

De achtergrond van een diagram beslaat zijn complete gebied, inclusief het gebied onder de titel, sub-titel en diagram-legenda. De geassocieerde service com.sun.star.chart.ChartArea ondersteunt eigenschappen voor lijn en vulling.

Diagram

Het object Chart verschaft de eigenschap Diagram die het coördinatensysteem vormt met assen en raster, waar de gegevens uiteindelijk wordne weergegeven:

Diagram (Object)
object dat het coördinatensysteem vormt waar de gegevens worden geplot. Het ondersteunt de service com.sun.star.chart.Diagram en:

verschillende services worden ondersteund, afhanbkelijk van het type diagram (zie Typen diagram).

Wanden en vloer

The chart wall is the background of the coordinate system where the data is plotted. Two chart walls usually exist for 3D charts: one behind the plotted data and one as the left-hand or right-hand demarcation. This depends on the rotation of the chart. 3D charts usually also have a floor.

The Diagram object provides the properties Wall and Floor:

Wall (Object)
background wall of the coordinate system (supports com.sun.star.chart.ChartArea service)
Floor (Object)
floor panel of coordinate system (only for 3D charts, supports com.sun.star.chart.ChartArea service)

The specified objects support the com.sun.star.chart.ChartArea service, which provides the usual fill and line properties (com.sun.star.drawing.FillProperties and com.sun.star.drawing.LineProperties services, refer to Drawings and Presentations).

The following example shows how graphics (named Sky) already contained in Apache OpenOffice can be used as a background for a chart. The wall is set to be blue.

Dim Doc As Object
Dim Charts As Object
Dim Chart as Object
Dim Rect As New com.sun.star.awt.Rectangle
Dim RangeAddress(0) As New com.sun.star.table.CellRangeAddress
 
Rect.X = 8000
Rect.Y = 1000
Rect.Width = 10000
Rect.Height = 7000
RangeAddress(0).Sheet = 0
RangeAddress(0).StartColumn = 0 
RangeAddress(0).StartRow = 0
RangeAddress(0).EndColumn = 2
RangeAddress(0).EndRow = 12
 
Doc = ThisComponent
 
Charts = Doc.Sheets(0).Charts
Charts.addNewByName("MyChart", Rect, RangeAddress(), True, True)
Chart = Charts.getByName("MyChart").EmbeddedObject
Chart.Area.FillStyle = com.sun.star.drawing.FillStyle.BITMAP
Chart.Area.FillBitmapName = "Sky"
Chart.Area.FillBitmapMode = com.sun.star.drawing.BitmapMode.REPEAT
 
Chart.Diagram.Wall.FillStyle = com.sun.star.drawing.FillStyle.SOLID
Chart.Diagram.Wall.FillColor = RGB(00,132,209)

Axes

Apache OpenOffice recognizes five different axes that can be used in a chart. In the simplest scenario, these are the X and Y-axes. When working with 3D charts, a Z-axis is also sometimes provided. For charts in which the values of the various rows of data deviate significantly from one another, Apache OpenOffice provides a second X and Y-axis for second scaling operations.

The Diagram object provides the following properties to access the axes:

HasXAxis (Boolean)
activates the X-axis
XAxis (Object)
object with detailed information about the X-axis (supports com.sun.star.chart.ChartAxis service)
HasXAxisDescription (Boolean)
activates the labels for the interval marks for the X-axis
HasYAxis (Boolean)
activates the Y-axis
YAxis (Object)
object with detailed information about the Y-axis (supports com.sun.star.chart.ChartAxis service)
HasYAxisDescription (Boolean)
activates the labels for the interval marks for the Y-axis
HasZAxis (Boolean)
activates the Z-axis
ZAxis (Object)
object with detailed information about the Z-axis (supports com.sun.star.chart.ChartAxis service)
HasZAxisDescription (Boolean)
activates the labels for the interval marks for the Z-axis
HasSecondaryXAxis (Boolean)
activates the secondary X-axis
SecondaryXAxis (Object)
object with detailed information about the secondary X-axis (supports com.sun.star.chart.ChartAxis service)
HasSecondaryXAxisDescription (Boolean)
activates the labels for the interval marks for the secondary X-axis
HasSecondaryYAxis (Boolean)
activates the secondary Y-axis
SecondaryYAxis (Object)
object with detailed information about the secondary Y-axis (supports com.sun.star.chart.ChartAxis service)
HasSecondaryYAxisDescription (Boolean)
activates the labels for the interval marks for the secondary Y-axis

Properties of Axes

The axis objects of a Apache OpenOffice chart support the com.sun.star.chart.ChartAxis service. In addition to the properties for characters (com.sun.star.style.CharacterProperties service, refer to Text Documents) and lines (com.sun.star.drawing.LineStyle service, refer to Drawings and Presentations), it provides the following properties:

Scaling properties:

Max (Double)
maximum value for axis
Min (Double)
minimum value for axis
Origin (Double)
point of intersect for crossing axes
StepMain (Double)
distance between the major interval marks
StepHelp (Double)
distance between the minor interval marks (deprecated since OpenOffice.org 3.0; Use property StepHelpCount instead)
StepHelpCount (Long)
Contains the number of minor intervals within a major interval. E.g. a StepHelpCount of 5 divides the major interval into 5 pieces and thus produces 4 minor tick marks. (available since OpenOffice.org 3.0)
AutoMax (Boolean)
the maximum value for the axis is calculated automatically when set to true
AutoMin (Boolean)
the minimum value for the axis is calculated automatically when set to true
AutoOrigin (Boolean)
the origin is determined automatically when set to true
AutoStepMain (Boolean)
StepMain is determined automatically when set to true
AutoStepHelp (Boolean)
StepHelpCount is determined automatically when set to true
Logarithmic (Boolean)
scales the axes in logarithmic manner (rather than linear)
ReverseDirection (Boolean)
determines if the axis orientation is mathematical or reversed. (available since OpenOffice.org 2.4)

Label properties:

DisplayLabels (Boolean)
activates the text label at the interval marks
TextRotation (Long)
angle of rotation of text label in 100ths of a degree
ArrangeOrder (enum)
the label may be staggered, thus they are positioned alternately over two lines (values according to com.sun.star.chart.ChartAxisArrangeOrderType)
TextBreak (Boolean)
permits line breaks within the axes labels
TextCanOverlap (Boolean)
permits an overlap of the axes labels
NumberFormat (Long)
number format to be used with the axes labels
LinkNumberFormatToSource (Boolean)
determines whether to use the number format given by the container document, or from the property NumberFormat. (since OpenOffice.org 2.3)

Interval mark properties:

Marks (Const)
determines the position of the major interval marks (values in accordance with com.sun.star.chart.ChartAxisMarks)
HelpMarks (Const)
determines the position of the minor interval marks (values in accordance with com.sun.star.chart.ChartAxisMarks)

Only for bar charts:

Overlap (Long)
percentage which specifies the extent to which the bars of different sets of data may overlap (at 100%, the bars are shown as completely overlapping, at -100%, there is a distance of the width of one bar between them)
GapWidth (long)
percentage which specifies the distance there may be between the different groups of bars of a chart (at 100%, there is a distance corresponding to the width of one bar)

Grids

For the primary axes grids and sub grids can be displayed, matching to the major and minor intervals. The Diagram object provides the following properties to access the grids:

HasXAxisGrid (Boolean)
activates major grid for X-axis
XMainGrid (Object)
object with detailed information about the major grid for X-axis (supports com.sun.star.chart.ChartGrid service)
HasXAxisHelpGrid (Boolean)
activates minor grid for X-axis
XHelpGrid (Object)
object with detailed information about the minor grid for X-axis (supports com.sun.star.chart.ChartGrid service)

the same for y and z:

HasYAxisGrid (Boolean)
activates major grid for Y-axis
YMainGrid (Object)
object with detailed information about the major grid for Y-axis (supports com.sun.star.chart.ChartGrid service)
HasYAxisHelpGrid (Boolean)
activates minor grid for Y-axis
YHelpGrid (Object)
object with detailed information about the minor grid for Y-axis (supports com.sun.star.chart.ChartGrid service)
HasZAxisGrid (Boolean)
activates major grid for Z-axis
ZMainGrid (Object)
object with detailed information about the major grid for Z-axis (supports com.sun.star.chart.ChartGrid service)
HasZAxisHelpGrid (Boolean)
activates minor grid for Z-axis
ZHelpGrid (Object)
object with detailed information about the minor grid for Z-axis (supports com.sun.star.chart.ChartGrid service)

The grid object is based on the com.sun.star.chart.ChartGrid service, which in turn supports the line properties of the com.sun.star.drawing.LineStyle support service (refer to Drawings and Presentations).

Axes Title

For all axes an additional title can be displayed. The Diagram object provides the following properties to access the axes title:

HasXAxisTitle (Boolean)
activates title of X-axis
XAxisTitle (Object)
object with detailed information about title of the X-axis (supports com.sun.star.chart.ChartTitle service)

same y and z:

HasYAxisTitle (Boolean)
activates title of Y-axis
YAxisTitle (Object)
object with detailed information about title of the Y-axis (supports com.sun.star.chart.ChartTitle service)
HasZAxisTitle (Boolean)
activates title of Z-axis
ZAxisTitle (Object)
object with detailed information about title of the Z-axis (supports com.sun.star.chart.ChartTitle service)

and for the secondary axes (available since OpenOffice.org 3.0):

HasSecondaryXAxisTitle (Boolean)
activates title of the secondary X-axis.
SecondXAxisTitle (Object)
object with detailed information about title of the secondary X-axis (supports com.sun.star.chart.ChartTitle service)
HasSecondaryYAxisTitle (Boolean)
activates title of the secondary Y-axis.
SecondYAxisTitle (Object)
object with detailed information about title of the secondary Y-axis (supports com.sun.star.chart.ChartTitle service)

The objects for formatting the axes title are based on the com.sun.star.chart.ChartTitle service, which is also used for chart titles.

Example

The following example creates a line chart. The color for the rear wall of the chart is set to white. Both the X and Y-axes have a gray grid for visual orientation. The minimum value of the Y-axis is fixed to 0 and the maximum value is fixed to 100 so that the resolution of the chart is retained even if the values are changed. The X-axis points in reverse direction from right to left. And a title for the X-axis was added.

Dim Doc As Object
Dim Charts As Object
Dim Chart as Object
Dim Rect As New com.sun.star.awt.Rectangle
Dim RangeAddress(0) As New com.sun.star.table.CellRangeAddress
 
Doc = ThisComponent
Charts = Doc.Sheets(0).Charts
 
Rect.X = 8000
Rect.Y = 1000
Rect.Width = 10000
Rect.Height = 7000
RangeAddress(0).Sheet = 0
RangeAddress(0).StartColumn = 0 
RangeAddress(0).StartRow = 0
RangeAddress(0).EndColumn = 2
RangeAddress(0).EndRow = 12
 
Charts.addNewByName("MyChart", Rect, RangeAddress(), True, True)
Chart = Charts.getByName("MyChart").embeddedObject
Chart.Diagram = Chart.createInstance("com.sun.star.chart.LineDiagram")
Chart.Diagram.Wall.FillColor = RGB(255, 255, 255)
Chart.Diagram.HasXAxisGrid = True
Chart.Diagram.XMainGrid.LineColor = RGB(192, 192, 192)
Chart.Diagram.HasYAxisGrid = True
Chart.Diagram.YMainGrid.LineColor = RGB(192, 192, 192)
Chart.Diagram.YAxis.Min = 0 
Chart.Diagram.YAxis.Max = 100
 
Chart.Diagram.XAxis.ReverseDirection = true 'needs OpenOffice.org 2.4 or newer
Chart.Diagram.HasXAxisTitle = true
Chart.Diagram.XAxisTitle.String = "Reversed X Axis Example"

3D Charts

Most charts in Apache OpenOffice can also be displayed with 3D graphics. The following properties are provided for 3D charts at the Diagram object:

Dim3D (Boolean)
activates 3D display
Deep (Boolean)
the series will be arranged behind each other in z-direction
RightAngledAxes (Boolean)
activates a 3D display mode where X- and Y-axes form a right angle within the projection. (available since OpenOffice.org 2.3)
D3DScenePerspective (Enum)
defines whether the 3D objects are to be drawn in perspective or parallel projection.(values according to com.sun.star.drawing.ProjectionMode)
Perspective (Long)
Perspective of 3D charts ( [0,100] ) (available since OpenOffice.org 2.4.1)
RotationHorizontal (Long)
Horizontal rotation of 3D charts in degrees ( [-180,180] ) (available since OpenOffice.org 2.4.1)
RotationVertical (Long)
Vertical rotation of 3D charts in degrees ( [-180,180] ) (available since OpenOffice.org 2.4.1)

The following example creates a 3D area chart.

Dim Doc As Object
Dim Charts As Object
Dim Chart as Object
Dim Rect As New com.sun.star.awt.Rectangle
Dim RangeAddress(0) As New com.sun.star.table.CellRangeAddress
 
Doc = ThisComponent
Charts = Doc.Sheets(0).Charts
 
Rect.X = 8000
Rect.Y = 1000
Rect.Width = 10000
Rect.Height = 7000
RangeAddress(0).Sheet = 0
RangeAddress(0).StartColumn = 0 
RangeAddress(0).StartRow = 0
RangeAddress(0).EndColumn = 2
RangeAddress(0).EndRow = 12
 
Charts.addNewByName("MyChart", Rect, RangeAddress(), True, True)
Chart = Charts.getByName("MyChart").embeddedObject
Chart.Diagram = Chart.createInstance("com.sun.star.chart.AreaDiagram")
Chart.Diagram.Dim3D = true
Chart.Diagram.Deep = true
Chart.Diagram.RightAngledAxes = true 'needs OpenOffice.org 2.3 or newer
Chart.Diagram.D3DScenePerspective = com.sun.star.drawing.ProjectionMode.PERSPECTIVE
Chart.Diagram.Perspective = 100 'needs OpenOffice.org 2.4.1 or newer
Chart.Diagram.RotationHorizontal = 60 'needs OpenOffice.org 2.4.1 or newer
Chart.Diagram.RotationVertical = 30 'needs OpenOffice.org 2.4.1 or newer

Stacked Charts

Stacked charts are charts that are arranged with several individual values on top of one another to produce a total value. This view shows not only the individual values, but also an overview of all the values.

In Apache OpenOffice, various types of charts can be displayed in a stacked form. All of these charts support the com.sun.star.chart.StackableDiagram service, which in turn provides the following properties:

Stacked (Boolean)
activates the stacked viewing mode
Percent (Boolean)
rather than absolute values, displays their percentage distribution


Content on this page is licensed under the Public Documentation License (PDL).
Personal tools