Hi @Hema Ramachandran ,
I think you can use an if statement to determine whether y has a value,
if y has no value and the x point is empty, you can refer to the following example:
<asp:Chart ID="Chart1" runat="server">
<Series>
<asp:Series Name="Testing" YValueType="Int32">
<Points>
<asp:DataPoint AxisLabel="Test 1" YValues="10" />
<asp:DataPoint AxisLabel="Test 2" YValues=" " />
<asp:DataPoint AxisLabel="Test 3" YValues="0" />
<asp:DataPoint AxisLabel="Test 4" YValues="40" />
</Points>
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
code behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
For Each series As System.Web.UI.DataVisualization.Charting.Series In Chart1.Series
For Each point As System.Web.UI.DataVisualization.Charting.DataPoint In series.Points
If point.YValues.Length > 0 AndAlso CDbl(point.YValues.GetValue(0)) = 0 Then
point.LegendText = point.AxisLabel
point.AxisLabel = String.Empty
point.Label = String.Empty
End If
Next
Next
End Sub
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.