0

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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Gurunadh
  • 453
  • 2
  • 10
  • 24
  • Can you describe what you mean by "set horizontal scroll bar"? Can you show an example of a site which demonstrates the behavior you're trying to achieve? – David Oct 11 '13 at 13:29

2 Answers2

0

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>
dvjanm
  • 2,351
  • 1
  • 28
  • 42
  • Hi, It seems to be that, the problem is cleared but here whole chart is scrolling so can't able to see the Y-axis values, what you have done for that? – Gurunadh Oct 11 '13 at 13:53
  • The Chart control generates the picture of the chart in server-side and this picture is displayed in an img tag in the generated html. So I don't think that it is even possible to scroll only the part of that. – dvjanm Oct 11 '13 at 14:17
  • But an alternative solution could be that in the aspx markup: – dvjanm Oct 11 '13 at 14:27
  • ya, ok i done this temporary, and will see later if there is any better idea, thanks you. – Gurunadh Oct 12 '13 at 05:12
0

chart1.ChartAreas["ChartArea1"].AxisX.ScaleView.Zoomable = true; chart1.ChartAreas["ChartArea1"].AxisX.ScrollBar.IsPositionedInside = true;

Chenthil
  • 296
  • 4
  • 9