简体   繁体   中英

MS Chart drawing line on incorrect points

I have line chart which has values :

 flock_age = 

    X-axis = 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38

    egg_mass_weekly 

    Y-axis = 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 327.78, 403.90, 420.35, 425.25, 441.35, 446.11, 444.50, 454.86, 450.38, 458.57, 463.96, 463.33, 464.66, 398.46, 0.00

    <asp:Chart ID="ChartEggMass" runat="server" Height="436px" Width="810px"> 
    <Titles><asp:Title Text="Egg Mass Per Bird" Alignment="TopCenter" /></Titles> 
    <legends> 
        <asp:legend Enabled="true" IsTextAutoFit="False" Name="Default" BackColor="Gainsboro" Font="Trebuchet MS, 6.25pt, style=Bold"></asp:legend>
    </legends>

    <borderskin skinstyle="Emboss"></borderskin> 

    <ChartAreas> 

    <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" BackColor="Gainsboro" ShadowColor="Transparent" BackGradientStyle="TopBottom">

    <area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle>

    <axisy linecolor="64, 64, 64, 64" IsLabelAutoFit="False" Minimum="-50" Maximum="450" Interval="50" IntervalType="Number" Title="Weight in grammes" TitleFont="Trebuchet MS, 6.25pt, style=Bold">
        <labelstyle font="Trebuchet MS, 7.25pt, style=Bold" />
        <majorgrid linecolor="64, 64, 64, 64" />
    </axisy>
    <axisx linecolor="64, 64, 64, 64" IsLabelAutoFit="False" Minimum="16" Maximum="72" Interval="1" IntervalType="Number" Title="Age of flocks in weeks" TitleFont="Trebuchet MS, 6.25pt, style=Bold" >
        <labelstyle font="Trebuchet MS, 4.25pt, style=Bold" />
        <majorgrid linecolor="64, 64, 64, 64" />
     </axisx>
    </asp:ChartArea>
    </ChartAreas> 
    </asp:Chart>



string seriesName2 = "Flock Actual";  ChartEggMass.Series.Add(seriesName2); ChartEggMass.Series[seriesName2].ChartType
= SeriesChartType.Spline;  ChartEggMass.Series[seriesName2].BorderWidth
= 2; ChartEggMass.Series[seriesName2].Color
= System.Drawing.Color.Black;

//for test puspose for (int i = 0; i < egg_mass_weekly.Length; i++)  { Double tmp = 0; ChartEggMass.Series[seriesName2].Points.AddXY(flock_age[i],Double.TryParse(egg_mass_weekly[i], out tmp)?tmp:0);  ChartEggMass.Series[seriesName2].Points[i].IsValueShownAsLabel=true; }

when we set IsValueShownAsLabel=true on y-axis it shows value 0.

but graph showing values below zero at last 0.00 before 327.78.

Because I m new user cannot upoad image please have a look Chart image from below url: http://www.freeimagehosting.net/uploads/84c7d1e2f7.png

Your assistance in resolving this problem would be much appreciated.

您的图表不会显示低于0.0的数据 ,但是由于您选择了Spline作为图表类型,因此图表控件将尝试绘制从0.0开始,从0.0到327.78结束的贝塞尔曲线,这会导致点滴'您会在线弯曲之前看到。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM