线性图,ChartType=“Line”是折线,ChartType="Spline"是平滑曲线
1 <asp:Chart ID&#61;"Chart1" runat&#61;"server" Width&#61;"930px" Height&#61;"500" BackColor&#61;"Azure" BackSecondaryColor&#61;"White" BackGradientStyle&#61;"TopBottom">
2 <Legends>
3 <%-- <asp:Legend Alignment&#61;"Center" Docking&#61;"Right" Name&#61;"Legend1" Title&#61;"Test Value">
4 asp:Legend>--%>
5 Legends>
6 <Titles>
7 <asp:Title Font&#61;"微软雅黑, 16pt" Name&#61;"Title1" Text&#61;"">
8 asp:Title>
9 Titles>
10 <Series>
11 <asp:Series Name&#61;"Software" IsValueShownAsLabel&#61;"true" ChartType&#61;"Spline" XValueType&#61;"String" YValueMembers&#61;"TestValue" BorderColor&#61;"AliceBlue" BorderWidth&#61;"2">
12 asp:Series>
13 Series>
14 <ChartAreas>
15 <asp:ChartArea Name&#61;"ChartArea1" BackColor&#61;"Azure" BackSecondaryColor&#61;"White" BackGradientStyle&#61;"TopBottom">
16 <AxisX LineColor&#61;"Blue" LineWidth&#61;"2" TitleForeColor&#61;"Red" TextOrientation&#61;"Horizontal" ToolTip&#61;"Software">
17 <MinorGrid Interval&#61;"1" LineColor&#61;"Blue" />
18 AxisX>
19 <AxisY LineColor&#61;"Blue" LineWidth&#61;"2" Title&#61;"TestValue(Unit:mAh)" TitleForeColor&#61;"Red" TitleAlignment&#61;"Far">
20 <MinorGrid Interval&#61;"1" LineColor&#61;"Blue" />
21 AxisY>
22 asp:ChartArea>
23 ChartAreas>
24 asp:Chart>
后台&#xff1a;
1 Chart1.Titles["Title1"].Text &#61; ddlCase.SelectedItem.Text;//整个图表的标题
2 Chart1.Series["Software"].ChartType &#61; SeriesChartType.Spline;
3 Chart1.Series["Software"].Points.DataBind(dtLine.DefaultView, "Show", "TestValue", "");
4
5 //设置Chart的外观
6 Chart1.ChartAreas["ChartArea1"].AxisX.Interval &#61; 1.0;
7 Chart1.ChartAreas["ChartArea1"].AxisX.IntervalOffset &#61; 1;
8 Chart1.ChartAreas["ChartArea1"].AxisX.IsLabelAutoFit &#61; true;
9 Chart1.ChartAreas["ChartArea1"].AxisX.LineColor &#61; Color.Blue;
10 Chart1.ChartAreas["ChartArea1"].AxisX.TextOrientation &#61; TextOrientation.Rotated270;
11 Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.LineColor &#61; Color.Wheat;
12 Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.LineColor &#61; Color.Gray;
13 Chart1.DataBind();