All docs
V21.1
24.2
The page you are viewing does not exist in version 24.2.
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
The page you are viewing does not exist in version 18.2.
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.
A newer version of this page is available. Switch to the current version.

JavaScript/jQuery Chart - JSON Data

To bind the Chart to data in a JSON format, assign the data's URL to the dataSource property.

jQuery
index.js
$(function() {
    $("#chartContainer").dxChart({
        dataSource: "http://www.example.com/dataservices/data.json",
        // ...
    });
});
Angular
app.component.html
app.module.ts
<dx-chart dataSource="http://www.example.com/dataservices/data.json">
    <!-- ... -->
</dx-chart>
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxChartModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxChartModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxChart data-source="http://www.example.com/dataservices/data.json">
        <!-- ... -->
    </DxChart>
</template>

<script>
import DxChart from 'devextreme-vue/chart';

export default {
    components: {
        DxChart
    },
    data() {
        return {
            // ...
        }
    }
}
</script>
React
App.js
import Chart from 'devextreme-react/chart';

export default function App() {
    return (
        <Chart dataSource="http://www.example.com/dataservices/data.json">
            {/* ... */}
        </Chart>
    );
}

Note that you can also use a JSONP callback parameter supported by jQuery.ajax().

jQuery
index.js
$(function() {
    $("#chartContainer").dxChart({
        dataSource: "http://www.example.com/dataservices/jsonpdata?callback=?",
        // ...
    });
});
Angular
app.component.html
app.module.ts
<dx-chart dataSource="http://www.example.com/dataservices/jsonpdata?callback=?">
    <!-- ... -->
</dx-chart>
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxChartModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxChartModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxChart data-source="http://www.example.com/dataservices/jsonpdata?callback=?">
        <!-- ... -->
    </DxChart>
</template>

<script>
import DxChart from 'devextreme-vue/chart';

export default {
    components: {
        DxChart
    },
    data() {
        return {
            // ...
        }
    }
}
</script>
React
App.js
import Chart from 'devextreme-react/chart';

export default function App() {
    return (
        <Chart dataSource="http://www.example.com/dataservices/jsonpdata?callback=?">
            {/* ... */}
        </Chart>
    );
}

If you need to process data after obtaining it, implement the CustomStore. For details, see the Custom Sources topic.

View Demo

See Also