Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET VB.NET
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....
Posted 28-Dec-11 18:48pm
Edited 28-Dec-11 18:50pm
v2
Comments
Dinesh Mani at 28-Dec-11 23:52pm
   
Why not have a datapoint with "0" as the data???
Member 3746307 at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

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

  Print Answers RSS
0 OriginalGriff 190
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 Afzaal Ahmad Zeeshan 120
4 DamithSL 115
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 8 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100