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

Kendo Ui charts Line - Add step in Json programmatically

1 Answer 22 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Robson
Top achievements
Rank 2
Robson asked on 22 May 2015, 12:43 PM

Hi,

How do I add Step programmatically using a json ?

 My chart

$("#graficos").kendoChart({
               dataSource: {
                   transport: {
                       read: {
                           url: "/Graficos/VendasProdutos/"+id,
                           contentType: "application/json"
                       },
 
                       parameterMap: function (data, operation) {
                           return JSON.stringify(data);
                       }
                   }
               },
               title: {
                   text: "Produtos Vendas"
               },
               legend: {
                   position: "bottom"
               },
               seriesDefaults: {
                   type: "line"
               },
               series: [{
                   field: "qtde",
                   name: "Quantidade",
                   noteTextField: "extremum",
                   notes: {
                       label: {
                           position: "outside"
                       },
                       position: "bottom"
                   }
               }],
               valueAxis: {
                   line: {
                       visible: false
                   }
               },
               categoryAxis: {
                   field: "MesAno",
                   labels: {
                       rotation: -45,
                       step: -> Here Add programmatically in json
                   },
                   majorGridLines: {
                       visible: false
                   }
                    
               },
               tooltip: {
                   visible: true,
                   template: "Mês/Ano -#= category  # - #= series.name #: #= value #"
               }
           });

 

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 26 May 2015, 11:05 AM

Hello Robson,

If I understand correctly, you'd like to obtain the value for categoryAxis.labels.step from a remote service. Is that correct?

If the value is not available at initialization you can use the setOptions method to alter it after the chart is initialized:

$("#graficos").data("kendoChart").setOptions({
  categoryAxis: {
    labels: {
      step: NEW_VALUE
    }
  }
});

I hope this helps.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Charts
Asked by
Robson
Top achievements
Rank 2
Answers by
T. Tsonev
Telerik team
Share this question
or