We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

SecondaryValueAxis does not display

Thread ID:





58832 Mar 29,2007 07:38 AM Apr 23,2007 03:59 AM Windows Forms 3
Tags: XlsIO
Jerome Brown
Asked On March 29, 2007 07:38 AM

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

Melba Winshia [Syncfusion]
Replied On March 30, 2007 01:03 AM

Hi Jerome,

Thanks for your interest in Essential xlsIO.

You can display SecondaryValueAxis by using the following code snippets.


'Display secondary axis.

'To hide the secondary category axis

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


Kindly let me know if you have any other questions.


Jerome Brown
Replied On April 20, 2007 01:25 PM

OK, that worked...

Melba Winshia [Syncfusion]
Replied On April 23, 2007 03:59 AM

Hi Jerome,

Thanks for the update.

Kindly let me know if you have any other questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.