Chart Service XML metadata Configuration

How does openbiz draw chart?

BizForm::CallService(chartService,render)

---> chartService::render($bizform, $inputDataStr)

     ---> read chart xml file "bizform_chart.xml"

     ---> get the chart data from bizform->bizobj

     ---> draw chart by calling jpgraph APIs


Draw X-Y Chart

X-Y chart has X axis and Y axis. The GraphType attribute is "XY" <Chart Name="AAA" GraphType="XY" ...>. 

General Elements of X-Y charts

Special Elements and Attributes of different chart types


Draw Pie Chart

Pie chart does not have X axis and Y axis. The GraphType attribute is "Pie" <Chart Name="AAA" GraphType="Pie" ...>. 

General Elements of Pie charts

Special Elements and Attributes of different chart types


Explanation of attributes

Many elements and attributes are easy to understand, but others need some explanation as shown in the table below.

Attribute(s) Description Sample
<Chart Margin=""/> Define the margin (left, right,top,bottom) of a chart Margin="60,30,30,80"
<Xaxis LabelField=""/> Define which BizObj field to provide labels of x-axis  LabelField="Donation"
<Xaxis LabelAngle=""/> Define the angle of labels of x-axis LabelAngle="30"
<... Font=""> Define the font, font style and font size. Now support
Arial, Courier, Times, Verdana, Comic, Geogia
Font="Arial,Bold,16"
<... Color=""/>
<... FillColor=""/>
Define the color and fill color with Named color or HEX color code  Color="blue"
FillColor="#A16BFF"
<Legend Position=""/> Define the position of legend box. Format as aX,aY,aHAlign,aVAlign. aX is the fraction of graph width, aY is the fraction of graph height, aHAlign ('left','right','center') is the horizontal legend alignment, aVAlign ('bottom','top','center') is the vertical legend alignment Position="0.05,0.1,right,top"
<Legend Layout=""/> Define the layout of the legend items. HOR or VERT Layout="VERT"
<Data ChartType=""/> Define the chart type. Line, Bar, GroupBar, AccBar, Pie, Pie3D ChartType="Line"
<Data Field=""/> Define the field name of the BizObj. The chart data is from this field Field="Donation"
<Data LegendField=""/> Define which BizObj field to provide legend strings  LegendField="Name"
<Data Visible=""/> Define whether this chart is displayed or not. Value is 0 or 1 Visible="1"
<Data Children=""/> Define the child chart ids. Format is Children="id1,id2". GroupBar and AccBar can have this attribute Children="bar1,bar2"
<DataPie Size=""/> If the value specified is between 0 and 1 then it is interpreted as a a fraction of either height or width, whatever is smallest, of the graph.
If the value is >1 then it is interpreted as an absolute size in pixels.
Size="0.3"
Size="200"
<Data Weight=""/> Specify the thickness of the chart in pixels  Center="0.4,0.5"
<DataPie Center=""/> Set the center point for the Pie chart Center="0.4,0.5"
<DataPie Height=""/> Specify thickness of 3D pie plot Height="15"
<DataPie Angle=""/> Specify projection angle for 3D in degrees Angle="30"
<DataPie LabelPos=""/> Specify the position of the labels for each slice as a fraction of the radius LabelPos="0.6"
<PointMark Type=""/> Define the Line Point Marks types. Now support Square, Utriangle, Dtriangle, Diamond, Circle, FilledCircle, Cross, Star, X Type="Circle"

DTD of BizForm_Chart xml file

<!ELEMENT BizFormChart (ChartList) >
<!ATTLIST BizFormChart  Name            CDATA  #REQUIRED >
<!ATTLIST BizFormChart  BizForm         CDATA  #REQUIRED >

<!ELEMENT ChartList  (Chart+) >
<!ELEMENT Chart (Title, Xaxis?, Yaxis?, DataSet, Legend) >
<!ATTLIST Chart    Name                 CDATA  #REQUIRED >
<!ATTLIST Chart    GraphType            CDATA  #REQUIRED >
<!ATTLIST Chart    Width                CDATA  #REQUIRED >
<!ATTLIST Chart    Height               CDATA  #REQUIRED >
<!ATTLIST Chart    Margin               CDATA  #IMPLIED >

<!ELEMENT Title EMPTY >
<!ATTLIST Title    Caption              CDATA  #REQUIRED >
<!ATTLIST Title    Font                 CDATA  #IMPLIED >
<!ATTLIST Title    Color                CDATA  #IMPLIED >

<!ELEMENT Xaxis EMPTY >
<!ATTLIST Xaxis    Font                 CDATA  #IMPLIED >
<!ATTLIST Xaxis    Color                CDATA  #IMPLIED >
<!ATTLIST Xaxis    LabelField           CDATA  #IMPLIED >
<!ATTLIST Xaxis    LabelAngle           CDATA  #IMPLIED >
<!ATTLIST Xaxis    Title                CDATA  #IMPLIED >
<!ATTLIST Xaxis    TitleFont            CDATA  #IMPLIED >
<!ATTLIST Xaxis    TitleMargin          CDATA  #IMPLIED >

<!ELEMENT Yaxis EMPTY >
<!ATTLIST Yaxis    Font                 CDATA  #IMPLIED >
<!ATTLIST Yaxis    Color                CDATA  #IMPLIED >
<!ATTLIST Yaxis    LabelField           CDATA  #IMPLIED >
<!ATTLIST Yaxis    LabelAngle           CDATA  #IMPLIED >
<!ATTLIST Yaxis    Title                CDATA  #IMPLIED >
<!ATTLIST Yaxis    TitleFont            CDATA  #IMPLIED >
<!ATTLIST Yaxis    TitleMargin          CDATA  #IMPLIED >

<!ELEMENT DataSet (Data?, DataPie?) >
<!ELEMENT Data (Value?, PointMark?)>
<!ATTLIST Data     ID                    CDATA  #REQUIRED >
<!ATTLIST Data     Field                 CDATA  #REQUIRED >
<!ATTLIST Data     ChartType             CDATA  #REQUIRED >
<!ATTLIST Data     Weight                CDATA  #IMPLIED >
<!ATTLIST Data     Color                 CDATA  #IMPLIED >
<!ATTLIST Data     FillColor             CDATA  #IMPLIED >
<!ATTLIST Data     ShowValue             CDATA  #IMPLIED >
<!ATTLIST Data     LegendField           CDATA  #IMPLIED >
<!ATTLIST Data     Children              CDATA  #IMPLIED >
<!ATTLIST Data     Visible               CDATA  #IMPLIED >

<!ELEMENT DataPie (Value?)>
<!ATTLIST DataPie  ID                    CDATA  #REQUIRED >
<!ATTLIST DataPie  Field                 CDATA  #REQUIRED >
<!ATTLIST DataPie  ChartType             CDATA  #REQUIRED >
<!ATTLIST DataPie  LegendField           CDATA  #IMPLIED >
<!ATTLIST DataPie  Size                  CDATA  #IMPLIED >
<!ATTLIST DataPie  Center                CDATA  #IMPLIED >
<!ATTLIST DataPie  Height                CDATA  #IMPLIED >
<!ATTLIST DataPie  Angle                 CDATA  #IMPLIED >
<!ATTLIST DataPie  LabelPos              CDATA  #IMPLIED >
<!ATTLIST DataPie  Visible               CDATA  #IMPLIED >

<!ELEMENT Value EMPTY >
<!ATTLIST Value    Font                  CDATA  #IMPLIED >
<!ATTLIST Value    Color                 CDATA  #IMPLIED >

<!ELEMENT PointMark EMPTY >
<!ATTLIST PointMark  Type                CDATA  #IMPLIED >
<!ATTLIST PointMark  Color               CDATA  #IMPLIED >
<!ATTLIST PointMark  FillColor           CDATA  #IMPLIED >
<!ATTLIST PointMark  Size                CDATA  #IMPLIED >

<!ELEMENT Legend EMPTY >
<!ATTLIST Legend    Position             CDATA  #IMPLIED >
<!ATTLIST Legend    Position             CDATA  #IMPLIED >
<!ATTLIST Legend    Layout               CDATA  #IMPLIED >
<!ATTLIST Legend    Font                 CDATA  #IMPLIED >
<!ATTLIST Legend    Color                CDATA  #IMPLIED >
<!ATTLIST Legend    FillColor            CDATA  #IMPLIED >