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

MVC Wrapper ClientTemplate?

4 Answers 51 Views
Sparkline
This is a migrated thread and some comments may be shown as answers.
Thien
Top achievements
Rank 1
Thien asked on 16 Jan 2015, 11:25 PM
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?

4 Answers, 1 is accepted

Sort by
0
Thien
Top achievements
Rank 1
answered on 16 Jan 2015, 11:58 PM
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 )#"))
 )
0
Iliana Dyankova
Telerik team
answered on 20 Jan 2015, 05:08 PM
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!
 
0
Thien
Top achievements
Rank 1
answered on 20 Jan 2015, 06:26 PM
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.
0
Iliana Dyankova
Telerik team
answered on 22 Jan 2015, 09:30 AM

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!
 
Tags
Sparkline
Asked by
Thien
Top achievements
Rank 1
Answers by
Thien
Top achievements
Rank 1
Iliana Dyankova
Telerik team
Share this question
or