---
schema_version: "1"
id: 7273dead64b460617fdeac72d2ead64f1cfd0be2be34684ac4bb49b2236aee8f
title: Providing Chart Data via a JavaScript Array
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/charting/pages-charting-overview-providing-data-javascript-array.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-charting-overview-providing-data-javascript-array.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d74fc26dd2166bf774cf51ea557cece526307e728c6086a82e53b085a49b557e
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Providing Chart Data via a JavaScript Array

You can use Visualforce charting with non-Salesforce data sources by building a JavaScript array, in your own JavaScript code in your page, and providing the name of that array to `<apex:chart>`.

The following trivial code illustrates this technique:

```visualforce
<apex:page>
    <script>
    // Build the chart data array in JavaScript
    var dataArray = new Array();
    dataArray.push({'data1':33,'data2':66,'data3':80,'name':'Jan'});
    dataArray.push({'data1':33,'data2':66,'data3':80,'name':'Feb'});
    // ...
    </script>

    <apex:chart data="dataArray" ...></apex:chart>
</apex:page>
```

When using this technique, if your data is coming from a non-Salesforce source, you might not need any server-side Apex code at all.

**See Also**  


-   [Chart Data Format](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-charting-overview-providing-data-format.md)

