1.5.3.1.1. Screen XML Descriptor
Open the Screens tab in CUBA Studio and create a screen in the web module. Enter the value com/company/sampler/web/screens/stackedarea-chart.xml in the Descriptor field. The fields - Id, Controller Name and Messages Pack will be filled in with appropriate values. Save changes. Open the XML tab and replace its content with the following code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        caption="msg://caption"
        class="com.company.sampler.web.screens.StackedAreaChart"
        messagesPack="com.company.sampler.web.screens"
        xmlns:chart="http://schemas.haulmont.com/charts/charts.xsd">
    <layout>
        <chart:serialChart id="chart"
                           categoryField="year"
                           height="100%"
                           marginLeft="0"
                           marginTop="10"
                           plotAreaBorderAlpha="0"
                           width="100%">
            <chart:chartCursor cursorAlpha="0"/>
            <chart:legend equalWidths="false"
                          periodValueText="total: [[value.sum]]"
                          position="TOP"
                          valueAlign="LEFT"
                          valueWidth="100"/>
            <chart:valueAxes>
                <chart:axis gridAlpha="0.07"
                            position="LEFT"
                            stackType="REGULAR"
                            title="Traffic incidents"/>
            </chart:valueAxes>
            <chart:graphs>
                <chart:graph fillAlphas="0.6"
                             hidden="true"
                             lineAlpha="0.4"
                             title="Cars"
                             valueField="cars"/>
                <chart:graph fillAlphas="0.6"
                             lineAlpha="0.4"
                             title="Motorcycles"
                             valueField="motorcycles"/>
                <chart:graph fillAlphas="0.6"
                             lineAlpha="0.4"
                             title="Bicycles"
                             valueField="bicycles"/>
            </chart:graphs>
            <chart:categoryAxis axisColor="#DADADA"
                                gridAlpha="0.07"
                                startOnAxis="true"/>
            <chart:export/>
        </chart:serialChart>
    </layout>
</window>The root element of the screen descriptor contains a new xmlns:chart attribute:
<window xmlns:chart="http://schemas.haulmont.com/charts/charts.xsd"
    ...
>chart:serialChart attributes:
-  categoryField- a key from the set of pairs contained in theDataItemobjects listed in aDataProviderinstance; this key is used to determine the labels for the category axis.
The elements of chart:serialChart:
-  chart:chartCursor- an optional element adding a cursor to the chart; the cursor follows the mouse pointer and shows a tooltip with the value of the corresponding point on a chart.-  The cursorAlphaattribute defines opacity of the cursor line.
 
-  
-  chart:legend- an element that defines the chart legend.-  The positionattribute defines the location of the legend relative to the chart.
-  The equalWidthsattribute specifies if each of legend entry should be equal to the most wide entry.
-  The periodValueTextattribute defines the text which will be displayed in the value portion of the legend when user is not hovering above any data point. The tags should be made out of two parts - the name of a field (value / open / close / high / low) and the value of the period you want to be show - open / close / high / low / sum / average / count.
-  The valueAlignattribute defines alignment of the value text. Possible values are "left" and "right".
-  The valueWidthattribute defines width of the value text.
 
-  
-  chart:valueAxes- an element that defines vertical value axes. In our case, only one vertical axis is used; the axis is described by thechart:axiselement.-  The positionattribute defines position of the value axis relative to the chart.
-  The titleattribute defines the title of the value axis.
-  Setting stackTypetoREGULARmakes the chart display a rolling value. Setting this attribute tononerefers to a non-rolling value.
-  The gridAlphadefines opacity of grid lines.
 
-  
-  chart:graphs- an element that contains the collection ofchart:graphelements; the graph is described by thechart:graphelement.-  The typeattribute defines the type of the graph and can be: line, column, step line, smoothed line, olhc and candlestick.
-  The valueFieldattribute defines a key from the list of pairs contained in theDataItemobjects listed in aDataProviderinstance; this key is used to determine the value.
-  The fillAlphasattribute defines opacity of fill.
-  The lineAlphaattribute defines opacity the line (or column border). Value range is 0 - 1.
-  The hiddenattribute specifies whether the graph is hidden.
 
-  
-  chart:categoryAxis- an element that describes the category axis.-  Setting startOnAxistotruecauses drawing the chart right from the value axis. The default value for this attribute isfalse. In this case, there will be a small gap between the value axis and the chart.
-  The gridAlphaattribute defines opacity of grid lines.
-  The axisColorattribute defines axis color.
 
-  
-  chart:export– an optional element that enables chart export.