0
votes

I have asp.net chart intervel issue. I am feed data to chart like below

X1        Y1       X2          Y2
100    907     500        2395
100    745     500        2343
100    760     500        2403

Each row is a series in the chart.

In am iterating each row in code and making new serie and adding to chart

 series1.Points.AddXY(dt.Rows(i)(0).ToString, dt.Rows(i)(1).ToString)
 series1.Points.AddXY(dt.Rows(i)(2).ToString, dt.Rows(i)(3).ToString)

chart is coming like it is fine.

enter image description here

Now I want make intervel like 100,200,300,400, 500 (500 is max of the graph).

I tried Chart1.ChartAreas(0).AxisX.Interval = 100, It did not worked out.

1

1 Answers

1
votes

You can do it in markup:

    <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1">
    <Series>
        <asp:Series ChartType="Line" Name="Series1" XValueMember="ID" 
            YValueMembers="Status">
        </asp:Series>
    </Series>
    <ChartAreas>
        <asp:ChartArea Name="ChartArea1">
            <AxisX Interval="30" IntervalType="Number">
            </AxisX>
        </asp:ChartArea>
    </ChartAreas>
</asp:Chart>