PieChart only shows NaN?

I am trying to implement a pieChart to our main page which will present the amount of times a city is used in the different addresses. For now, there are 3 different citys present but the chart does not show up and the legend only says NaN. It does however show that there are 3 datavalues. Can anyone tell me what i am doing wrong?

Datasource:

<dsContext>
        <valueCollectionDatasource id="cityDs">
            <query>
                <![CDATA[select a.city, count(a.city)
from hrtrainingplatform$Address a
group by a.city]]>
            </query>
            <properties>
                <property datatype="long"
                          name="count"/>
            </properties>
        </valueCollectionDatasource>
    </dsContext>

Chart:

<chart:pieChart id="cityChart"
                datasource="cityDs"
                height="200px"
                titleField="city"
                valueField="count"
                width="48%">
    <chart:legend autoMargins="false"
                    marginRight="80"
                    markerType="CIRCLE"
                    position="RIGHT"/>
    <chart:balloon fixedPosition="true"/>
    <chart:export/>
</chart:pieChart>

Result:
NaN chart

Hi,

You’ve not defined second property in your valueCollectionDatasource. Add one more property definition for city to the first position.

        <valueCollectionDatasource id="cityDs">
            <query>
                <![CDATA[select a.city, count(a.city)
from hrtrainingplatform$Address a
group by a.city]]>
            </query>
            <properties>
                <property datatype="string"
                          name="city"/>
                <property datatype="long"
                          name="count"/>
            </properties>
        </valueCollectionDatasource>
1 Like

This has done the trick, thank you very much!