Display chart in logarithmic way

2 posts, 0 answers
  1. stephane
    stephane avatar
    10 posts
    Member since:
    Jan 2010

    Posted 12 Jun 2014 Link to this post

    I would like to display following chart in logarithmic way 

    @(Html.Kendo().Chart()
        .Name("chart3")
        .Title("Time Based graph")
             .SeriesDefaults(seriesDefaults => seriesDefaults.Line().Style(ChartLineStyle.Smooth).Markers(false)
              )
               .Series(series =>
               {
                   series
                       .Line(new double[] {102, 100, 98, 103, 105, 99, 98, 104, 102, 104, 100, 94, 104, 109, 142, 198, 512, 405, 709, 805, 1203, 845, 1000, 1025, 1002, 1120, 1205, 1508});
               }
               )
               .CategoryAxis(axis => axis
                  .Categories(new DateTime[]
                  {
                      new DateTime(2011,01,01), new DateTime(2011,01,02), new DateTime(2011,01,03), new DateTime(2011,01,04), new DateTime(2011,01,05), new DateTime(2011,01,06),
                      new DateTime(2011,01,07), new DateTime(2011,01,08), new DateTime(2011,01,09), new DateTime(2011,01,10), new DateTime(2011,01,11),
                      new DateTime(2011,01,12),
                      new DateTime(2011,01,13), new DateTime(2011,01,14), new DateTime(2011,01,15), new DateTime(2011,01,16), new DateTime(2011,01,17), new DateTime(2011,01,18),
                      new DateTime(2011,01,19), new DateTime(2011,01,20), new DateTime(2011,01,21), new DateTime(2011,01,22), new DateTime(2011,01,23),
                      new DateTime(2011,01,24), new DateTime(2011,01,25), new DateTime(2011,01,26), new DateTime(2011,01,27), new DateTime(2011,01,28)
                  }
               )
               )
               
               )
    I tries to add that option in VAlueAxis Proporties like that but it changed nothing 

    @(Html.Kendo().Chart()
        .Name("chart3")
        .Title("Time Based graph")
             .SeriesDefaults(seriesDefaults => seriesDefaults.Line().Style(ChartLineStyle.Smooth).Markers(false)
              )
               .Series(series =>
               {
                   series
                       .Line(new double[] { 102, 100, 98, 103, 105, 99, 98, 104, 102, 104, 100, 94, 104, 109, 142, 198, 512, 405, 709, 805, 1203, 845, 1000, 1025, 1002, 1120, 1205, 1508 });
               }
               )
               .CategoryAxis(axis => axis
                  .Categories(new DateTime[]
                  {
                      new DateTime(2011,01,01), new DateTime(2011,01,02), new DateTime(2011,01,03), new DateTime(2011,01,04), new DateTime(2011,01,05), new DateTime(2011,01,06),
                      new DateTime(2011,01,07), new DateTime(2011,01,08), new DateTime(2011,01,09), new DateTime(2011,01,10), new DateTime(2011,01,11),
                      new DateTime(2011,01,12),
                      new DateTime(2011,01,13), new DateTime(2011,01,14), new DateTime(2011,01,15), new DateTime(2011,01,16), new DateTime(2011,01,17), new DateTime(2011,01,18),
                      new DateTime(2011,01,19), new DateTime(2011,01,20), new DateTime(2011,01,21), new DateTime(2011,01,22), new DateTime(2011,01,23),
                      new DateTime(2011,01,24), new DateTime(2011,01,25), new DateTime(2011,01,26), new DateTime(2011,01,27), new DateTime(2011,01,28)
                  }
               )
               )
               .ValueAxis(a => a.Logarithmic())
    )


    Could you help me please?
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 16 Jun 2014 Link to this post

    Hello,

    The sample code you provided appears to be working in my tests.
    Perhaps adding the value axis minor grid lines will help indicate that the axis is logarithmic:
    .ValueAxis(a => a.
      Logarithmic()
      .MinorGridLines(minorGridLines => minorGridLines.Visible(true))
      .Max(10000)
    )


    See attachment for reference.
    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top