locked
ExpandoObject as DataSource for the ASP.Net Chart RRS feed

  • Question

  • User-1367238894 posted

    Hi guys ...

    I an trying to draw a customized graph using asp.Net.

    But i stuck at the end.

    Here i am trying to assign a list of expando object as the data source for the chart.

    It throws an exception of "System.ArgumentException: Series data points do not support values of type System.Dynamic.ExpandoObject only values of these types can be used: Double, Decimal, Single, int, long, uint, ulong, String, DateTime, short, ushort." at the time of chart binding.

    when i am using the predefined class it works well there.

    but i need to use Expando Object for customization

    Do the need full to get out from there :)

    Saturday, March 22, 2014 1:13 AM

Answers

  • User1208776063 posted

    Here i am trying to assign a list of expando object as the data source for the chart.

    AFAIK, you will not be able to use list of ExpandoObjects to bind the chart.  XAxis and YAxis values can only take primitive data types (such as String, Boolean, Int32, and so on).  You need to bind the chart with valid datasource and save list of dynamic objects in ViewState. Use Chart Databound event to access the list from viewstate again and apply customizations. You can use LINQ to query the dynamic list based on a key/value from ChartSeries.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 22, 2014 3:31 AM