图形组件Chart动态添加Series

更新时间:2023-07-14 03:29:27 阅读: 评论:0

图形组件Chart动态添加Series  Chart1.DataSource = dtb;
string[] strcolor = new string[20];
strcolor[0] = "220, 224, 64, 10";
strcolor[1] = "220, 252, 180, 65";
strcolor[2] = "220, 159, 100, 100";
strcolor[3] = "220, 5, 100, 146";
strcolor[4] = "91,42,0";
strcolor[5] = "19,211,188";
strcolor[6] = "0,93,70";
strcolor[7] = "185,147,240";
strcolor[8] = "194,211,252";
strcolor[9] = "49,0,93";
strcolor[10] = "245,111,5";
正宗羊肉汤strcolor[11] = "203,72,178";
strcolor[12] = "93,93,0";
strcolor[13] = "165,165,147";
strcolor[14] = "124,201,15";
strcolor[15] = "14,112,201";
strcolor[16] = "0,59,93";
strcolor[17] = "5,18,108";
strcolor[18] = "245,15,54";
strcolor[19] = "121,129,234";
Chart1.Series.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
Chart1.Series.Add(i.ToString());//添加
雪花片
Chart1.Series[i.ToString()].ChartType = SeriesChartType.StackedBar;
Chart1.Series[i.ToString()].IsXValueIndexed = true;
Chart1.Series[i.ToString()].XValueMember = "Customer";
Chart1.Series[i.ToString()].YValueMembers = "StickCarQutity" + (i + 1);
Chart1.Series[i.ToString()].LegendText = dt.Rows[i]["level"].ToString();
Chart1.Series[i.ToString()].BorderColor = Color.FromArgb(180, 26, 59, 105);
Chart1.Series[i.ToString()].IsValueShownAsLabel = true;
if (i < 4)
{
string[] number = strcolor[i].ToString().Split(new Char[] { ',' });
int alpha = int.Par(number[0].ToString());
int red = int.Par(number[1].ToString());
int green = int.Par(number[2].ToString());
int blue = int.Par(number[3].ToString());
Chart1.Series[i.ToString()].Color = Color.FromArgb(alpha, red, green, blue);//颜⾊赋值
}
el
{
if(3<i&&i<20)
{
string[] number = strcolor[i].ToString().Split(new Char[] { ',' });
int red = int.Par(number[0].ToString());
int green = int.Par(number[1].ToString());
int blue = int.Par(number[2].ToString());
Chart1.Series[i.ToString()].Color = Color.FromArgb(red, green, blue);
医疗期规定
}
el
{
}
梦见吃稀饭
}
}
Chart1.DataBind();
html
<asp:Chart ID="Chart1" runat="rver" DataMember="DefaultView" Height="700px" Width="800px"> <Legends>心理学小说>蚂蚁
<asp:Legend Docking="Top" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8pt, style=Bold">
</asp:Legend>
</Legends>
<Series>
</Series>
学弈文言文翻译
<ChartAreas>
<asp:ChartArea Name="ChartArea1" IsSameFontSizeForAllAxes="True">
<AxisX LabelAutoFitMaxFontSize="8" LabelAutoFitMinFontSize="5" IsReverd="True">
<LabelStyle Font="Microsoft Sans Serif, 8pt" Interval="1" IntervalType="Auto"/>
<ScaleBreakStyle CollapsibleSpaceThreshold="10" LineColor="Transparent" BreakLineStyle="None"/>
<MinorGrid Interval="1" IntervalOfft="1" Enabled="Fal"/>
<MajorGrid Interval="Auto" Enabled="Fal"/>
<MajorTickMark Interval="Auto" Enabled="Fal"/>
<MinorTickMark Interval="1" Enabled="Fal"/>
</AxisX>
<AxisY LabelAutoFitMaxFontSize="8" LabelAutoFitMinFontSize="5">
<LabelStyle Interval="Auto" IntervalType="Auto"/>
搬家的讲究
</AxisY>
<AxisX2 LabelAutoFitMaxFontSize="8" LabelAutoFitMinFontSize="5">
<MinorGrid Interval="1" IntervalOfft="1" Enabled="Fal"/>
<MajorGrid Interval="Auto"/>
<MajorTickMark Interval="Auto"/>
<MinorTickMark Interval="1" Enabled="True"/>
<LabelStyle Font="Microsoft Sans Serif, 8pt"/>
</AxisX2>
<AxisY2 LabelAutoFitMaxFontSize="8" LabelAutoFitMinFontSize="5">
<LabelStyle Font="Microsoft Sans Serif, 7pt"/>
<MajorGrid Enabled="Fal"/>
</AxisY2>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>

本文发布于:2023-07-14 03:29:27,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1095419.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:组件   蚂蚁   翻译
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图