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

Using template on category axis labels without jquery

3 Answers 380 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Web
Top achievements
Rank 1
Web asked on 30 May 2018, 02:49 PM

I'm trying to use a template on my category axis labels using kendo for ASP.CORE. I tried the code snippet below and now the labels are blank even though my graph has values. I'm trying to accomplish this without building the grid via jquery, but it appears that all the support is on the jquery way of handling this. Is this possible for ASP.NET Core?

.CategoryAxis(axis => axis
                                        .Labels(labels => labels
                                        .Template("#= series.name #: #= value #")
                                        )

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 01 Jun 2018, 06:02 AM
Hello,

The provided syntax is the supported one when the Chart is used in an ASP.NET Core application.

Please advise if this is causing any errors?

Please have in mind that the series variable is not available inside the template.

All of the available variables can be observed here:

https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart/configuration/categoryaxis.labels#categoryAxis.labels.template

I hope this is helpful.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Web
Top achievements
Rank 1
answered on 01 Jun 2018, 01:34 PM

Hi,

I didn't receive any errors, but nothing showed up. I'm not following what I need to do. I'm trying to get the Category + the data value to display on the left of the bar. The data is obviously dynamic, but the category label itself is static. I have attached a mockup of what I'm trying to achieve. Hoping it's possible!

Thanks for your help!

0
Stefan
Telerik team
answered on 04 Jun 2018, 07:34 AM
Hello,

Thank you for the screenshot demonstrating the desired result.

This could be achieved if the categoryField is used when binding the series as in that case the dataItem variable will be available.

We made an example (jQuery) in order to check data structure that is expected in this case:

https://dojo.telerik.com/UxUsaXiB

The MVC template would be:

.CategoryAxis(axis => axis
 .Labels(labels => labels
 .Template('#= value# #= dataItem.value#%')
)

If this is not helpful, please share an example of the data structure and the Chart configuration, so we can suggest an approach best suited for it.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Chart
Asked by
Web
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Web
Top achievements
Rank 1
Share this question
or