|
曲线图:
前台页面:
<%@ Register TagPrefix="dcwc" Namespace="Dundas.Charting.WebControl" Assembly="DundasWebChart" %>
<DCWC:Chart ID="Chart1" runat="server" Width="680px" BackColor="#F1F5FE" BorderLineColor="LightGray" style=" padding-top:33px;" Palette="SemiTransparent" Height="450px"> <series> <DCWC:Series ChartType="StackedColumn" Name="上报量排行" BorderColor="120, 50, 50, 50"> </DCWC:Series> </series> <chartareas> <DCWC:ChartArea Name="Default" BackColor="120, 173, 216, 230" BorderColor="DimGray" BorderStyle="Solid"> <AxisY LineColor="DimGray"> <MajorGrid LineColor="DimGray" LineStyle="Dot" /> <MinorTickMark Size="2" /> <MajorTickMark LineColor="DimGray" /> </AxisY> <AxisX LineColor="DimGray"> <MajorGrid LineColor="DimGray" LineStyle="Dot" /> <MinorTickMark Size="2" /> <MajorTickMark LineColor="DimGray" /> <LabelStyle Font="Microsoft Sans Serif, 12pt" /> </AxisX> <Area3DStyle Enable3D="True" Light="None" WallWidth="4" /> </DCWC:ChartArea> </chartareas> <legends> <DCWC:Legend BackColor="Transparent" Docking="Bottom" Font="Microsoft Sans Serif, 12pt" BorderColor="Transparent" LegendStyle="table" Alignment="Center" Name="Default"> </DCWC:Legend> </legends> <borderskin framebackcolor="LightSkyBlue" framebackgradientendcolor="DodgerBlue" pagecolor="AliceBlue" /> <titles> <DCWC:Title Font="Microsoft Sans Serif, 12pt, style=Bold" Name="Title1" Text="上报量排行"> </DCWC:Title> </titles> <DCWC:Legend Name="Default"> </DCWC:Legend> </DCWC:Chart>
后台页面:
绑定数据后显示方式:
masterData = report.getReport();
showData();
public void showData(BaseData dataes) { this.TabContainer1.ActiveTabIndex = 1; ChartArea area = (ChartArea)Chart1.ChartAreas["Default"]; Chart1.Series.Clear(); Chart1.ChartAreas[0].AxisX.Interval = 1; Series series = null; Chart1.Palette = ChartColorPalette.Excel;
if (dataes.Tables[0].Rows.Count > 0) { Chart1.Visible = true; ShowNonumber.Visible = false; series = new Series("上报数目(个)"); series["PointWidth"] = "0.2"; series.Type = SeriesChartType.Column; series.ShowLabelAsValue = true; Chart1.Series.Add(series); for (int j = 0; j < dataes.Tables[0].Rows.Count; j++) { DataPoint dataPoint = new DataPoint(); dataPoint.YValues = new double[] { double.Parse(dataes.Tables[0].Rows[j][0].ToString()) }; dataPoint.AxisLabel = dataes.Tables[0].Rows[j][1].ToString(); dataPoint.LegendText = dataPoint.AxisLabel; series.Points.Add(dataPoint); } Chart1.ChartAreas["Default"].AxisY.TitleAlignment = StringAlignment.Far; Chart1.ChartAreas["Default"].AxisY.TitleColor = Color.Black; Chart1.ChartAreas["Default"].AxisY.Title = "上报数目(个)"; Chart1.ChartAreas["Default"].AxisY.TitleFont = new Font("宋体", 10f, System.Drawing.FontStyle.Bold); Chart1.ChartAreas["Default"].AxisX.TitleAlignment = StringAlignment.Far; Chart1.ChartAreas["Default"].AxisX.TitleColor = Color.Black; Chart1.ChartAreas["Default"].AxisX.TitleFont = new Font("宋体", 10f, System.Drawing.FontStyle.Bold); Chart1.ChartAreas["Default"].AxisX.Title = "业务员"; } }
在WEB.CONFIG中:
<httpHandlers>
<add path="ChartAxd.axd" verb="*" type="Dundas.Charting.WebControl.ChartHttpHandler" validate="false"/>s
</httpHandlers>
在Bin中:
加入DundasWebChart.dll |