Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
XML
<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....
Posted
Updated 28-Dec-11 17:50pm
v2
Comments
Dinesh Mani 28-Dec-11 23:52pm    
Why not have a datapoint with "0" as the data???
Member 3746307 29-Dec-11 0:02am    
because the series datapoints values are I am getting from database.
So it's giving me only existing datapoints.

Please let me know, if im not clear.

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.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900