Add item in a pie chart template Telerik

4

I'm developing a chart using Telerik. In the graphic I need to show in the template some relevant information, such as training, percentage and total. But I can only show two (training and percentage), which in the case Telerik comes by default, which is the field and categoryField . It has the explodField too, but it only serves to highlight the part of the graph that was selected. Here is the code:

    function createChart(data) {
    $("#divGraficoFinanceiro").kendoChart({
        theme: $(document).data("kendoSkin") || "default",
        seriesDefaults: {
            labels: {
                visible: true,
                background: "transparent",
                template: "Formação: #= category #: \n Percentual: #= value#% \n Total: #= total#"
            }
        },
        series: [{
            type: "pie",
            field: "percentage",
            categoryField: "source",
            explodeField: "explode"
            //adicionar o novo item => totalField: "total"

        }],
    });

How could you add a new item within series: and show it in the seriesDefault: template?     

asked by anonymous 29.04.2015 / 16:52

1 answer

1

Well, I see that in the template you already have a variable with the total, I believe it is in javascript, so the only problem is in displaying it. Home Telerik already has standard forms for this, in this case: #= var_telerik # , but when you want to display your own variable in javascript, use: #: sua_var # . In this case your code would be:

template: "Formação : #= category# \n Percentual : ${value} % \n Total : #: total #"

You can test that it will work!

    
01.06.2015 / 16:34