MVC Wrapper ClientTemplate?

5 posts, 0 answers
  1. Thien
    Thien avatar
    38 posts
    Member since:
    Aug 2014

    Posted 16 Jan 2015 Link to this post

    I created a column sparkline as such:

    @(Html.Kendo().Sparkline()
        .Name("Minutes")
        .ChartArea(c => c.Height(100))
        .DataSource(ds => ds
           .Read(read => read.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "UtilizationCall30Day" })).Type(HttpVerbs.Get))
        )
        .Series(series => series
           .Column("SecondCount").Color("#00ADEE")
        )
     )

    Is there a way I can pass in a javascript function to convert the values from seconds to minutes?
  2. Thien
    Thien avatar
    38 posts
    Member since:
    Aug 2014

    Posted 16 Jan 2015 Link to this post

    Since the chart will visually be the same, I was able to just update the Tooltip with a Template as such. Where secondsToMinutes is a javascript function.

    @(Html.Kendo().Sparkline()
        .Name("Minutes")
        .ChartArea(c => c.Height(100))
        .DataSource(ds => ds
           .Read(read => read.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "UtilizationCall30Day" })).Type(HttpVerbs.Get))
        )
        .Series(series => series
           .Column("SecondCount").Color("#00ADEE").Name("Minutes")
        )
        .Tooltip(tooltip => tooltip.Format("C").Template("#=secondsToMinutes( value )#"))
     )
  3. Kendo UI is VS 2017 Ready
  4. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 20 Jan 2015 Link to this post

    Hi Thien,

    I am not quite sure if I understand correctly what the expected outcome is. Could you please elaborate a bit more on the exact scenario you are trying to implement - this way I would be able to advice you further and provide concrete recommendations? Thank you in advance for your cooperation. 

    Regards,
    Iliana Nikolova
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Thien
    Thien avatar
    38 posts
    Member since:
    Aug 2014

    Posted 20 Jan 2015 Link to this post

    The datasource is sending back a time value in Seconds and I wanted to display it in Minutes. I was able to do it using the tooltip template. Thanks.
  6. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 22 Jan 2015 Link to this post

    Hi Thien,

    For this requirement I would suggest to use categoryAxis with type "date" and baseUnit "minutes"

    @(Html.Kendo().Sparkline()
      //....
      .CategoryAxis(axis => axis
         .Date()
         .BaseUnit(ChartAxisBaseUnit.Minutes)
      )
    )

     

    Regards,
    Iliana Nikolova
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready