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

Dynamic Series Labels

3 Answers 672 Views
Charts
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 17 Apr 2019, 01:18 AM

Hi

I have a stacked bar chart that I want to have the series labels to be dynamically created on the last "color"

Currently in the attached file, i attached the series label to my "blue" bar.  However once inside the callback I can't get to my component to generate a dynamic label.

If i have just 2 colors, i can calculate the label using "value" and "stackedValue" ... but with more than 2 i need to get at my component

So how can I get the label to show total for each color in the row, not just the last color, ie

1st row is 1/4/7
2nd row is 2/5/8
3rd row is 3/6/9

Here is my sample

https://stackblitz.com/edit/angular-vushqc?file=app/app.component.ts

Thanks

3 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 17 Apr 2019, 05:08 PM

I was able to customize my label using the content method of the  SeriesLabelsComponentGenerated class ...

It allows the method to get the context of "this" so I can generate my custom string 

0
Accepted
Dimiter Topalov
Telerik team
answered on 18 Apr 2019, 08:06 AM
Hi David,

This indeed the most straight-forward approach to achieve the desired functionality:

https://www.telerik.com/kendo-angular-ui/components/charts/api/SeriesLabels/#toc-content

The alternative is to create a custom visual that gives the developer full control over drawing the respective label element:

https://www.telerik.com/kendo-angular-ui/components/charts/api/SeriesLabels/#toc-visual

Regards,
Dimiter Topalov
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
David
Top achievements
Rank 1
answered on 18 Apr 2019, 06:42 PM
Thank you very much Dimiter !!
Tags
Charts
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Dimiter Topalov
Telerik team
Share this question
or