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

[Solved] How to define series width

3 Answers 108 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Igniter
Top achievements
Rank 1
Igniter asked on 24 Jan 2012, 12:57 PM
I have the following char
@(Html.Telerik().Chart<TestData>()
           .Name("chart").DataBinding(dataBinding => dataBinding.Ajax().Select("GetData", "Home"))
           .SeriesDefaults(series => series.Bar().Stack(true))
           .Series(series =>
           {
               series.Bar(s => s.Busy).Name("Busy").Color("#25A0DA");
               series.Bar(s => s.Open).Name("Open");
           })
           .CategoryAxis(axis => axis.Categories(s => s.Name))
           .ValueAxis(axis => axis.Numeric())
           .Tooltip(tooltip => tooltip.Visible(true))
           .Legend(legend => legend.Visible(false))
           .HtmlAttributes(new { style = "width: 400px; height:200px" }))

How to change HTML height depending on data count, or maybe it is possible to set series' height?

3 Answers, 1 is accepted

Sort by
0
Max
Top achievements
Rank 1
answered on 18 Feb 2012, 12:02 AM
Hello Igniter,

Were you able to find a solution for this? I have the same problem here :(

Thank you!
0
Igniter
Top achievements
Rank 1
answered on 21 Feb 2012, 09:44 AM
For now the following workaround works:
.HtmlAttributes(new { style = string.Format("width: 400px; height:{0}px", ModelItems.Count() *30 + 30) }))
0
Michael
Top achievements
Rank 1
answered on 02 Jul 2012, 04:14 PM
YAY!   That worked for me ! !  You saved my butt... Thanks x million
Tags
Chart
Asked by
Igniter
Top achievements
Rank 1
Answers by
Max
Top achievements
Rank 1
Igniter
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Share this question
or