Anchor key, Href around a Donut series segment

4 posts, 1 answers
  1. Andrew
    Andrew avatar
    10 posts
    Member since:
    Aug 2019

    Posted 13 Aug Link to this post

    Is it Possible to wrap an anchor key(href) around a Donut series segment ?

     

  2. Answer
    Vessy
    Admin
    Vessy avatar
    2068 posts

    Posted 14 Aug Link to this post

    Hi Andrew,

    It is not possible to wrap an anchor around a Donut series, but you can handle the OnSeriesClick event and navigate to the desired URL depending on the series.name/series.data.

    For example, you can keep the desired urls into an additional dataField in the passed data source in a similar way:

     

            <telerik:RadHtmlChart ID="RadHtmlChart1" runat="server" Width="600">
                <ClientEvents OnSeriesClick="onSeriesClick" />
                <PlotArea>
                    <Series>
                        <telerik:DonutSeries DataFieldY="valueField" NameField="nameField">
                        </telerik:DonutSeries>
                    </Series>
                </PlotArea>
            </telerik:RadHtmlChart>
            <script>
                function onSeriesClick(e) {
                    var url = e.dataItem.urlField;
                    window.location.href = url;
                }
            </script>

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadHtmlChart1.DataSource = GetData();
                RadHtmlChart1.DataBind();
            }
        }
    
        private DataTable GetData()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("valueField");
            dt.Columns.Add("nameField");
            dt.Columns.Add("urlField");
            dt.Rows.Add(30, "google", "http://google.com");
            dt.Rows.Add(10, "bing", "http://bing.com");
            dt.Rows.Add(50, "bing", "http://msn.com");
    
            return dt;
        }

     

    Regards, Vessy
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Andrew
    Andrew avatar
    10 posts
    Member since:
    Aug 2019

    Posted 14 Aug in reply to Vessy Link to this post

    Thanks, That worked.
  4. Vessy
    Admin
    Vessy avatar
    2068 posts

    Posted 14 Aug Link to this post

    Hi,

    You are welcome, Andrew - I am glad the proposed solution served its purposes.

    Regards, Vessy
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top