簡體   English   中英

MS Chart繪圖線上的錯誤點

[英]MS Chart drawing line on incorrect points

我有具有值的折線圖:

 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; }

當我們在y軸上設置IsValueShownAsLabel = true時,它將顯示值0。

但圖表顯示的值在327.78之前的最后0.00處小於零。

由於我是新用戶,無法上傳圖片,請從以下網址查看圖表圖片: http ://www.freeimagehosting.net/uploads/84c7d1e2f7.png

非常感謝您在解決此問題方面的協助。

您的圖表不會顯示低於0.0的數據 ,但是由於您選擇了Spline作為圖表類型,因此圖表控件將嘗試繪制從0.0開始,從0.0到327.78結束的貝塞爾曲線,這會導致點滴'您會在線彎曲之前看到。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM