This is a migrated thread and some comments may be shown as answers.

Anchor key, Href around a Donut series segment

3 Answers 12 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 13 Aug 2019, 03:34 PM

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

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 14 Aug 2019, 11:49 AM

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.
0
Andrew
Top achievements
Rank 1
answered on 14 Aug 2019, 12:15 PM
Thanks, That worked.
0
Vessy
Telerik team
answered on 14 Aug 2019, 12:45 PM

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.
Tags
Chart (HTML5)
Asked by
Andrew
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or