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

Line change color in group

5 Answers 482 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Robson
Top achievements
Rank 2
Robson asked on 12 Jan 2016, 03:11 PM

Hi, 

I would like each line had its specific color . 

Mi Result consult:

 

 

$(id).kendoChart({
        dataSource: {
            transport: {
                read: {
                    url: "/Faturamento/GetFaturamentoGrupoGrafico?" + form,
                    dataType: "json"
                }
            },
            sort: {
                field: "Ano",
                dir: "asc",
 
            },
            group: {
                field: "Grupo",
                
            },
        },
        theme: $(document).data("kendoSkin") || "blueopal",
 
 
        legend: {
 
        },
        seriesDefaults: {
            type: "line"
        },
        series: [{
            field: "Qtde",           
 
        }],
        categoryAxis: {
            field: "Ano",
        },
        valueAxis: {
            labels: {
                format: "N0"
            },
            // majorUnit: 10000
        },
        tooltip: {
            visible: true,
             
             template: "#= series.name #: #=kendo.format('{0:N0}', value)  #"
        }
    });     

5 Answers, 1 is accepted

Sort by
0
Robson
Top achievements
Rank 2
answered on 12 Jan 2016, 03:13 PM
Json.
 
[{"Grupo":"ANEL","Qtde":817251,"Valor":24125831.37,"CodigoCliente":0,"Ano":2015,"Cor":"Red"},{"Grupo":"BRINCO","Qtde":492578,"Valor":14061106.15,"CodigoCliente":0,"Ano":2015,"Cor":"Yellow"},{"Grupo":"CORDAO","Qtde":541779,"Valor":16214282.46,"CodigoCliente":0,"Ano":2015,"Cor":"Green"},{"Grupo":"PINGENTE","Qtde":37747,"Valor":1036999.56,"CodigoCliente":0,"Ano":2015,"Cor":"Black"},{"Grupo":"PULSEIRA","Qtde":280991,"Valor":7971583.25,"CodigoCliente":0,"Ano":2015,"Cor":"Orange"},{"Grupo":"ANEL","Qtde":413,"Valor":12476.98,"CodigoCliente":0,"Ano":2016,"Cor":"Red"},{"Grupo":"BRINCO","Qtde":897,"Valor":26770.93,"CodigoCliente":0,"Ano":2016,"Cor":"Yellow"},{"Grupo":"CORDAO","Qtde":1069,"Valor":31621.26,"CodigoCliente":0,"Ano":2016,"Cor":"Green"},{"Grupo":"PULSEIRA","Qtde":356,"Valor":10366.07,"CodigoCliente":0,"Ano":2016,"Cor":"Orange"},{"Grupo":"PINGENTE","Qtde":14,"Valor":384.88,"CodigoCliente":0,"Ano":2016,"Cor":"Black"}]

 

 

 

 

0
EZ
Top achievements
Rank 2
answered on 12 Jan 2016, 05:25 PM

Here is a DOJO with your data:

 http://dojo.telerik.com/@ezanker/eruJE

 The lines have different colors. Can you explain in more detail what result you expect?

0
Robson
Top achievements
Rank 2
answered on 12 Jan 2016, 06:14 PM

Hi Ez,

 

I have the property "Cor" in the json with colors names, This colors, i want whatever the line colors.

Exemple:

Anel - Red line

Brinco-Yellow

CORDAO-Green

PINGENTE-Black

 

 

 

 

 

 

 

0
Accepted
Iliana Dyankova
Telerik team
answered on 15 Jan 2016, 08:07 AM
Hi Robson,

For this scenario I would suggest attaching a handler to the dataBound event and set the color via the chart.options. For your convenience here is a dojo which demonstrates the suggested approach in action.

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Robson
Top achievements
Rank 2
answered on 15 Jan 2016, 10:01 AM
Thanks Iliana Nikolova , perfect!!!
Tags
Charts
Asked by
Robson
Top achievements
Rank 2
Answers by
Robson
Top achievements
Rank 2
EZ
Top achievements
Rank 2
Iliana Dyankova
Telerik team
Share this question
or