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

Chart Auto Height

2 Answers 97 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Robert Stoppel
Top achievements
Rank 1
Iron
Robert Stoppel asked on 10 Mar 2021, 10:16 PM

Hi, I have a HtmlChart that I databind to the Sql stored procedure. The number of records returned is based on the parameters that user selects from the few dropdowns. So sometimes you have 50 records, sometimes 1.

Is it possible to set chart height based on the number of records?

Currently I set height to 1000px but it does look very funny when I display 1 records.

2 Answers, 1 is accepted

Sort by
0
Robert Stoppel
Top achievements
Rank 1
Iron
answered on 11 Mar 2021, 01:17 PM
Just to clarify I was having problems with chart height with BarSeries. Here is the solution that worked for me:

    Protected Sub SqlDataSource4_Selected(sender As Object, e As SqlDataSourceStatusEventArgs) Handles SqlDataSource4.Selected
        If e.AffectedRows > 0 Then
            RadHtmlChart2.Height = 100 + e.AffectedRows * 20
        Else
            RadHtmlChart2.Height = 100
        End If
    End Sub
0
Vessy
Telerik team
answered on 11 Mar 2021, 04:56 PM

Hi,

Thank you for sharing your solution with the community, Robert!

RadHtmlChart cannot size itself automatically based on the bound data, but the found by you solution seems to be a great workaround when such functionality is needed.

Kind regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Chart (HTML5)
Asked by
Robert Stoppel
Top achievements
Rank 1
Iron
Answers by
Robert Stoppel
Top achievements
Rank 1
Iron
Vessy
Telerik team
Share this question
or