MS Chart Legends:LegendItem item = new LegendItem(); item.Name = name; item.Color = Color.Red; ser1.IsValueShownAsLabel = false; Chart2.Legends["Legend1"].CustomItems.Add(item); Chart2.Series.Add(ser1);我只定义了一个,为什么却显示2个,求解? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是不是加了2次的原因Chart2.Legends["Legend1"].CustomItems.Add(item);Chart2.Series.Add(ser1);去掉一次 for (int ii = 0; ii < months.Count; ii++) { int id = 100; if (ddlTmHm.SelectedItem.Value == "0") { for (int iii = 0; iii < dt.Rows.Count; iii++) { if (months[ii].ToString() == dt.Rows[iii]["collecttime"].ToString()) { id = iii; break; } } DataPoint dp = new DataPoint(ii + 1, id == 100 ? "0" : dt.Rows[id]["temperature"].ToString()); dp.Label = id == 100 ? "0" : dt.Rows[id]["temperature"].ToString(); if (!isCreate) { CustomLabel lbl = new CustomLabel(); lbl.FromPosition = ii + 0.5; lbl.Text = months[ii].ToString(); lbl.ToPosition = ii + 1.5; Chart2.ChartAreas[0].AxisX.CustomLabels.Add(lbl); } ser1.Points.Add(dp);}isCreate = true; LegendItem item = new LegendItem(); item.Name = name; item.Color = Color.Red; ser1.IsValueShownAsLabel = false; Chart2.Legends["Legend1"].CustomItems.Add(item); Chart2.Series.Add(ser1);month=30 查询数据结果对应到Chart的XY轴1 1) string strSql = "SELECT Top 5 empid, COUNT(*) AS lNum FROM log where empid <> '' GROUP BY empid ORDER BY empid"; 2 DataSet ds = SqlHelper.ExecuteDataset(strConnISPD, CommandType.Text, strSql); 3 DataView dv = new DataView(ds.Tables[0]); 4 Chart1.Series["login"].Points.DataBindXY(dv, "empid", dv, "lNum"); 5 2) SqlCommand cd = new SqlCommand(strSql, conn); 6 SqlDataAdapter da = new SqlDataAdapter(); 7 da.SelectCommand = cd; 8 DataSet ds = new DataSet(); 9 da.Fill(ds, "log");10 DataView dv = new DataView(ds.Tables[0]);11 dv.Sort="empid";12 Chart1.Series["login"].Points.DataBindXY(dv, "empid", dv, "lNum");使用现有数组数据到Chart的XY轴1 double[] yValues = {12, 67, 45, double.NaN, 67, 89, 35, 12, 78, 54}; 2 double[] xValues = {1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999};3 Chart1.Series["Series1"].Points.DataBindXY(xValues, yValues); <asp:Chart ID="Chart2" runat="server" Palette="BrightPastel" BackColor="#D3DFF0" Width="900px" Height="360px" BorderDashStyle="Solid" BackGradientStyle="TopBottom" BorderWidth="2" BorderColor="26, 59, 105" IsSoftShadows="False"> <Titles> <asp:Title ShadowColor="32, 0, 0, 0" Font="楷体_GB2312, 14.25pt, style=Bold" ShadowOffset="3" Text="***" Alignment="TopLeft" ForeColor="26, 59, 105" Name="Title1"> <Position Y="2" Height="8.738057" Width="80" X="20"></Position> </asp:Title> </Titles> <Legends> <asp:Legend LegendStyle="Row" IsTextAutoFit="false" Name="Legend1" BackColor="Transparent" Font="楷体_GB2312, 9pt"> <CustomItems> </CustomItems> <Position Y="100" Height="12" Width="90" X="5"></Position> </asp:Legend> </Legends> <Series> </Series> <BorderSkin SkinStyle="Emboss" /> <ChartAreas> <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BackSecondaryColor="Transparent" BackColor="Transparent" ShadowColor="Transparent" BackGradientStyle="TopBottom"> <AxisX LineColor="64, 64, 64, 64" IsLabelAutoFit="False" Interval="1"> <LabelStyle Font="Trebuchet MS, 8.25pt" Interval="1" IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" /> <MajorGrid LineColor="64, 64, 64, 64" Interval="1" IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" /> <CustomLabels> </CustomLabels> <MajorTickMark Interval="1" IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" /> </AxisX> <InnerPlotPosition Height="86.60734" Width="90.64261" X="9.35739" Y="3.5" /> </asp:ChartArea> </ChartAreas> </asp:Chart> 问个导出EXCEL问题 使用itextsharp生成PDF时如何合并行、列 session[] 关于编码问题 datagrid读取单元格数据出错的问题 在线等 传值的错误 xml选择节点问题,来者有分! 愿奉献500分解决最后一个问题,关于EXCEL,大家请进来热烈讨论!!!!!!!!!!! Session 失效 怪事了 我们ASP.NET做的项目,现在想做成试用版,征求大家的方案,请大家踊跃发言! 网站如何跟手机通信?请高手们给点实现思路 用过微软的velocity分布式缓存吗?有个问题
Chart2.Legends["Legend1"].CustomItems.Add(item);
Chart2.Series.Add(ser1);去掉一次
for (int ii = 0; ii < months.Count; ii++)
{ int id = 100;
if (ddlTmHm.SelectedItem.Value == "0")
{
for (int iii = 0; iii < dt.Rows.Count; iii++)
{ if (months[ii].ToString() == dt.Rows[iii]["collecttime"].ToString())
{
id = iii;
break;
}
}
DataPoint dp = new DataPoint(ii + 1, id == 100 ? "0" : dt.Rows[id]["temperature"].ToString());
dp.Label = id == 100 ? "0" : dt.Rows[id]["temperature"].ToString(); if (!isCreate)
{
CustomLabel lbl = new CustomLabel();
lbl.FromPosition = ii + 0.5;
lbl.Text = months[ii].ToString();
lbl.ToPosition = ii + 1.5;
Chart2.ChartAreas[0].AxisX.CustomLabels.Add(lbl);
}
ser1.Points.Add(dp);
}
isCreate = true;
LegendItem item = new LegendItem();
item.Name = name;
item.Color = Color.Red;
ser1.IsValueShownAsLabel = false;
Chart2.Legends["Legend1"].CustomItems.Add(item);
Chart2.Series.Add(ser1);month=30
2 DataSet ds = SqlHelper.ExecuteDataset(strConnISPD, CommandType.Text, strSql);
3 DataView dv = new DataView(ds.Tables[0]);
4 Chart1.Series["login"].Points.DataBindXY(dv, "empid", dv, "lNum");
5 2) SqlCommand cd = new SqlCommand(strSql, conn);
6 SqlDataAdapter da = new SqlDataAdapter();
7 da.SelectCommand = cd;
8 DataSet ds = new DataSet();
9 da.Fill(ds, "log");
10 DataView dv = new DataView(ds.Tables[0]);
11 dv.Sort="empid";
12 Chart1.Series["login"].Points.DataBindXY(dv, "empid", dv, "lNum");使用现有数组数据到Chart的XY轴1 double[] yValues = {12, 67, 45, double.NaN, 67, 89, 35, 12, 78, 54};
2 double[] xValues = {1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999};
3 Chart1.Series["Series1"].Points.DataBindXY(xValues, yValues);
<asp:Chart ID="Chart2" runat="server" Palette="BrightPastel" BackColor="#D3DFF0"
Width="900px" Height="360px" BorderDashStyle="Solid" BackGradientStyle="TopBottom"
BorderWidth="2" BorderColor="26, 59, 105" IsSoftShadows="False">
<Titles>
<asp:Title ShadowColor="32, 0, 0, 0" Font="楷体_GB2312, 14.25pt, style=Bold" ShadowOffset="3"
Text="***" Alignment="TopLeft" ForeColor="26, 59, 105" Name="Title1">
<Position Y="2" Height="8.738057" Width="80" X="20"></Position>
</asp:Title>
</Titles>
<Legends>
<asp:Legend LegendStyle="Row" IsTextAutoFit="false" Name="Legend1" BackColor="Transparent"
Font="楷体_GB2312, 9pt">
<CustomItems>
</CustomItems>
<Position Y="100" Height="12" Width="90" X="5"></Position>
</asp:Legend>
</Legends>
<Series>
</Series>
<BorderSkin SkinStyle="Emboss" />
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BackSecondaryColor="Transparent"
BackColor="Transparent" ShadowColor="Transparent" BackGradientStyle="TopBottom">
<AxisX LineColor="64, 64, 64, 64" IsLabelAutoFit="False" Interval="1">
<LabelStyle Font="Trebuchet MS, 8.25pt" Interval="1" IntervalOffset="Auto" IntervalOffsetType="Auto"
IntervalType="Auto" />
<MajorGrid LineColor="64, 64, 64, 64" Interval="1" IntervalOffset="Auto" IntervalOffsetType="Auto"
IntervalType="Auto" />
<CustomLabels>
</CustomLabels>
<MajorTickMark Interval="1" IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
</AxisX>
<InnerPlotPosition Height="86.60734" Width="90.64261" X="9.35739" Y="3.5" />
</asp:ChartArea>
</ChartAreas>
</asp:Chart>