JavaScript/jQuery Chart - OData Service

To bind the Chart to data provided by an OData service, use the ODataStore.

index.js
  • $(function() {
  • $("#chartContainer").dxChart({
  • dataSource: new DevExpress.data.DataSource({
  • store: {
  • type: 'odata',
  • url: 'https://www.example.com/dataservices/odata/targetData',
  • key: 'Id'
  • },
  • paginate: false
  • }),
  • // ...
  • });
  • });

As you may notice, in the previous code, the ODataStore is not declared explicilty. Instead, it is wrapped in the DataSource instance. That is because the Chart requires pagination to be off in order to prevent data from partitioning. Other than that, the DataSource provides wide data-processing capabilities. For example, it can filter data.

index.js
  • $(function() {
  • $("#chartContainer").dxChart({
  • dataSource: new DevExpress.data.DataSource({
  • store: {
  • type: 'odata',
  • url: 'https://www.example.com/dataservices/odata/targetData',
  • key: 'Id'
  • },
  • paginate: false,
  • // Take summer months only
  • filter: [
  • ['Id', '>=', 6],
  • ['Id', '<=', 8]
  • ]
  • }),
  • // ...
  • });
  • });

View Demo

See Also