Search code examples
c#asp.netasp.net-charts

How can I set the horizontal scroll bar to asp chart control


I am using the following code to display ASP.NET chart control on my page and it is working fine. My problem is, I need to set horizontal scroll bar on x-axis,

protected void BindDataToChart2()
{
    Chart1.DataSource = local_ds.Tables[3];
    Chart1.Legends.Add("legend1").Title = "LocalIP Details";
    Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Login Date";
    Chart1.ChartAreas["ChartArea1"].AxisY.Title = "No. of Clients";
    Chart1.Series["Series2"].XValueMember = "LoginDate";
    Chart1.Series["Series2"].YValueMembers = "clients";
    Chart1.DataBind();
}

and this is ASP.NET chart control.


Solution

  • I can be achieved by simply putting the Chart to a Panel and setting the Panel's ScrollBars Property to "Horizontal"

       <asp:Panel ID="Panel3" runat="server" ScrollBars="Horizontal">
           <asp:Chart 
               ....
           </asp:Chart>
       </asp:Panel>