У меня есть конкретная проблема с настройкой линий сетки оси X (радиальных) в диаграмме Excel из приложения VB.Net. Я хочу установить цвет.
Вот некоторые вещи, которые я пробовал на основе предложенных решений здесь и в других местах. Даже если свойство распознано, на диаграмме нет видимого эффекта.
'Sets the style of the radial gridlines as light grey, only none of this has any affect
With myStellarChart.Chart.Axes(1).MajorGridlines.Format.Line
.Visible = True
.ForeColor.RGB = RGB(240, 240, 240)
.Weight = 0.5
End With
'myStellarChart.Chart.Axes(1).MajorGridLines.Border.ColorIndex = RGB(240, 240, 240) 'No effect
'myStellarChart.Chart.Axes(1).MajorGridLines.LineColor = RGB(240, 240, 240) 'LineColor not recognised property
'myStellarChart.Chart.Axes(1).LineColor = RGB(240, 240, 240) 'LineColor not recognised property
'myStellarChart.Chart.Axes(1).MajorGrid.LineColor = RGB(240, 240, 240) 'MajorGrid Not recognised property
'myStellarChart.Chart.Axes(1).MajorGridLines.Color = RGB(240, 240, 240) 'Not recognised property
'myStellarChart.Chart.Axes(1).GridLines.Color = RGB(240, 240, 240) 'Not recognised property
'myStellarChart.Chart.Axes(1).MajorGridlines.Format.Line.Color = RGB(240, 240, 240) 'Color not recognised property
'myStellarChart.Chart.Axes(1).MajorGridLines.LineColor.RGB = RGB(240, 240, 240) 'LineColor not recognised property
myStellarChart.Chart.Axes(1).MajorGridLines.Format.Line.Visible = False 'No effect. Suggested google fix in VBA to make
myStellarChart.Chart.Axes(1).MajorGridLines.Format.Line.Visible = True
myStellarChart.Chart.Axes(1).MajorGridlines.Format.Line.ForeColor.RGB = RGB(240, 240, 240) 'No effect
myStellarChart.Chart.Axes(1).MajorGridlines.Format.Line.ForeColor.RGB = Color.Red 'No effect
myStellarChart.Chart.Axes(1).MajorGridLines.border.color = Microsoft.Office.Interop.Excel.XlRgbColor.rgbRed 'No effect
'myStellarChart.Chart.Axes(1).MajorGridlines.Format.Line.Color.RGB = Color.Red 'Color not recognised property
'This works as expected, so has to be a property of MajorGridlines....
'myStellarChart.Chart.Axes(1).MajorGridLines.Delete()
Кажется, это проблема только с осью X, ось Y (полярные линии) работает нормально.
'Sets the style of the polar gridlines as light grey.
With myStellarChart.Chart.Axes(2).MajorGridlines.Format.Line
.Visible = True
.ForeColor.RGB = RGB(230, 230, 230)
End With
Вы можете видеть на окончательной диаграмме (ссылка прилагается), что я почти достиг цели, но последняя настройка, которую требует мой конечный пользователь, — это уменьшить радиальные линии по умолчанию.
Заранее спасибо.