how to create a function that starts at the click event of the pie chart?

2 posts, 0 answers
  1. alex
    alex avatar
    17 posts
    Member since:
    Nov 2020

    Posted 18 Nov 2020 Link to this post

    Hi,

    how to create a function that starts at the click event of the pie chart?

    i would to pass the selected item to a function

     

                                         <kendo-chart-series>
                                  <kendo-chart-series-item
                                    type="pie" [data]="dataSourcePieChart"
                                    categoryField="cost" field="cost">
                                        <kendo-chart-series-item-labels
                                            position="outsideEnd"
                                            color="#000"
                                            [content]="labelContent">
                                        </kendo-chart-series-item-labels>
                                    </kendo-chart-series-item>
                                </kendo-chart-series>

     

    Alex

  2. Hetali
    Admin
    Hetali avatar
    75 posts

    Posted 19 Nov 2020 Link to this post

    Hello Alex,

    The Kendo UI Chart has a built-in event that starts a function when you click on the series. The SeriesClickEvent also passes a list of arguments in the function. For example:

    <kendo-chart (seriesClick)="seriesClick($event)">
      <kendo-chart-series>
        <kendo-chart-series-item type="pie">
        </kendo-chart-series-item>
      </kendo-chart-series>
    </kendo-chart>

    seriesClick(e) {
      console.log(e);
      alert("Value: " + e.dataItem.value);
    }

    In this StackBlitz example, the Kendo UI Pie Chart has a SerisClickEvent function.

    Please let me know if this helps or if you have any further questions pertaining to this case.

    Regards,
    Hetali
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top