Sum items from a category Kendo Chart

Asked

Viewed 42 times

1

I have an array with the percentage of each graph item, similar to the date. I’m trying to build the template, according to the code template: "#= series.abbr #: #= value # (#= series.percent #). Follow the code below:

 $("#chart").kendoChart({
                title: {
                    text: "Gross domestic product growth /GDP annual %/"
                },
                legend: {
                    position: "bottom"
                },
                                seriesDefaults: {
                  labels: {
                      template: "#= series.abbr #: #= value # (#= series.percent #)",
                      position: "outsideEnd",
                      visible: true,
                      background: "transparent"
                  },
                    type: "column"
                },
                series: [{
                    abbr: "IND",
                    name: "India",
                    data: [3.907, 7.943, 7.848],
                        percent: [3.2, 7.3, 7.1]
                }, {
                    abbr: "RF",
                    name: "Russian Federation",
                    data: [4.743, 7.295, 7.175],
                    percent: [3.6, 7.4, 7.9]
                },{
                    abbr: "WRD",
                    name: "World",
                    data: [1.988, 2.733, 3.994],
                    percent: [1.3, 2.7, 3.7]
                }],
                valueAxis: {
                    labels: {
                        format: "{0}%"
                    },
                    line: {
                        visible: true
                    },
                    axisCrossingValue: 0
                },
                categoryAxis: {
                    categories: [2009, 2010, 2011],
                    line: {
                        visible: true
                    },
                    labels: {
                        padding: {top: 1}
                    }
                },
                tooltip: {
                    visible: true,
                    format: "{0}%",
                    template: "#= series.name #: #= value # : #= series.total #"
                }
            });

Unfortunately, I can only get the series.percent, thus taking the whole line. When generating the graph, it looks like this: inserir a descrição da imagem aqui

I would like to somehow sum or then take the percentage of each graph item within the Percent array and apply to the graph, such as the data (using the value within the template). So the graph would have this shape: inserir a descrição da imagem aqui

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.