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

Scrolling

3 Answers 198 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
Iron
Iron
Veteran
David asked on 17 Oct 2017, 06:40 PM

Sometimes i want to fit quite a few Column Series into the chart, so eventually they are becoming crowded.

Is it possible to use fixed width for series, but enable scrolling?

3 Answers, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 19 Oct 2017, 03:25 PM
Hi David,

RadHtmlChart does not provide the desired functionality out-of-the-box, but you can achieve a similar behavior by setting big width to the control and wrapping it in a standard scrollable div element in a similar way:
<div style="width:600px; overflow-x:scroll">
    <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="2000px" Height="400px">
        <PlotArea>
            <Series>
                <telerik:ColumnSeries Name="Products 1" DataFieldY="valueField1">
                    <LabelsAppearance Visible="false">
                    </LabelsAppearance>
                </telerik:ColumnSeries>
            </Series>
            <XAxis DataLabelsField="dataFieldX">
            </XAxis>
        </PlotArea>
        <Legend>
            <Appearance Visible="false"></Appearance>
        </Legend>
        <ChartTitle Text="Money Spent Per Product"></ChartTitle>
    </telerik:RadHtmlChart>
</div>
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        RadHtmlChart1.DataSource = GetData();
        RadHtmlChart1.DataBind();
    }
}
 
protected DataTable GetData()
{
    DataTable tbl = new DataTable();
    tbl.Columns.Add(new DataColumn("dataFieldX"));
    tbl.Columns.Add(new DataColumn("valueField1"));
    tbl.Columns.Add(new DataColumn("valueField2"));
 
    for (int i = 0; i < 50; i++)
    {
        tbl.Rows.Add(new object[] { i, i*2-i});
    }
 
    return tbl;
}


Another possible approach you can suggest you is to consider using the Data Navigation feature of the chart:
http://demos.telerik.com/aspnet-ajax/htmlchart/examples/functionality/datanavigation/defaultcs.aspx


Regards,
Vessy
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 02 Nov 2017, 07:52 PM

Understood

Thank you

0
Vessy
Telerik team
answered on 03 Nov 2017, 07:34 AM
Hi,

You are welcome, David. Let us know should any further question on this matter occur.

Regards,
Vessy
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Chart (HTML5)
Asked by
David
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Vessy
Telerik team
David
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or