We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Create a pie chart from a remote datasource

I have created a dataManager and used it to fill a grid with data.  Now, when I try to change the grid to a pie chart, I cannot get a chart to display.  I can't figure out how to get my json data from the dataManager into the pie chart. I have tried to initialize my pie chart like this:
chart = $("#chart").ejChart({
            title: { text: 'Top Ten Requests' },
            legend: { visible: true },
            series: [{
                type: 'pie',
                dataSource: dataManager,
                type: 'pie',
                xName: "Name",
                yName: "Requests",
                query: query
            }]
        });

The data returned from the datasource looks like this:
[{"Requests":65,"Name":"Alan's Agriculture","ExtraData":"Akron, OH"},{"Requests":14,"Name":"Bob's Borders and Edging","ExtraData":"Juneau, AK"}...]

3 Replies

SK Sanjith Kesavan Syncfusion Team September 11, 2015 01:54 PM UTC

Hi Davis Elies,
We have analyzed your query and replicated the scenario in our sample. But we are not able to reproduce the reported issue. We have prepared the sample based on your requirement. In the sample we have retrieved the data from the nortwnd service. Please find the below code example
Code example
[JS]
  
In the above code we have used a “query” to retrieve the data from the Northwnd service. Using “query”  we took 3 data from the Nortwnd and bind that data to the pie chart. “Query” is must to bind the data to chart using datamanager.


Please find the screenshot of the chart below.

Please find the sample from below mentioned location.
Sample Link: http://www.syncfusion.com/downloads/support/forum/120212/ze/export1425557291
Still you are facing this issue means please let us know by modifying the existing sample along with a replication procedure or send us the code example, that how are trying to retrieve data, with the query you have used in the chart.

Please let us know if you have any concern.

Regards,

Sanjith K.​



DE David Elies September 11, 2015 03:36 PM UTC

I'm sorry, I was using a custom OData4Adaptor in order to fix a different problem, and the response wasn't being properly formatted.  I got it working now.  I will post another question about how to get the excel and PDF exports working.


SK Sanjith Kesavan Syncfusion Team September 14, 2015 11:56 AM UTC

Hi David Elies,
Thanks for the update.
Regards,
Sanjith K.

Loader.
Up arrow icon