如何将系列分配给图表区域 [英] How to assign series to chart area
本文介绍了如何将系列分配给图表区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图将图表划分为2个不同的图表区域,并希望将2个不同的系列分配到2个不同的图表区域
我正在使用以下代码
< pre lang = c# > pltOutput.ChartAreas.Add( ChartAreaInvocation);
pltOutput.Series.Add(Constants.LEGEND_CYCLETIME);
pltOutput.Series.Add(Constants.LEGEND_LATENCY);
pltOutput.Series.Add(Constants.LEGEND_RT_SUCCESS);
pltOutput.Series.Add(Constants.LEGEND_RT_FAILED);
Constants.LEGEND_CYCLETIME.ChartArea = name;
我在下面的代码行中收到错误,同时将系列分配到图表区域
Constants.LEGEND_CYCLETIME.ChartArea = name 跨度>;
' string'不包含的定义 ' ChartArea'且没有扩展方法' ChartArea'接受类型' string'的第一个参数(你是否错过了使用指令或汇编参考?
谢谢
John
解决方案
这是Chart Control的基本实现:< br $> b $ b
//设计方:
< asp:chart id = yourchart runat = server 高度 = 280px 宽度 = 250px >
< 标题 >
< asp:标题 ShadowOffset = 3 名称 = Title1 / >
< / titles >
< 图例 >
< asp:图例 对齐 = 中心 停靠 = 底部 IsTextAutoFit = true 名称 = 默认 LegendStyle = 表格 / >
< / legends >
< series >
<asp:Series 名称 = 默认 / > < / series >
< chartareas >
< asp:ChartArea 名称 = ChartArea < span class =code-attribute> BorderWidth = 0 / >
< < span class =code-leadattribute> / chartareas >
< / asp:chart >
// 编码方
yourchart.Series [ 0 ]。XValueMember = YourColumn;
yourchart.Series [ 0 ]。YValueMembers = YourColumn跨度>;
yourchart.Series [ 默认]。IsValueShownAsLabel = 真跨度>;
yourchart.Series [ 默认]。ChartType = SeriesChartType.Pie;
yourchart.Series [ 默认] [ PieLabelStyle] = 已禁用跨度>;
yourchart.ChartAreas [ ChartArea]。Area3DStyle.Enable3D = 假跨度>;
yourchart.Legends [ 0 ]。Enabled = true ;
// 添加图例文字栏
LegendCellColumn LegendTextColumn = new LegendCellColumn();
LegendTextColumn.ColumnType = LegendCellColumnType.Text;
LegendTextColumn.Text = #LEGENDTEXT;
yourchart.Legends [ 默认]。CellColumns.Add(LegendTextColumn);
Hi,
I trying to divide a chart into 2 different chart areas and want to assign 2 different series to 2 different chart areas
I am using the following code for this
<pre lang="c#"> pltOutput.ChartAreas.Add("ChartAreaInvocation");
pltOutput.Series.Add(Constants.LEGEND_CYCLETIME);
pltOutput.Series.Add(Constants.LEGEND_LATENCY);
pltOutput.Series.Add(Constants.LEGEND_RT_SUCCESS);
pltOutput.Series.Add(Constants.LEGEND_RT_FAILED);
Constants.LEGEND_CYCLETIME.ChartArea = "name";
I am getting a error in the following line of code while assigning series to chart area
Constants.LEGEND_CYCLETIME.ChartArea = "name";
'string' does not contain a definition for 'ChartArea' and no extension method 'ChartArea' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?
Thanks
John
解决方案
This is the basic implememtion of Chart Control:
//design side: <asp:chart id="yourchart" runat="server" Height="280px" Width="250px"> <titles> <asp:Title ShadowOffset="3" Name="Title1" /> </titles> <legends> <asp:Legend Alignment="Center" Docking="Bottom" IsTextAutoFit="true" Name="Default" LegendStyle="Table" /> </legends> <series> <asp:Series Name="Default" /></series> <chartareas> <asp:ChartArea Name="ChartArea" BorderWidth="0" /> </chartareas> </asp:chart>
//Coding Side yourchart.Series[0].XValueMember = "YourColumn"; yourchart.Series[0].YValueMembers = "YourColumn"; yourchart.Series["Default"].IsValueShownAsLabel = true; yourchart.Series["Default"].ChartType = SeriesChartType.Pie; yourchart.Series["Default"]["PieLabelStyle"] = "Disabled"; yourchart.ChartAreas["ChartArea"].Area3DStyle.Enable3D = false; yourchart.Legends[0].Enabled = true; //Add Legend Text Column LegendCellColumn LegendTextColumn = new LegendCellColumn(); LegendTextColumn.ColumnType = LegendCellColumnType.Text; LegendTextColumn.Text = "#LEGENDTEXT"; yourchart.Legends["Default"].CellColumns.Add(LegendTextColumn);
这篇关于如何将系列分配给图表区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文