Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2515
How to access data in igDataChart
posted

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?

Parents Reply
  • 720
    Verified Answer
    Offline posted in reply to Ray Webb

    Hello Ray,

    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.

    Best Regards,

    Martin Evtimov

    8255.GetDatasource2.zip

Children