实现起来还是比较简单的,主要就是一个AJAXZoomEnabled属性、ChartAreas中的Cursorx-UserEnabled属性以及OnCallbackComplete事件,不过如果dundas本身还做成自适应屏幕的话,则还需要修改部分代码。
具体实现如下:
BS:
<DCWC:Chart ID="Chart1" runat="server" BackColor="#e8efe3" Palette="Pastel"
Height="470px" Width="1024px" TitleFont="Microsoft Sans Serif, 10pt, style=Bold" AJAXZoomEnabled="true“ OnCallbackComplete="Chart1_CallbackComplete">
<ChartAreas>
<DCWC:ChartArea BackColor="AliceBlue" Name="Default" CursorX-UserEnabled="true">
C#:(上面一段主要放入dundas数据绑定来调整dundas大小,Session中记录的是客户端分辨率,下方为CallbackComplete事件。当然写的好点可以用一个全局变量实现)
int customerWidth = Platform.Common.Utility.ToInt(Session["customerWidth"].ToString()).Value;
int customerHeight = Platform.Common.Utility.ToInt(Session["customerHeight"].ToString()).Value;
Chart1.Width = customerWidth - 400;
Chart1.Height = customerHeight - 350;
protected void Chart1_CallbackComplete(object sender, CommandEventArgs e)
{
int customerWidth = Platform.Common.Utility.ToInt(Session["customerWidth"].ToString()).Value;
int customerHeight = Platform.Common.Utility.ToInt(Session["customerHeight"].ToString()).Value;
Chart1.ChartAreas["Default"].AxisX.LabelStyle.IntervalType = DateTimeIntervalType.Days;
this.Chart1.ChartAreas["Default"].AxisX.LabelsAutoFit = false;
Chart1.Width = customerWidth - 400;
Chart1.Height = customerHeight - 350;
}
浙公网安备 33010602011771号