VB2010 与 Mschart 控件坐标轴设计
用VB2010,要求在一个图中绘制两条曲线,横坐标相同,纵坐标不一样,尝试用VB2010结合MSchart控件来实现,结果是右侧的y轴既没有显示标题也没有显示刻度值,各位大虾帮忙看看如何解决?代码如下:程序代码:
With Chart1.ChartAreas("Default") .BackColor = Color.FromName("GradientInactiveCaption") '设置绘图区颜色 .BackGradientStyle = GradientStyle.HorizontalCenter '设置绘图区颜色渐变方式 .AxisX.IsMarginVisible = False .AxisY.IsMarginVisible = False .AxisY2.Enabled = True .AxisX2.Enabled = True .AxisX2.IsMarginVisible = False .AxisY2.IsMarginVisible = False .AxisX.Title = "时间" 'x轴名称 .AxisY.Title = "标准值" '左侧y轴名称 .AxisX.LineWidth = 1 .AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Dot .AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dot .BorderDashStyle = ChartDashStyle.Solid .BorderWidth = 1 .AxisX.Minimum = 0 .AxisX.Maximum = 25 .AxisX2.Minimum = 0 .AxisX2.Maximum = 25 .Position.X = 0 .Position.Y = 10 .Position.Height = 90 .Position.Width = 96 .AxisX.Minimum = 0 .AxisX.Maximum = 25 .AxisY.Minimum = 0.0 .AxisY.Maximum = 10.0 .AxisY2.Title = "温度" '右侧y轴名称 .AxisY2.Minimum = 0 .AxisY2.Maximum = 100 .AxisY2.MajorTickMark.Interval = 10 End With Chart1.Titles.Clear() Dim NewTitle1 As New Title("测试曲线") '建立标题 NewTitle1.Text = "测试曲线" Chart1.Titles.Add(NewTitle1) Chart1.Series.Clear() '清除所有数据集 Dim newSeries1 As New Series("标准值") '新增数据集 newSeries1.ChartType = SeriesChartType.Line '直线 newSeries1.Color = Color.Blue newSeries1.IsValueShownAsLabel = False newSeries1.IsVisibleInLegend = False Chart1.Series.Add(newSeries1) Dim newseries3 As New Series("下限值") newseries3.ChartType = SeriesChartType.Line '直线 newseries3.Color = Color.Green newseries3.BorderWidth = 2 newseries3.IsValueShownAsLabel = False newseries3.IsVisibleInLegend = False newseries3.MarkerStyle = MarkerStyle.Square newseries3.MarkerStep = 10 Chart1.Series.Add(newseries3)