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

Responsive Sparkline

1 Answer 239 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Niall
Top achievements
Rank 1
Niall asked on 29 May 2014, 03:18 PM
Hello,

I wish to place a sparkline chart in the final cell of each row in a html table. When resizing the window a standard area chart resized in line with the browser/its container, however the sparkline does not resize at all. Is it possible for the sparkline to resize automatically like other dataviz objects?

The attached screenshot shows the sparkline on the left and the standard chart on the right after the browser has been resized.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 30 May 2014, 10:28 AM
Hello Niall,

Unlike the other Kendo UI Charts, the SparkLine is initialized from a <span> element - it is an inline element and don't have width / height. What I can suggest in this case is to change the chartArea metrics when the window is resized. For example: 
$(window).resize(function(){
   var sparkline = $("#sparklineId").data("kendoSparkline");
   //set chartArea metrics
   sparkline.setOptions({chartArea: {width: 100}});
});

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
Charts
Asked by
Niall
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or