SecondaryValueAxis does not display

When I attempt to display a secondary axis, only the axis title is displayed. If I maually remove the axis from the chart and add it back it displays only 0 and the max value as the major grids. For now I've had to comment out the axis from the code.



Dim rngCategory As IRange = wks.Range(2, 1, wks.Rows.Length, 1)
Dim insideValues As IRange = wks.Range(2, 3, wks.Rows.Length, 3)
Dim outsideValues As IRange = wks.Range(2, 5, wks.Rows.Length, 5)
Dim differenceValues As IRange = wks.Range(2, 6, wks.Rows.Length, 6)

Dim chart As IChart = workBook.Charts.Add(chartSheetName)
chart.ChartType = ExcelChartType.Scatter_Line_Markers
chart.ChartTitle = chartTitle
chart.IsSeriesInRows = True

With chart.ChartTitleArea
.FontName = "Arial"
.Bold = True
.Size = 12
End With

'I fricking give up. No matter what I do I can't get the secondary axis to display.
'With chart.SecondaryValueAxis
'.Title = "Feet"
'.TitleArea.FontName = "Arial"
'.TitleArea.Bold = True
'.TitleArea.Size = 8
'.TitleArea.TextRotationAngle = 90
'.Font.Size = 8
'.HasMajorGridLines = True
'.HasMinorGridLines = False
'.IsAutoCross = True
'.MinimumValue = 0
'.MaximumValue = 10
'.MajorUnit = 0.5
'.MinorUnit = 0.5
'.CrossValue = 0
'End With

With chart.PrimaryValueAxis
.Title = "Corrected Elevation (ft AMSL)"
.TitleArea.FontName = "Arial"
.TitleArea.Bold = True
.TitleArea.Size = 8
.TitleArea.TextRotationAngle = 90
.HasMajorGridLines = True
.HasMinorGridLines = False
.IsAutoCross = True
.IsAutoMajor = True
.IsAutoMax = True
.IsAutoMin = True
End With

With chart.PrimaryCategoryAxis
.Title = "Distance"
.TitleArea.FontName = "Arial"
.TitleArea.Bold = True
.TitleArea.Size = 8
.TextRotationAngle = -90
.Font.Size = 8
End With

With chart.Series.Add()
.Name = String.Format("Inside{0}Corrected{0}Elevation", Me.LineFeed)
.Values = insideValues
.CategoryLabels = rngCategory
.UsePrimaryAxis = True
End With

With chart.Series.Add()
.Name = String.Format("Outside{0}Corrected{0}Elevation", Me.LineFeed)
.Values = outsideValues
.CategoryLabels = rngCategory
.UsePrimaryAxis = True
End With

With chart.Series.Add()
.Name = String.Format("Actual{0}Difference", Me.LineFeed)
.Values = differenceValues
.CategoryLabels = rngCategory
.UsePrimaryAxis = False
End With

chart.HasLegend = True
chart.Legend.Position = ExcelLegendPosition.Bottom

3 Replies

MW Melba Winshia Syncfusion Team March 30, 2007 05:03 AM UTC

Hi Jerome,

Thanks for your interest in Essential xlsIO.

You can display SecondaryValueAxis by using the following code snippets.

[VB.NET]

'Display secondary axis.
chart.SecondaryValueAxis.IsMaxCross=False

'To hide the secondary category axis
chart.SecondaryCategoryAxis.IsMaxCross=True

Please refer the following sample which implements the above said feature:

http://websamples.syncfusion.com//samples/XlsIO.Windows/F58832/main.htm

Kindly let me know if you have any other questions.

Regards,
Melba



JB Jerome Brown April 20, 2007 05:25 PM UTC

OK, that worked...
Thanks


MW Melba Winshia Syncfusion Team April 23, 2007 07:59 AM UTC

Hi Jerome,

Thanks for the update.

Kindly let me know if you have any other questions.

Thanks,
Melba

Loader.
Up arrow icon