Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Team,

I am developing Excel charts using VB.Net, But now want to change Display Unit to "Thousand". I have below code -
VB
Dim chartPage As Microsoft.Office.Interop.Excel.Chart
            Dim xlCharts As Microsoft.Office.Interop.Excel.ChartObjects
            Dim myChart As Microsoft.Office.Interop.Excel.ChartObject
            Dim chartRange As Microsoft.Office.Interop.Excel.Range
            xlCharts = wks_new.ChartObjects

            myChart = xlCharts.Add(10, 30, 350, 250)
            myChart.Chart.ChartStyle = 42
            chartPage = myChart.Chart
            chartRange = wks_new.Range("A1:I20")
            chartPage.SetSourceData(Source:=chartRange, PlotBy:=XlRowCol.xlRows)
            chartPage.ChartType = Microsoft.Office.Interop.Excel.XlChartType.xlLineMarkers


I know below code in VBA -
myChart.Axes(xlValue).DisplayUnit = xlThousands


But how to do this in VB.Net???

Please Help!!!
Posted

1 solution

If you use Interop, look for xlAxisType and xlDisplayUnit

Here[^] you'll find MS Excel constants and them values.

VB
myChart.Axes(xlValue).DisplayUnit = xlThousands

is equal to
VB
myChart.Axes(2).DisplayUnit = -3
 
Share this answer
 
Comments
Pravinkarne.31 1-Mar-12 1:22am    
Thank You So Much!!! I was looking for this!!!
Maciej Los 1-Mar-12 16:23pm    
You're welcome!
ProEnggSoft 9-Mar-12 11:44am    
My 5
Maciej Los 9-Mar-12 13:11pm    
Thank you ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900