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

General Chart - Approach

3 Answers 99 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 1
Allan asked on 23 Jan 2013, 09:21 PM
How do I set the width of a chart?

3 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 24 Jan 2013, 08:00 PM
Hello Allan,

You can use CSS and set width to the div element from which the chart is initialized. For example: 
#chart{
    width: //....px;
}
Also, you can specify the width of the ChartArea through the configuration options. Like here: 
@(Html.Kendo().Chart()
  //....
  .ChartArea(chartArea => chartArea
     .Width(400)
   )
 )

Kind regards,

Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Allan
Top achievements
Rank 1
answered on 24 Jan 2013, 08:06 PM
I get the following error:

CS1061: 'Kendo.Mvc.UI.Fluent.ChartAreaBuilder' does not contain a definition for 'Width' and no extension method 'Width' accepting a first argument of type 'Kendo.Mvc.UI.Fluent.ChartAreaBuilder' could be found (are you missing a using directive or an assembly reference?)

Line 39:                                 .Title(item.LoginAppName)
Line 40:                                 .ChartArea(chartArea => chartArea
Line 41: .Width(100) Line 42:                                     )
Line 43:                                 .Legend(legend => legend

I should also mention, the page worked fine without the added width code.
0
Accepted
Iliana Dyankova
Telerik team
answered on 25 Jan 2013, 09:07 AM
Hi Allan,

First of all, let me apologize -> the suggested approach is not correct. Actually, in Kendo UI Chart for ASP.NET MVC setting width to the chartArea via the width configuration option is not supported. In order to get the desired outcome you should use the HtmlAttributes. For example: 
@(Html.Kendo().Chart()
   //....
   .HtmlAttributes(new { style = "width: //....px;" })
)
Once again, please accept my apologies.
 
Kind regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Chart
Asked by
Allan
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Allan
Top achievements
Rank 1
Share this question
or