Databound source - Conditional item binding (and/or editing)

2 posts, 0 answers
  1. Wendelstam
    Wendelstam avatar
    48 posts
    Member since:
    Feb 2006

    Posted 21 Apr 2015 Link to this post

    I am porting an old applications chart section from RadChart to RadHtml chart and am struggeling with how to edit serie items prior to rendering. The main problem is that since we are binding against an list of objects where some integer properties contains -1 values (which in our context means NULL/UNDEFINED). I cannot change this behaviour of the object since the system heavily rely on that fact.

    When using RadChart we could "hook into" the series items in the ItemDataBound event. See example below.

    How can I achieve the same thing with RadHtmlChart ?



    var columnInfo = _basicReportsPresenter.GetColumnInfoByName(e.ChartSeries.DataYColumn);
    if (!columnInfo.ColumnInfoAttribute.DisplayNegativeValues)
        if (e.SeriesItem.YValue < 0)
            if (_enableEmptyValues)
                e.SeriesItem.Empty = true;
            e.SeriesItem.YValue = 0;

  2. Danail Vasilev
    Danail Vasilev avatar
    1502 posts

    Posted 23 Apr 2015 Link to this post

    Hi Johan,

    RadHtmlChart doesn't support a server-side ItemDataBound event because it renders entirely on the client-side. More information is available here -

    I can suggest that you try one of the following approaches:
        - Change the data source values prior to the data-binding on the server-side.
        - Change the data source on the client-side through the $find("RadHtmlChart1").get_dataSourceJSON() and $find("RadHtmlChart1").set_dataSource() methods. More information is available here -
        - Iterate through series and items on the client-side and change the corresponding values. You can access series items values like that:
    $find("RadHtmlChart1").get_kendoWidget().options.series[0].data[0].myDataSourceField= 10;

    Danail Vasilev

    See What's Next in App Development. Register for TelerikNEXT.

Back to Top