You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Working With Data in ##Platform_Name## Chart Component
4
-
description: Learn here all about Working With Data in Syncfusion ##Platform_Name## Chart component of Syncfusion Essential JS 2 and more.
3
+
title: Working with data in ##Platform_Name## Syncfusion Chart Component
4
+
description: Learn here all about Working with data in Syncfusion ##Platform_Name## Chart component of Syncfusion Essential JS 2 and more.
5
5
platform: ej2-asp-core-mvc
6
-
control: Working With Data
6
+
control: Working with data
7
7
publishingplatform: ##Platform_Name##
8
8
documentation: ug
9
9
---
10
10
11
11
12
12
<!-- markdownlint-disable MD036 -->
13
13
14
-
# Working with Data
14
+
# Working with data in ##Platform_Name## Chart Component
15
15
16
-
Chart can visualise data bound from local or remote data.
16
+
Chart can visualize data bound from local or remote data.
17
17
18
-
## Local Data
18
+
## Local data
19
19
20
-
You can bind a simple JSON data to the chart using [`DataSource`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_DataSource) property in series. Now map the fields in JSON to [`XName`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_XName) and [`YName`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_YName) properties.
20
+
You can bind a simple JSON data to the chart using [`DataSource`](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_DataSource) property in series. Now map the fields in JSON to [`XName`](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_XName) and [`YName`](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_YName) properties.
21
21
22
22
{% if page.publishingplatform == "aspnet-core" %}
23
23
@@ -44,9 +44,9 @@ You can bind a simple JSON data to the chart using [`DataSource`](https://help.s
44
44
45
45
46
46
47
-
### Common Datasource
47
+
### Common datasource
48
48
49
-
You can also bind a JSON data common to all series using [`DataSource`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_DataSource) property in chart.
49
+
You can also bind a JSON data common to all series using [`DataSource`](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_DataSource) property in chart.
50
50
51
51
{% if page.publishingplatform == "aspnet-core" %}
52
52
@@ -73,9 +73,9 @@ You can also bind a JSON data common to all series using [`DataSource`](https://
73
73
74
74
75
75
76
-
## Remote Data
76
+
## Remote data
77
77
78
-
You can also bind remote data to the chart using `DataManager`. The DataManager requires minimal information like webservice URL, adaptor and crossDomain to interact with service endpoint properly. Assign the instance of DataManager to the [`DataSource`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_DataSource) property in series and map the fields of data to [`XName`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_XName) and [`YName`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_YName) properties. You can also use the [`Query`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_Query) property of the series to filter the data.
78
+
You can also bind remote data to the chart using `DataManager`. The DataManager requires minimal information like webservice URL, adaptor and crossDomain to interact with service endpoint properly. Assign the instance of DataManager to the [`DataSource`](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_DataSource) property in series and map the fields of data to [`XName`](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_XName) and [`YName`](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_YName) properties. You can also use the [`Query`](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Charts.ChartSeries.html#Syncfusion_EJ2_Charts_ChartSeries_Query) property of the series to filter the data.
79
79
80
80
{% if page.publishingplatform == "aspnet-core" %}
81
81
@@ -102,6 +102,162 @@ You can also bind remote data to the chart using `DataManager`. The DataManager
102
102
103
103
104
104
105
+
## Binding data using ODataAdaptor
106
+
107
+
[`OData`](http://www.odata.org/documentation/odata-version-3-0/) is a standardized protocol for creating and consuming data. You can retrieve data from an OData service using the DataManager. Refer to the following code example for remote data binding using an OData service.
108
+
109
+
{% if page.publishingplatform == "aspnet-core" %}
110
+
111
+
{% tabs %}
112
+
{% highlight cshtml tabtitle="CSHTML" %}
113
+
{% include code-snippet/chart/axis/working-data/odata-adaptor/tagHelper %}
114
+
{% endhighlight %}
115
+
{% highlight c# tabtitle="Odata-adaptor.cs" %}
116
+
{% include code-snippet/chart/axis/working-data/odata-adaptor/odata-adaptor.cs %}
{% include code-snippet/chart/axis/working-data/odata-adaptor/razor %}
125
+
{% endhighlight %}
126
+
{% highlight c# tabtitle="Odata-adaptor.cs" %}
127
+
{% include code-snippet/chart/axis/working-data/odata-adaptor/odata-adaptor.cs %}
128
+
{% endhighlight %}
129
+
{% endtabs %}
130
+
{% endif %}
131
+
132
+
133
+
134
+
## Binding data using ODataV4Adaptor
135
+
136
+
ODataV4 is an improved version of the OData protocols, and the `DataManager` can also retrieve and consume ODataV4 services. For more details on ODataV4 services, refer to the [`odata documentation`](http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part1-protocol/odata-v4.0-errata03-os-part1-protocol-complete.html#_Toc453752197). To bind an ODataV4 service, use the **ODataV4Adaptor**.
137
+
138
+
{% if page.publishingplatform == "aspnet-core" %}
139
+
140
+
{% tabs %}
141
+
{% highlight cshtml tabtitle="CSHTML" %}
142
+
{% include code-snippet/chart/axis/working-data/odatav4-adaptor/tagHelper %}
143
+
{% endhighlight %}
144
+
{% highlight c# tabtitle="Odatav4-adaptor.cs" %}
145
+
{% include code-snippet/chart/axis/working-data/odatav4-adaptor/odatav4-adaptor.cs %}
{% include code-snippet/chart/axis/working-data/web-adaptor/razor %}
183
+
{% endhighlight %}
184
+
{% highlight c# tabtitle="Web-adaptor.cs" %}
185
+
{% include code-snippet/chart/axis/working-data/web-adaptor/web-adaptor.cs %}
186
+
{% endhighlight %}
187
+
{% endtabs %}
188
+
{% endif %}
189
+
190
+
The response object should contain the properties **Items** and **Count**, where **Items** represents a collection of entities, and **Count** represents the total number of entities.
191
+
192
+
The sample response object should appear as follows:
193
+
194
+
```
195
+
{
196
+
Items: [{..}, {..}, {..}, ...],
197
+
Count: 830
198
+
}
199
+
```
200
+
201
+
202
+
203
+
## Custom adaptor
204
+
205
+
You can create your own adaptor by extending the built-in adaptors. The following demonstrates the custom adaptor approach and how to add a serial number to the records by overriding the built-in response processing using the **processResponse** method of the **ODataAdaptor**.
206
+
207
+
{% if page.publishingplatform == "aspnet-core" %}
208
+
209
+
{% tabs %}
210
+
{% highlight cshtml tabtitle="CSHTML" %}
211
+
{% include code-snippet/chart/axis/working-data/custom-adaptor/tagHelper %}
212
+
{% endhighlight %}
213
+
{% highlight c# tabtitle="Custom-adaptor.cs" %}
214
+
{% include code-snippet/chart/axis/working-data/custom-adaptor/custom-adaptor.cs %}
{% include code-snippet/chart/axis/working-data/custom-adaptor/razor %}
223
+
{% endhighlight %}
224
+
{% highlight c# tabtitle="Custom-adaptor.cs" %}
225
+
{% include code-snippet/chart/axis/working-data/custom-adaptor/custom-adaptor.cs %}
226
+
{% endhighlight %}
227
+
{% endtabs %}
228
+
{% endif %}
229
+
230
+
231
+
232
+
## Offline mode
233
+
234
+
When using remote data binding, all chart actions will be processed on the server-side. To avoid postback for every action, configure the chart to load all data upon initialization and handle actions on the client-side. To enable this behavior, utilize the **offline** property of the `DataManager`.
235
+
236
+
{% if page.publishingplatform == "aspnet-core" %}
237
+
238
+
{% tabs %}
239
+
{% highlight cshtml tabtitle="CSHTML" %}
240
+
{% include code-snippet/chart/axis/working-data/offline-mode/tagHelper %}
241
+
{% endhighlight %}
242
+
{% highlight c# tabtitle="Offline-mode.cs" %}
243
+
{% include code-snippet/chart/axis/working-data/offline-mode/offline-mode.cs %}
{% include code-snippet/chart/axis/working-data/offline-mode/razor %}
252
+
{% endhighlight %}
253
+
{% highlight c# tabtitle="Offline-mode.cs" %}
254
+
{% include code-snippet/chart/axis/working-data/offline-mode/offline-mode.cs %}
255
+
{% endhighlight %}
256
+
{% endtabs %}
257
+
{% endif %}
258
+
259
+
260
+
105
261
## Empty points
106
262
107
263
The Data points that uses the `null` or `undefined` as value are considered as empty points. Empty data points are ignored and not plotted in the Chart. When the data is provided by using the points property, By using `EmptyPointSettings` property in series, you can customize the empty point. Default `Mode` of the empty point is `Gap`.
@@ -186,3 +342,4 @@ Specific color for empty point can be set by `Fill` property in `EmptyPointSetti
0 commit comments