This is a migrated thread and some comments may be shown as answers.

Line YAxis Help

2 Answers 81 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Mitch
Top achievements
Rank 1
Mitch asked on 16 Sep 2009, 08:15 AM
Hello,

I'm graphing measurement results on a line with RadChart.  My problem is that the YAxis always starts at zero for the graph.  Many of the results may be between 0 and 1.   If the results are always 0, the graph always shows on the bottom of the graph along the X axis.

I'd like to make the YAxis start at say -5 so that the line is graphed in the middle of the graph instead across the bottom Xaxis.

I've played with YAxis Min/Max values, autoscale=false, and nothing seems to change the YAxis from starting at zero.

I've included my radchart definiation in the HTML and code behind pages.

Example results from my stored procedure that I'm graphing:
CollectDate,Reported Result, low range, high range
02/11/2008,      0,     0,    20 
03/10/2009,      1,     0,   20
04/10/2009,     1.5,   0 ,  20
05/10/2009,     1,      0 ,  20

Any help would be appreciated.

Thanks,

Mitch
<telerik:RadChart ID="RadChart1" runat="server" DataSourceID="SqlDataSource3"  
            DefaultType="Line" Skin="DeepBlue" Width="750px" Height="225px"  
            AutoLayout="True" EnableTheming="True"
            <Series> 
<telerik:ChartSeries Name="Reported Result"  
                    DataYColumn="Reported Result" Type="Line"  > 
    <Appearance> 
        <FillStyle MainColor="213, 247, 255" FillType="ComplexGradient"
            <FillSettings> 
                <ComplexGradient> 
                    <telerik:GradientElement Color="213, 247, 255" /> 
                    <telerik:GradientElement Color="193, 239, 252" Position="0.5" /> 
                    <telerik:GradientElement Color="157, 217, 238" Position="1" /> 
                </ComplexGradient> 
            </FillSettings> 
        </FillStyle> 
        <TextAppearance TextProperties-Color="White"
        </TextAppearance> 
    </Appearance> 
                </telerik:ChartSeries> 
</Series> 
            <PlotArea> 
                <XAxis AutoScale="False" DataLabelsColumn="collectdate" MaxValue="7"  
                    MinValue="1" Step="1" IsZeroBased="true"
                    <Appearance  TextAppearance-TextProperties-Font="Arial, 8.25pt, style=Bold"  
                        Color="98, 183, 226" MajorTick-Color="98, 183, 226"
                        <MajorGridLines Color="98, 183, 226" Width="0" Visible="false"/> 
                        <TextAppearance TextProperties-Color="White"
                        </TextAppearance> 
                    </Appearance> 
                    <AxisLabel> 
                        <Appearance Dimensions-Paddings="1px, 1px, 10%, 1px"
                        </Appearance> 
                        <TextBlock> 
                            <Appearance TextProperties-Color="LightSkyBlue"
                            </Appearance> 
                        </TextBlock> 
                    </AxisLabel> 
                   <Items> 
                        <telerik:ChartAxisItem Value="1"
                            <TextBlock Text="abc"
                                <Appearance TextProperties-Font="Arial, 8.25pt, style=Bold"
                                </Appearance> 
                            </TextBlock> 
                        </telerik:ChartAxisItem> 
                        <telerik:ChartAxisItem Value="2"
                            <TextBlock Text="abc"
                                <Appearance TextProperties-Font="Arial, 8.25pt, style=Bold"
                                </Appearance> 
                            </TextBlock> 
                        </telerik:ChartAxisItem> 
                        <telerik:ChartAxisItem Value="3"
                            <TextBlock Text="abc"
                                <Appearance TextProperties-Font="Arial, 8.25pt, style=Bold"
                                </Appearance> 
                            </TextBlock> 
                        </telerik:ChartAxisItem> 
                        <telerik:ChartAxisItem Value="4"
                            <TextBlock Text="abc"
                                <Appearance TextProperties-Font="Arial, 8.25pt, style=Bold"
                                </Appearance> 
                            </TextBlock> 
                        </telerik:ChartAxisItem> 
                        <telerik:ChartAxisItem Value="5"
                            <TextBlock Text="abc"
                                <Appearance TextProperties-Font="Arial, 8.25pt, style=Bold"
                                </Appearance> 
                            </TextBlock> 
                        </telerik:ChartAxisItem> 
                        <telerik:ChartAxisItem Value="6"
                            <TextBlock Text="abc"
                                <Appearance TextProperties-Font="Arial, 8.25pt, style=Bold"
                                </Appearance> 
                            </TextBlock> 
                        </telerik:ChartAxisItem> 
                        <telerik:ChartAxisItem Value="7"
                            <TextBlock Text="abc"
                                <Appearance TextProperties-Font="Arial, 8.25pt, style=Bold"
                                </Appearance> 
                            </TextBlock> 
                        </telerik:ChartAxisItem> 
                    </Items> 
                    
                </XAxis> 
                <YAxis AutoScale="false"
                    <Appearance Color="98, 183, 226" MajorTick-Color="98, 183, 226"  
                        MinorTick-Color="98, 183, 226"
                        <MajorGridLines Color="120, 209, 248" /> 
                        <MinorGridLines Color="120, 209, 248" Width="0" /> 
                        <TextAppearance TextProperties-Color="White"
                        </TextAppearance> 
                    </Appearance> 
                    <AxisLabel> 
                        <TextBlock> 
                            <Appearance TextProperties-Color="LightSkyBlue"
                            </Appearance> 
                        </TextBlock> 
                    </AxisLabel> 
                </YAxis> 
                <Appearance Dimensions-Margins="19%, 90px, 12%, 9%"
                    <FillStyle MainColor="50, 255, 255, 255" SecondColor="Transparent"
                    </FillStyle> 
                    <Border Color="97, 180, 223" /> 
                </Appearance> 
            </PlotArea> 
            <Appearance> 
                <FillStyle FillType="ComplexGradient"
                    <FillSettings> 
                        <ComplexGradient> 
                            <telerik:GradientElement Color="26, 120, 179" /> 
                            <telerik:GradientElement Color="35, 189, 254" Position="0.5" /> 
                            <telerik:GradientElement Color="26, 120, 179" Position="1" /> 
                        </ComplexGradient> 
                    </FillSettings> 
                </FillStyle> 
                <Border Color="0, 66, 110" Width="5" /> 
            </Appearance> 
            <ChartTitle> 
                <Appearance Dimensions-Margins="4%, 10px, 14px, 6%"
                    <FillStyle MainColor=""
                    </FillStyle> 
                </Appearance> 
                <TextBlock Text=""
                    <Appearance TextProperties-Font="Verdana, 14pt" TextProperties-Color="White"
                    </Appearance> 
                </TextBlock> 
            </ChartTitle> 
            <Legend Visible="False"
                <Appearance Dimensions-Margins="1px, 2%, 12%, 1px" Visible="False"
                    <ItemTextAppearance TextProperties-Color="White"
                    </ItemTextAppearance> 
                    <FillStyle GammaCorrection="False" MainColor="37, 255, 255, 255"
                    </FillStyle> 
                    <Border Color="76, 255, 255, 255" /> 
                </Appearance> 
                <TextBlock> 
                    <Appearance Position-AlignedPosition="Top" TextProperties-Color="LightSkyBlue"
                    </Appearance> 
                </TextBlock> 
            </Legend> 
        </telerik:RadChart> 

Protected Sub RadChart1_BeforeLayout(ByVal sender As ObjectByVal e As System.EventArgs) Handles RadChart1.BeforeLayout 
        Dim HiZone As Decimal 
        Dim LoZone As Decimal 
' Get Hi and Lo limits for result 
        HiZone = GetZoneHi(cboParam.SelectedValue, Request("EquipmentID"), Request("SampleNumber")) 
        LoZone = GetZoneLow(cboParam.SelectedValue, Request("EquipmentID"), Request("SampleNumber")) 
 
        RadChart1.Series(0).Appearance.PointMark.Dimensions.AutoSize = False 
        RadChart1.Series(0).Appearance.PointMark.Dimensions.Width = 8 
        RadChart1.Series(0).Appearance.PointMark.Dimensions.Height = 8 
        RadChart1.Series(0).Appearance.PointMark.FillStyle.MainColor = System.Drawing.Color.Black 
        RadChart1.Series(0).Appearance.PointMark.Visible = True 
 
 
        Dim markedzone As ChartMarkedZone = New ChartMarkedZone 
        markedzone.ValueStartY = LoZone 
        markedzone.ValueEndY = HiZone 
        markedzone.Appearance.FillStyle.MainColor = Drawing.Color.Gray 
 
        RadChart1.PlotArea.MarkedZones.Add(markedzone) 
 
 
        RadChart1.PlotArea.YAxis.MaxValue = (HiZone * 0.25) + HiZone  ' *10 
        RadChart1.PlotArea.YAxis.MinValue = -5 
        RadChart1.PlotArea.YAxis.AutoScale = True 
        Dim markedzone2 As ChartMarkedZone = New ChartMarkedZone 
 
        markedzone2.ValueStartY = 0 
        markedzone2.ValueEndY = LoZone 
        markedzone2.Appearance.FillStyle.MainColor = Drawing.Color.LightCoral 
        RadChart1.PlotArea.MarkedZones.Add(markedzone2) 
 
 
        Dim markedzone3 As ChartMarkedZone = New ChartMarkedZone 
 
        markedzone3.ValueStartY = HiZone 
        markedzone3.ValueEndY = HiZone + (HiZone * 0.25) 
        markedzone3.Appearance.FillStyle.MainColor = Drawing.Color.LightCoral 
        RadChart1.PlotArea.MarkedZones.Add(markedzone3) 
 
        RadChart1.Chart.Legend.Visible = False 
        RadChart1.AutoLayout = True 
 
                 
End Sub 

2 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 16 Sep 2009, 03:42 PM
I was just playing around with this using the chart wizard today and defining this within the <Yaxis> tag worked for me:

<YAxis AutoScale="False" MaxValue="1000" MinValue="-100" Step="100"

This allowed me to see a little below my graph so that I could properly see my rendered points. The step value should of course be reduced for your 0-1 scenario :)
0
Mitch
Top achievements
Rank 1
answered on 18 Sep 2009, 07:19 AM
That helped, thanks.  After some debugging, I realized that some of my functions that were to bring in the high and low ranges were returning 0s which wasn't helping the cause.

Thanks again,

Mitch
Tags
Chart (Obsolete)
Asked by
Mitch
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Mitch
Top achievements
Rank 1
Share this question
or