Make legend unclikable

2 posts, 0 answers
  1. Jérémy
    Jérémy avatar
    19 posts
    Member since:
    Feb 2015

    Posted 03 Jun 2015 Link to this post

    Hi,

     

    I search a lot but I don't find a way to "disable" the click event on a legend of a chart. I don't want my user could click on the legend.

     

    Could you please help me ?

     

    Thank

  2. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 05 Jun 2015 Link to this post

    Hi Vallin,

    You can attach an event handler to the legendItemClick event and prevent the default behavior (show/hide the corresponding pie segment). You can have a similar implementation:
    <telerik:RadHtmlChart runat="server" ID="PieChart" Width="800" Height="500" Transitions="true">
        ...
    </telerik:RadHtmlChart>
    <script type="text/javascript">
        function pageLoad() {
            //get a reference to the chart
            var chart = $find("<%=PieChart.ClientID%>");
            //attach an event handler
            chart.get_kendoWidget().bind("legendItemClick", function (e) {
                e.preventDefault();
            });
        }
    </script>

    I hope this approach is suitable for your scenario.

    Regards,
    Vessy
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top