How can I set the arrow value for a Gauge from a Data Source?

I’m trying to create a Gauge Chart to display the average value from a list of entitities using a datasource like this:

        <valueCollectionDatasource id="testDs"
                <![CDATA[SELECT AVG(a.porcentajeAvance) as avgAmount FROM planmejoramiento$Accion a]]>
                <property datatype="double"

The documentation states that the arrow is displayed using this XML tag:

    <chart:arrow value="60"/>

But it doesn’t mention how to take the value from a datasource. I tried using the property name of the datasource but it gives an error

    <chart:arrow value="avgAmount"/>

Any clue that can help me to achieve this?


Gauge arrow doesn’t allow datasource binding, i.e. there is no valueField that can be assigned to an entity attribute. The only way is to set sxavalue either in XML to some constant or programmatically in the screen controller, for instance:

private CollectionDatasource<KeyValueEntity, Object> testDs;
private AngularGaugeChart gaugeChart;

public void init(Map<String, Object> params) {
    // We only have one value as we use maxResults="1"
    KeyValueEntity value = testDs.getItems().iterator().next();
    // We only have one arrow
    GaugeArrow gaugeArrow = gaugeChart.getArrows().get(0);