Kendo Ui charts Line - Add step in Json programmatically

2 posts, 0 answers
  1. Robson
    Robson avatar
    18 posts
    Member since:
    May 2012

    Posted 22 May 2015 Link to this post

    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 #"
                   }
               });

     

  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 26 May 2015 Link to this post

    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!
     
Back to Top