views:

541

answers:

3

Hi,

I have a graph created with MS Chart like the following picture. As you can see the vertical lines are messed up with value of the top of each bar.

alt text

Here's the mark-up for the graph:

        <asp:Chart ID="chtNBAChampionships" runat="server">
   <Series>
      <asp:Series Name="Championships" YValueType="Int32"  ChartType="Column" ChartArea="MainChartArea" IsValueShownAsLabel="true">
         <Points>
            <asp:DataPoint AxisLabel="Celtics" YValues="17" />
            <asp:DataPoint AxisLabel="Lakers" YValues="15" />
            <asp:DataPoint AxisLabel="Bulls" YValues="6" />
            <asp:DataPoint AxisLabel="Spurs" YValues="4" />
            <asp:DataPoint AxisLabel="76ers" YValues="3" />
            <asp:DataPoint AxisLabel="Pistons" YValues="3" />
            <asp:DataPoint AxisLabel="Warriors" YValues="3" />

         </Points>
      </asp:Series>
   </Series>
   <ChartAreas>
      <asp:ChartArea Name="MainChartArea">
      </asp:ChartArea>
   </ChartAreas>
</asp:Chart>

I don't want the display the vertical line because it's messed up with the value on top of the each bar. How can I disable the vertical line?

Thank you.

+1  A: 

I don't know the specific ASP syntax, but here is the VB.NET code that does the trick:

Dim gd As New System.Windows.Forms.DataVisualization.Charting.Grid
gd.LineWidth = 0

myChart.ChartAreas("MainChartArea").AxisX.MajorGrid = gd

As you can see, you can't just turn of the gridline, you have to set it's width to 0. The MinorGrid can be hidden the same way.

Stewbob
Yeap, that does the trick. Thank you.
Angkor Wat
A: 

This resolved the issue. Thanks.

Below is the c# code....

System.Web.UI.DataVisualization.Charting.Grid gd = new System.Web.UI.DataVisualization.Charting.Grid(); gd.LineWidth = 0; Chart1.ChartAreas[0].AxisX.MajorGrid = gd;

Amol Puri
A: 

simple way:

Chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
charles.art.br