none
Set Interval on Chart

    Question

  • Hi,

    Each value on my Line Chart is between 90 and 100. However, the Y-Axis starts at 0 and ends at 100 in increments of 10. So the line looks almost straight.
    I want it to go 90-100 in increments of 1.

    How do I do this? Thanks.
                <asp:Chart ID="Chart1" runat="server">
                    <series>
                        <asp:Series Font="Verdana, 10px" Name="Series1" 
                            XValueMember="Day" YValueMembers="Result" 
                            IsValueShownAsLabel="True" YValuesPerPoint="4" 
                            CustomProperties="DrawingStyle=Cylinder" ChartType="FastLine">
                        </asp:Series>
                    </series>
                    <chartareas>
                        <asp:ChartArea Name="ChartArea1">
                            <AxisY IsLabelAutoFit="False" IntervalAutoMode="VariableCount">
                            </AxisY>
                            <AxisX Interval="1" LineColor="DarkBlue" IsLabelAutoFit="False">
                            </AxisX>
                        </asp:ChartArea>
                    </chartareas>
                </asp:Chart> 
    Tuesday, January 05, 2010 3:07 PM

Answers

  • you can try something like this, if you don't know the values beforehand.

    I add/subtract 5 so the high and low values are not at the top/bottom


    Chart1.ChartAreas(0).AxisY.Minimum = Chart1.Series(0).Points.FindMinByValue("Y1", 0).YValues(0) - 5
    Chart1.ChartAreas(0).AxisY.Maximum = Chart1.Series(0).Points.FindMaxByValue("Y1", 0).YValues(0) + 5



    • Marked as answer by obrienkev Wednesday, January 06, 2010 3:52 PM
    Wednesday, January 06, 2010 5:07 AM
    Moderator

All replies

  • Chart1.ChartAreas("ChartArea1").AxisY.Minimum = 90
    Chart1.ChartAreas("ChartArea1").AxisY.Maximum = 100
    Chart1.ChartAreas("ChartArea1").AxisY.Interval = 1

    Tuesday, January 05, 2010 3:16 PM
    Moderator
  • Chart1.ChartAreas("ChartArea1").AxisY.Minimum = 90
    Chart1.ChartAreas("ChartArea1").AxisY.Maximum = 100
    Chart1.ChartAreas("ChartArea1").AxisY.Interval = 1


    Hi,

    The values may not always be 1-90. Could be 1-30, etc.

    Any way to dynamically do this?

    Thanks.
    Tuesday, January 05, 2010 4:00 PM
  • you can try something like this, if you don't know the values beforehand.

    I add/subtract 5 so the high and low values are not at the top/bottom


    Chart1.ChartAreas(0).AxisY.Minimum = Chart1.Series(0).Points.FindMinByValue("Y1", 0).YValues(0) - 5
    Chart1.ChartAreas(0).AxisY.Maximum = Chart1.Series(0).Points.FindMaxByValue("Y1", 0).YValues(0) + 5



    • Marked as answer by obrienkev Wednesday, January 06, 2010 3:52 PM
    Wednesday, January 06, 2010 5:07 AM
    Moderator
  • you can try something like this, if you don't know the values beforehand.

    I add/subtract 5 so the high and low values are not at the top/bottom


    Chart1.ChartAreas(0).AxisY.Minimum = Chart1.Series(0).Points.FindMinByValue("Y1", 0).YValues(0) - 5
    
    Chart1.ChartAreas(0).AxisY.Maximum = Chart1.Series(0).Points.FindMaxByValue("Y1", 0).YValues(0) + 5
    
    




    Thanks!! That actually does work.
    Wednesday, January 06, 2010 3:52 PM