Currently looking at Providing Chart Data via a JavaScript Array

As per the example, data is embedded and returned by the JavaScript's dataArray property.

However, the chart does not seem to do anything with the data.

Here is my VisualForce page:

    <apex:page >
        // Build the chart data array in JavaScript
        var dataArray = [
    <apex:chart height="350" width="450" data="dataArray">
        <apex:pieSeries dataField="data" labelField="name" />
        <apex:legend position="right" />

What am I missing?

1 Answer 1


The apex:pieSeries renders a single set of values where each value can have a label. So this will render:

var dataArray = [
        {'data':33, 'name':'Jan'},
        {'data':66, 'name':'Feb'},
        {'data':80, 'name':'Mar'}

If you want multiple values at per label you will need to use e.g. a bar chart where a comma-separated list of JSON field names are supported.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .