在ASP.NET图表系列中删除空Datapoint [英] Removing null Datapoint in ASP.NET Chart Series

查看:51
本文介绍了在ASP.NET图表系列中删除空Datapoint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个包含三个系列的图表,如下所示

series1具有3个数据点
series2有2个数据点
series3具有3个数据点

由于series2中的数据点不均匀,我在那个地方有空白.

以下是示例代码

Hi,

I have a chart with three series as below

series1 has 3 datapoints
series2 has 2 dataponts
series3 has 3 datapoints

because of uneven datapoint in series2, I have empty space on that place.

below is sample code

<asp:Chart ID="Chart2" runat="server"  Width="800px">
           <Legends>
               <asp:Legend Docking="Left" BackColor="#cccccc"></asp:Legend>
           </Legends>
           <Series>
               <asp:Series Name="Series1" ChartType="Column" XValueType="String" ChartArea="ChartArea2" >
                   <Points>
                       <asp:DataPoint XValue="1" YValues="20"  />
                       <asp:DataPoint XValue="2" YValues="10" />
                       <asp:DataPoint XValue="3" YValues="30" />
                   </Points>
               </asp:Series>
               <asp:Series Name="Series2" ChartType="Column" XValueType="String" ChartArea="ChartArea2">
                   <Points>
                       <asp:DataPoint XValue="1" YValues="20" />
                       <!-- here is missed datapoint -->
                       <asp:DataPoint XValue="3" YValues="30" />
                   </Points>
               </asp:Series>
                <asp:Series Name="Series3" ChartType="Column"  XValueType="String" ChartArea="ChartArea2">
                   <Points>
                       <asp:DataPoint XValue="1" YValues="100" />
                       <asp:DataPoint XValue="2" YValues="100" />
                       <asp:DataPoint XValue="3" YValues="100" />
                   </Points>
               </asp:Series>
           </Series>
           <ChartAreas>
               <asp:ChartArea Name="ChartArea2">
               </asp:ChartArea>
           </ChartAreas>
       </asp:Chart>



请有人帮我解决此问题....



Please someone help me to fix this....

推荐答案

IMO,IMO的正确行为是在缺少数据点的地方显示空格" ,但是如果您只想显示所有系列都包含值的点,则可以:
-修改SQL以检查所有系列中是否存在兄弟点
-例如,在数据上创建LINQ查询,以删除那些不需要的点并将其用作图形的数据源.
IMO it''s correct behaviour to show a ''space'' where you have a missing data point, but if you want to show only points where all of the series contain a value, then you could:
- modify the SQL to check the existence of sibling points in all series
- create for example a LINQ query on your data which removes those unwanted points and use that as the data source for your graph.


http://asp-net-example.blogspot.in/2010/09/how-to-empty-chart -specific-datapoint.html [ ^ ]


此链接可能会帮助您...
http://asp-net-example.blogspot.in/2010/09/how-to-empty-chart-specific-datapoint.html[^]


this link may be help you...


这篇关于在ASP.NET图表系列中删除空Datapoint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆