开发者

Primary X axis in MS chart control wont display max value?

I am using MS chart control .net 4 framework in Visual studio 2010 using Windows forms. I am having an issue with the scale of the primary x axis on a user input from a text box on a button click. I am also using both the primary and secondary y axes which work on a user input.

开发者_如何学GoI have checked the settings for each axis and they all have the same settings. I don't see why both y axes work on the user input and the x does not. Please help.

The following is the code I am using:

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

    Chart1.ChartAreas("Area1").AxisX.Minimum = Val(XPrimeMin.Text)
    Chart1.ChartAreas("Area1").AxisX.Maximum = Val(XPrimeMax.Text)
    Chart1.ChartAreas("Area1").AxisX.Interval = Val(XPrimeInterval.Text)
    Chart1.ChartAreas("Area1").AxisX.LabelStyle.Interval = Val(XPrimeInterval.Text)

    Chart1.ChartAreas("Area1").AxisY.Minimum = Val(YPrimeMin.Text)
    Chart1.ChartAreas("Area1").AxisY.Maximum = Val(YPrimeMax.Text)
    Chart1.ChartAreas("Area1").AxisY.Interval = Val(YPrimeInterval.Text)
    Chart1.ChartAreas("Area1").AxisY.LabelStyle.Interval = Val(YPrimeInterval.Text)

    Chart1.ChartAreas("Area1").AxisY2.Minimum = Val(YSecMin.Text)
    Chart1.ChartAreas("Area1").AxisY2.Maximum = Val(YSecMax.Text)
    Chart1.ChartAreas("Area1").AxisY2.Interval = Val(YSecInterval.Text)
    Chart1.ChartAreas("Area1").AxisY2.LabelStyle.Interval = Val(YSecInterval.Text)

End Sub

This is a screen shot of what I get while on auto-scale:

Primary X axis in MS chart control wont display max value?

This is after I set the Axes by user input:

Primary X axis in MS chart control wont display max value?


The solution that worked for me was to convert the value I was taking from the array to a double value before adding it to the series data point.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜