Telerik Forums
UI for ASP.NET MVC Forum
3 answers
68 views

Should be really simple.... cannot find any documentation and the demo is lacking...

How do you set the target color from the helper?

 

@(Html.Kendo()
            .Sparkline()
            .Name("sprkFundsDisbursed")
            .Type(SparklineType.Bullet)
            .HtmlAttributes(new { style = "text-align: left; width:100%; line-height:30px;" })
            .Tooltip(tooltip => tooltip.Format("{0}%"))
            .SeriesColors(new string[] {"blue"})
             
            .ValueAxis(axis => axis
                .Numeric()
                .Min(0)
                .Max(100)
 
                .PlotBands(bands => {
                    bands.Add().From(0).To(95).Color("#787878").Opacity(0.15);
                    bands.Add().From(95).To(100).Color("#787878").Opacity(0.3);
                })
                )
                 
                .Data(new double[] { 43, 95 })
Tsvetomir
Telerik team
 answered on 06 Feb 2020
3 answers
77 views
Is there a way to generate a static sparkline chart on the server? I'd like to include a sparkline in a system-generated email.
Tsvetina
Telerik team
 answered on 21 Jun 2017
4 answers
294 views
I'm trying to add a sparkline column into a grid.
I've tried using a client template to do this, but it just shows [object HTMLScriptElement] in the column, rather than the chart.

I have a template:-
<script id="sparkTemplate" type="text/kendo-tmpl">
 
     @(Html.Kendo().Sparkline()
                        .Name("temp-log_#=ID#")
                        .Type(SparklineType.Column)
                        .Tooltip(tooltip => tooltip.Format("{0} °C"))
                         
                        .Data(ViewBag.TemperatureData)
                        .ToClientTemplate()
               )
 
</script>
This doesn't yet have pass any parameters to the controller - but obviously this will be needed as well.
The grid is:-
        @(Html.Kendo().Grid<CMS_2013.Models.CMSSummaryOne>()
.Name("tabGrid")
.Columns(columns=>
    {columns.Bound(p=>p.DivisionName).Title("Division");
    columns.Bound(p => p.Specialty).Title("Specialty");
    columns.Bound(p => p.Activity).Title("Activity");
    columns.Bound(p => p.Plan).Title("Plan");
    columns.Bound(p => p.Variance).Title("Variance").ClientTemplate("#= formatNumber(Variance) #");
    columns.Bound(p => p.Variance).Title("Variance").ClientTemplate("#=sparkTemplate#");
    })
     
     
   
    .Pageable()
    .Sortable()
    .Selectable()
 
    .DataSource(dataSource=>dataSource
        .Ajax()
        .PageSize(5)
         
        .Read(read=>read.Action("GetTableData","Dashboard")
        .Data("chartFilter")
        )
        )
         
   
       )

What's the best way to embed a chart into a column - I specifically want the chart in a column and not a detail template - something a sparkline looks ideal for.

Thanks
Dimiter Madjarov
Telerik team
 answered on 08 Sep 2015
5 answers
125 views
Hi!

Is it possible to have a sparkline inside a listview HTML template?
If so, what is the best practice regardning binding it to data?

Regards,
Per
Iliana Dyankova
Telerik team
 answered on 18 Jun 2014
6 answers
139 views
I'm trying to set up a sparkline, and I've got it working.

However, the tool tip shows the data field name, as well as the value, unlike your demos, where just the number is shown.
@(Html.Kendo().Sparkline()
.Name("BatchTimeSpark")
.Type(SparklineType.Column)
.DataSource(ds=>ds
    .Read(read => read.Action("GetBatchStats", "Home"))
  )
  .Series(s=>s
      .Column("RunLength")
  )
   
   
  )
I've attached a screenshot of the tool tip.
Also, what's the best way to set the height. My chart seems very short (the values are small, but I expected it to scale).

Thanks
--
AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 02 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?