Click here to Skip to main content
13,287,856 members (53,052 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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">
               <asp:Legend Docking="Left" BackColor="#cccccc"></asp:Legend>
               <asp:Series Name="Series1" ChartType="Column" XValueType="String" ChartArea="ChartArea2" >
                       <asp:DataPoint XValue="1" YValues="20"  />
                       <asp:DataPoint XValue="2" YValues="10" />
                       <asp:DataPoint XValue="3" YValues="30" />
               <asp:Series Name="Series2" ChartType="Column" XValueType="String" ChartArea="ChartArea2">
                       <asp:DataPoint XValue="1" YValues="20" />
                       <!-- here is missed datapoint -->
                       <asp:DataPoint XValue="3" YValues="30" />
                <asp:Series Name="Series3" ChartType="Column"  XValueType="String" ChartArea="ChartArea2">
                       <asp:DataPoint XValue="1" YValues="100" />
                       <asp:DataPoint XValue="2" YValues="100" />
                       <asp:DataPoint XValue="3" YValues="100" />
               <asp:ChartArea Name="ChartArea2">

Please someone help me to fix this....
Posted 28-Dec-11 18:48pm
Updated 28-Dec-11 18:50pm
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.
Rate this: bad
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171207.1 | Last Updated 8 Nov 2012
Copyright © CodeProject, 1999-2017
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