樣式很好看,也很好用的報表工具
前台:
<dcwc:chart id="Chart1" runat="server" Width="970" Height="360px" ImageType="Png" TitleFontColor="WhiteSmoke" TitleFont="Microsoft Sans Serif, 12pt">
<SERIES>
<dcwc:Series BackGradientType="VerticalCenter" Name="Default" Color="0, 192, 192" BackGradientEndColor="PaleTurquoise"></dcwc:SerIEs>
</SERIES>
<LEGEND Enabled="false">
</LEGEND>
<BORDERSKIN Skin FrameBackGradIEntEndColor="255, 192, 128" FrameBackHatch
FrameBackColor="Cornsilk" FrameBackGradIEntType="LeftRight"></BORDERSKIN>
<CHARTAREAS>
<dcwc:ChartArea BackColor="FloralWhite" BackGradientType="LeftRight" Name="Default" BackGradIEntEndColor="NavajoWhite"
ShadowColor="DarkGray" ShadowOffset="3"></dcwc:ChartArea>
</CHARTAREAS>
</dcwc:chart>
後台:
protected Dundas.Charting.WebControl.Chart Chart1;
//生成圖表
Chart1.ChartAreas["Default"].AxisY.Title=DpPramt.SelectedItem.Text;
Chart1.ChartAreas["Default"].AxisX.Title="DATE";
Chart1.Title =tit;
if (this.RBColunm.Checked==true)
{
Chart1.SerIEs[0].ChartType = "Column";
}
else
{
Chart1.SerIEs[0].ChartType = "Line";
}
//改變標題顏色
Chart1.TitleFontColor = Color.Red;
Chart1.SerIEs[0]["LabelStyle"] = "Center";
Chart1.BackHatchStyle = ChartHatchStyle.Shingle;
Chart1.BackGradientType = GradIEntType.None;
Chart1.BorderStyle = ChartDashStyle.DashDotDot;
Chart1.ForeColor=Color.LightGray;
Chart1.BorderWidth = 1;
// 控制圖形上顯示的toolstip提示 rt1.SerIEs[0].ToolTip = "#VALX: #VALY ";//VALX表示X值 ,VAL{C}表示Y值
// 控制圖形上顯示的toolstip提示
Chart1.SerIEs[0].LegendToolTip = "#PERCENT";//表示所占的百分比
Chart1.SerIEs[0]["FontColor"] ="Red";
OracleDataReader dr = db.GetDataReader(str);
if (dr.HasRows==true)
{
if (DpPramt.SelectedItem.Text=="running time")
{
Chart1.SerIEs[0].Points.DataBindXY(dr, "rd_day"/*橫軸*/, dr, "cd_acctime"/*縱軸*/);
}
else if (DpPramt.SelectedItem.Text=="work time")
{
Chart1.SerIEs[0].Points.DataBindXY(dr, "rd_day"/*橫軸*/, dr, "cd_worktime"/*縱軸*/);
}
else if (DpPramt.SelectedItem.Text=="dig number")
{
Chart1.SerIEs[0].Points.DataBindXY(dr, "rd_day"/*橫軸*/, dr, "cd_dignumber"/*縱軸*/);
}
else if (DpPramt.SelectedItem.Text=="travel time")
{
Chart1.SerIEs[0].Points.DataBindXY(dr, "rd_day"/*橫軸*/, dr, "cd_traveltime"/*縱軸*/);
}
else
{
Chart1.SerIEs[0].Points.DataBindXY(dr, "rd_day"/*橫軸*/, dr, "cd_workhour"/*縱軸*/);
}
}
db.ConnClose();
SetAxisInterval(Chart1.ChartAreas["Default"].AxisX, 1, DateTimeIntervalType.Days);//連續顯示橫軸坐標
Chart1.ChartAreas["Default"].AxisX.LabelsAutoFit = false;//auto樣式關
Chart1.ChartAreas["Default"].AxisX.LabelStyle.OffsetLabels = false;//一行顯示橫軸坐標,非上下交錯
// Chart1.ChartAreas["Default"].AxisX.LabelStyle.FontAngle = -30; 橫軸坐標傾斜角度
Chart1.ChartAreas["Default"].AxisX.LabelStyle.Font = new Font("Arial", 10);//橫軸坐標字體大小
Chart1.ChartAreas["Default"].AxisY.LabelStyle.Font = new Font("Arial", 10);//縱軸坐標字體大小
Chart1.ChartAreas["Default"].AxisX.TitleFont = new Font("Times New Roman",10,FontStyle.Bold);//橫軸標題字體
Chart1.ChartAreas["Default"].AxisY.TitleFont = new Font("Times New Roman",10, FontStyle.Bold);
Chart1.ChartAreas["Default"].AxisY2.Enabled =AxisEnabled.False;//允許右側有數字顯示
Chart1.ChartAreas["Default"].AxisY2.LineColor = Color.Red;//控制線的顏色
Chart1.ChartAreas["Default"].AxisY2.LineStyle = ChartDashStyle.Solid;//控制線的類型 實線還是點劃線等等
Chart1.ChartAreas["Default"].AxisY2.Arrows = ArrowsType.None;//控制線是否帶箭頭
Trackback: http://tb.blog.csdn.Net/TrackBack.ASPx?PostId=1487288