We are using an API call to populate an igDataChart. So we set the chart properties something like the following when instantiating.
dataSourceType: "remoteUrl", dataSource: "/someapi",
Later we may have to do this at the series level.
Regardless, we need to access the array object containing the data returned to the chart by the API. I can't find a property, method, or event that permits doing that.
How can this be accomplished?
Hello Ray,
I believe you will find the following properties helpful for achieving your requirement:
var series = $(".selector").igDataChart("option", "series"); series[0].dataSource;
Reference
var dataSource = $(".selector").igDataChart("option", "dataSource");
If this isn’t what you are looking for, can you please provide me with some additional information regarding your requirement or a small, ready-to run sample that I can run and debug on my side? Please remove all code that is not directly related to the issue and all external dependencies. Having such a sample will give me the opportunity to investigate this matter faster and provide you with solution as soon as possible.
Looking forward to hearing from you.
Best Regards,
Martin Evtimov
Unfortunately, neither option provides what I need. I've attached a sample chart that retrieves data from an API. The data doesn't mean anything and I just found a free API I could call to get data. We use igLoader, but had to point to my local resources to test. Hopefully you can point to your own resources.
The command to get the dataSource just returns the API I defined, not the actual data used to populate the chart.GetDatasource.zip
By design, if an instance of igDataSource is used as an underlying data source of the chart you can take advantage of the dataView() method, which returns the current data. For example:
refreshCompleted: function (evt, ui) { if (ui.chart.gridAreaRect) { var ds = ui.chart.dataSource.dataView(); } },
Attached you will find a sample illustrating my suggestion for your reference.
As an alternative, the data can be retrieved via using a private property of the chart`s data source - _data. For example:
$("#columnChart").data("igDataChart").dataSources.columnChart._data;
Please note that using private properties is associated with a certain risk. Basically, this means a change in our source code, that can affect this property, can be made without any public notice.
Please let me know if you need any further assistance with this matter.
8255.GetDatasource2.zip
I'm glad that you found my suggestion helpful.
Thank you for choosing Infragistics components.
Martin
Thank you. Using igDataSource seemed like the best idea.