Number Formating Chart axis using Lilo StarBasic Macro code

I have a chart and i want to change the default number formating of oYaxis from eg. 2,50 to 2.5.
but I am failing to do that. What I must do?

See section “NumberFormats”

' XrayTool that helps to investigate VBA objects. 
' Found here: https://berma.pagesperso-orange.fr/index2.html 
' Download word document and click the button inside to install 
' it.

Sub LoadingLibraries
 BasicLibraries.LoadLibrary("XrayTool")
End Sub



Sub CreateCalcWithSimpleChart

' Definitions of variables
Dim oSheet    'Sheet containing the chart
Dim oRect     'How big is the chart
Dim oCharts   'Charts in the sheet
Dim oChart    'Created chart
Dim oAddress  'Address of data to plot
Dim sName$    'Chart name
Dim oChartDoc 'Embedded chart object
Dim oTitle    'Chart title object 
Dim oDiagram  'Inserted diagram (data).
Dim sDataRng 'Where is the data
Dim oCalcDoc  

' it is needed to define Point and Size in order to
' change Position and Size of Chart Objects
Dim Pos_Chart       As New com.sun.star.awt.Point
Dim Pos_Title       As New com.sun.star.awt.Point
Dim Pos_SubTitle    As New com.sun.star.awt.Point
Dim Pos_xTitle      As New com.sun.star.awt.Point
Dim Pos_yTitle      As New com.sun.star.awt.Point
Dim Pos_Legend      As New com.sun.star.awt.Point

Dim Size_Chart      As New com.sun.star.awt.Size
Dim Size_Title      As New com.sun.star.awt.Size
Dim Size_SubTitle   As New com.sun.star.awt.Size
Dim Size_xTitle     As New com.sun.star.awt.Size
Dim Size_yTitle     As New com.sun.star.awt.Size
Dim Size_Legend     As New com.sun.star.awt.Size



'Dont Forget to Define "Name of Sheet
oSheets     = ThisComponent.getSheets()
oSheet      = oSheets.getbyName( "Graphs_stat" ) 

'To define cell Titles and Cell Ranges here, directly
'Const DataRanges  = "B17:C28,E17:G28,L17:O28,T17:V28,AA17:AE28,AN17:AR28,BB17:BD28,BO17:BS28,BY17:CB28,CG17:CI28,CS17:CW28,DB17:DF28,DL17:DN28,DU17:DX28,EF17:EK28,ET17:EV28,FA17:FD28,FJ17:FL28,FV17:FZ28,GD17:GF28,GM17:GO28"
'split_DataRanges  =  Split(DataRanges,",")
'Const ChartTitles = "B17,E17,L17,T17,AA17,AN17,BB17,BO17,BY17,CG17,CS17,DB17,DL17,DU17,EF17,ET17,FA17,FJ17,FV17,GD17,GM17"
'split_ChartTitles =  Split(ChartTitles,",")

'Cell contains Cell Ranges as string eg. "B17:C28,E17:G28,L17:O28,T17:V28"
DataRanges       = oSheet.getCellRangeByName("E15")
split_DataRanges = Split(DataRanges.String,",")

'Cell contains Title Cells as string eg. "B17,E17,L17,T17,AA17"
ChartTitles       = oSheet.getCellRangeByName("E14")
split_ChartTitles = Split(ChartTitles.String,",")

   
   
 ' Define Colours
 cLightBlue      = RGB(180,199,220)
 cLightPurple    = RGB(224,194,205)
 cLightGreen     = RGB(175,208,149)
 cBlue           = RGB(114,159,207)
 cElectricBlue   = RGB(86,10,216)
 cOrange         = RGB(232,162,2)
 cGreen          = RGB(63,175,70)
 cYellow         = RGB(255,255,175) 
 
 cBlack          = RGB(49,64,4 )
 cGray           = RGB(221,221,221 )
 cWhite          = RGB(255,255,255) 
 
   
 'Itirate in order to create Charts for each data table in this Sheet
   for i  = 0 to 1 step 1

        Chart_XPos       = 0
        Chart_YPos       = 17000
        Chart_Width      = 16000
        Chart_Height     = 10000
 		Chart_New_XPos   =  Chart_New_XPos + Chart_Width + 900
		if i = 0 then Chart_New_XPos = 0
		        
		DefaultChartName  = "statChart_"
		genChartName      =  DefaultChartName & i
		
		'Creation of objects into variables
		oCalcDoc    = CreateCalcForChart()
		sName       = genChartName
		sDataRng    = split_DataRanges(i)
		oAddress    = oSheet.getCellRangeByName(sDataRng).getRangeAddress()
		oCharts     = oSheet.getCharts()
		oRange      = oSheet.getCellRangeByName( split_DataRanges(i) )
		
		
		'The size of the whole chart 
		If NOT oCharts.hasByName(sName) Then
		oRect       = createObject("com.sun.star.awt.Rectangle")
		oRect.X     = Chart_New_XPos
		oRect.Y     = Chart_YPos
		oRect.width = Chart_Width
		oRect.Height= Chart_Height
		oCharts.addNewByName(sName, oRect, Array(oAddress), True, True)
		End If		
		
		' Getting the Chart for manipulations
		oChart     = oCharts.getByName(sName)  
		oChart.setRanges(Array(oAddress))
		oChartDoc  = oChart.getEmbeddedObject()
		oDiagram   = oChartDoc.createInstance("com.sun.star.chart.ChartDiagram")
		oChartDoc.setDiagram(oDiagram)  
		oDiagram   = oChartDoc.getDiagram()
		
		'Inside the Chart, Setting Position and Size of the Diagram
		oChartDoc.RefreshAddInAllowed = True
		Pos_Chart.X                   = 400
		Pos_Chart.Y                   = 1510
		Size_Chart.width              = Chart_Width  - 1000
		Size_Chart.height             = Chart_Height - 2000
		oDiagram.setPosition( Pos_Chart )
		oDiagram.setSize(     Size_Chart )
		
		oDiagram.Wall.FillColor       = cYellow + 0
		
		'Min / Max scale values on x-y axis plus Font format
		oDiagram.HasXAxis             = True
		oDiagram.HasXAxisDescription  = True
		oDiagram.HasXAxisTitle        = False
		oDiagram.HasXAxis             = True
		oXaxis                        = oDiagram.getXAxis()
		oXaxis.AutoMin                = False
		oXaxis.AutoMax                = False
		oXaxis.Min                    = 1
		oXaxis.Max                    = 5
		oXaxis.CharColor              = cElectricBlue + 0
		oXaxis.CharFontName           = "Liberation San"
		oXaxis.CharHeight             = 11              ' Font Size
		oXaxis.CharWeight             = 110             ' Bold in %
		oXaxis.CharPosture            = 0               ' Italics
	
		
		oDiagram.HasYAxis             = True
		oDiagram.HasYAxisDescription  = True
		oDiagram.HasYAxisTitle        = False
		oDiagram.HasYAxis             = True
		oYaxis                        = oDiagram.getYAxis()
		oYaxis.AutoMin                = False
		oYaxis.AutoMax                = False
		oYaxis.Min                    = 1
		oYaxis.Max                    = 5
		oYaxis.CharColor              = cBlack
		oYaxis.CharFontName           = "Liberation San"
		oYaxis.CharHeight             = 8              ' Font Size
		oYaxis.CharWeight             = 120             ' Bold in %
		oYaxis.CharPosture            = 0               ' Italics

		oLocale = oYaxis.getPropertyValue("CharLocale")
		oLocale.Language = "rue"
		oLocale.Country  =  "rue"
		oLocale.Variant  =  ""
		
		NumberFormats = oYaxis.NumberFormats
		NumberFormatString = "#.0"

     	NumberFormatId = NumberFormats.queryKey(NumberFormatString, oLocale , True)
    
   If NumberFormatId = -1 Then
      NumberFormatId = NumberFormats.addNew(NumberFormatString, oLocale)
    End If
       oYaxis.NumberFormat = NumberFormatId
       
	MsgBox NumberFormatId
	MsgBox oYaxis.NumberFormat

 
		'Position and Size of x axis Title plus Font format
		'oXaxis.AxisTitle.string      ="ccccc"
		oXaxis.AxisTitle.CharColor    = RGB(121,32,72)
		oXaxis.AxisTitle.CharFontName = "Liberation San"
		oXaxis.AxisTitle.CharHeight   = 10              ' Font Size
		oXaxis.AxisTitle.CharWeight   = 100             ' Bold in %
		oXaxis.AxisTitle.CharPosture  = 0               ' Italics
		
		Pos_xTitle.X                  = 1000
		Pos_xTitle.Y                  = 800
		Size_xTitle.width             = 18000
		Size_xTitle.height            = 8000
		oXaxis.setPosition( Pos_xTitle  )
		oXaxis.setSize(     Size_xTitle )
		
		
		'Position and Size of y axis Title plus Font Format
		'oYaxis.AxisTitle.string      ="ccccc"
		oYaxis.AxisTitle.CharColor    = RGB(11,63,23)
		oYaxis.AxisTitle.CharFontName = "Liberation San"
		oYaxis.AxisTitle.CharHeight   = 10              ' Font Size
		oYaxis.AxisTitle.CharWeight   = 100             ' Bold in %
		oYaxis.AxisTitle.CharPosture  = 0               ' Italics
		
		Pos_yTitle.X                  = 1000
		Pos_yTitle.Y                  = 800
		Size_yTitle.width             = 18000
		Size_yTitle.height            = 8000
		oYaxis.setPosition( Pos_yTitle  )
		oYaxis.setSize(     Size_yTitle )



	    cellTitle         = oSheet.getCellRangeByName( split_ChartTitles(i) )
	    
		'Formating Chart Title and Chart Subtitle
		oChartDoc.hasMainTitle       = True  
		oTitle                       = oChartDoc.getTitle()  
		oTitle.String                = cellTitle.getString() 
		oTitle.CharColor             = RGB(20,20,21)
		oTitle.CharFontName          = "Liberation San"
		oTitle.CharHeight            = 10             ' Font Size
		oTitle.CharWeight            = 150            ' Bold in %
		oTitle.CharPosture           = 1              ' Italics
		
		oChartDoc.hasSubTitle        = False  
		oSubTitle                    = oChartDoc.getSubtitle() 
		'oSubTitle.String            = "My title"
		'oSubTitle.CharColor         = RGB(20,32,202)
		'oSubTitle.CharFontName      = "Liberation San"
		'oSubTitle.CharHeight        = 10              ' Font Size
		'oSubTitle.CharWeight        = 150             ' Bold in %
		'oSubTitle.CharPosture       = 0               ' Italics
		
		
		'Position and Size of Chart Title and Chart Subtitle
		Pos_Title.X                  = 5000
		Pos_Title.Y                  = 0
		Size_Title.width             = 0
		Size_Title.height            = 0
		oTitle.setPosition( Pos_Title  )
		oTitle.setSize(     Size_Title )
		
		'Pos_SubTitle.X               = 5000
		'Pos_SubTitle.Y               = 800
		'Size_SubTitle.width          = 0
		'Size_SubTitle.height         = 0
		'oSubTitle.setPosition( Pos_SubTitle  )
		'oSubTitle.setSize(     Size_SubTitle )
		
		
		'Formating Chart Legend  
		oChartDoc.HasLegend           = True 
		oLegend                       = oChartDoc.getLegend()
		oLegend.AutomaticPosition     = True
		oLegend.Alignment             = 3
		oLegend.CharHeight            = 10             ' Font Size
		oLegend.CharWeight            = 150            ' Bold in %
		oLegend.CharFontName          = "Liberation San"
		oLegend.FillColor             = cGray + 0 
		oLegend.CharColor             = cBlack
		oLegend.CharPosture           = 0               'Italics
 

		' Position and Size of Chart Legend  
		Size_Legend.Width             = Chart_Width  / 2
		Size_Legend.Height            = Chart_Height / 9
		Pos_Legend.X                  = Chart_Width - Size_Legend.Width
		Pos_Legend.Y                  = 0  
		oLegend.setPosition( Pos_Legend )
		oLegend.setSize(     Size_Legend )
		
	     NumberOfBars    = oRange.Columns.Count - 2

         genColors = array( cLightBlue, cLightPurple, cLightGreen, _
                            cBlue, cOrange, cGreen, cBlack)

	    for ii =  0 to NumberOfBars step 1
            BarColor                   = oDiagram.getDataRowProperties(ii)
            BarColor.FillTransparence  = 0
	        BarColor.FillStyle         = 1
	        BarColor.FillBackground    = True
	        BarColor.FillColor         = genColors(ii)
	       
	      next ii    
      
    next i
   
       
end sub

I found that if I remove number formating from “source” from inside the graph, then the number formatting is set.

How I remove number formating fromsource?

Finally, I found what prevented to change sourced number formatting in chart axis.

It was required to set

    oYaxis.LinkNumberFormatToSource = False

and why do you need to do this stuff by macro ???

I am creating charts for a range of tables in a sheet.

However,
I cannot understand why I cannot use directly
oYaxis.NumberFormat = oYaxis.NumberFormats.addNew(NumberFormatYaxis, oLocale)

without using check point " If NumberFormatId = -1 Then"

do you know?

I found out that in fresh new created charts the shorter and cleaner code do the job (number format chart y axis)

    ' Number Formatting of Y Axis from "#,###" to "#.#" 
    oYaxis.LinkNumberFormatToSource = False
    oLocale               =  oYaxis.getPropertyValue("CharLocale")
    oLocale.Language      =  "rue"
    oLocale.Country       =  "RU"
    oLocale.Variant       =  ""
    NumberFormatYaxis     = "#.0"
    oYaxis.NumberFormat   = oYaxis.NumberFormats.queryKey(NumberFormatYaxis, oLocale, True)

do you know a way to put locale in a single line? I tried as array but i failed!

My final code… to generate charts for tables in a given sheet - you must give cell range of data, and cells with chart titles. Almost all other things are done automatically.

' XrayTool that helps to investigate VBA objects. 
' Found here: https://berma.pagesperso-orange.fr/index2.html 
' Download word document and click the button inside to install 
' it.


Sub LoadingLibraries
 BasicLibraries.LoadLibrary("XrayTool")
End Sub



Sub CreateCalcWithSimpleChart

' Definitions of variables
Dim oSheet    'Sheet containing the chart
Dim oRect     'How big is the chart
Dim oCharts   'Charts in the sheet
Dim oChart    'Created chart
Dim oAddress  'Address of data to plot
Dim sName$    'Chart name
Dim oChartDoc 'Embedded chart object
Dim oTitle    'Chart title object 
Dim oDiagram  'Inserted diagram (data).
Dim sDataRng 'Where is the data
Dim oCalcDoc  

' it is needed to define Point and Size in order to
' change Position and Size of Chart Objects
Dim Pos_Chart       As New com.sun.star.awt.Point
Dim Pos_Title       As New com.sun.star.awt.Point
Dim Pos_SubTitle    As New com.sun.star.awt.Point
Dim Pos_xTitle      As New com.sun.star.awt.Point
Dim Pos_yTitle      As New com.sun.star.awt.Point
Dim Pos_Legend      As New com.sun.star.awt.Point

Dim Size_Chart      As New com.sun.star.awt.Size
Dim Size_Title      As New com.sun.star.awt.Size
Dim Size_SubTitle   As New com.sun.star.awt.Size
Dim Size_xTitle     As New com.sun.star.awt.Size
Dim Size_yTitle     As New com.sun.star.awt.Size
Dim Size_Legend     As New com.sun.star.awt.Size



'Dont Forget to Define "Name of Sheet
oSheets     = ThisComponent.getSheets()
oSheet      = oSheets.getbyName( "Graphs_stat" ) 

'To define cell Titles and Cell Ranges here, directly
'Const DataRanges  = "B17:C28,E17:G28,L17:O28,T17:V28,AA17:AE28,AN17:AR28,BB17:BD28,BO17:BS28,BY17:CB28,CG17:CI28,CS17:CW28,DB17:DF28,DL17:DN28,DU17:DX28,EF17:EK28,ET17:EV28,FA17:FD28,FJ17:FL28,FV17:FZ28,GD17:GF28,GM17:GO28"
'split_DataRanges  =  Split(DataRanges,",")
'Const ChartTitles = "B17,E17,L17,T17,AA17,AN17,BB17,BO17,BY17,CG17,CS17,DB17,DL17,DU17,EF17,ET17,FA17,FJ17,FV17,GD17,GM17"
'split_ChartTitles =  Split(ChartTitles,",")

'Cell contains Cell Ranges as string eg. "B17:C28,E17:G28,L17:O28,T17:V28"
DataRanges       = oSheet.getCellRangeByName("E15")
split_DataRanges = Split(DataRanges.String,",")

'Cell contains Title Cells as string eg. "B17,E17,L17,T17,AA17"
ChartTitles       = oSheet.getCellRangeByName("E14")
split_ChartTitles = Split(ChartTitles.String,",")

   
   
 ' Define Colours
 cLightBlue      = RGB(180,199,220)
 cLightPurple    = RGB(224,194,205)
 cLightGreen     = RGB(175,208,149)
 cBlue           = RGB(114,159,207)
 cElectricBlue   = RGB(86,10,216)
 cOrange         = RGB(232,162,2)
 cGreen          = RGB(63,175,70)
 cYellow         = RGB(255,255,175) 
 
 cBlack          = RGB(49,64,4 )
 cGray           = RGB(221,221,221 )
 cWhite          = RGB(255,255,255) 
 
   
 'Itirate in order to create Charts for each data table in this Sheet
   for i  = 0 to 20 step 1

        Chart_XPos       = 0
        Chart_YPos       = 17000
        Chart_Width      = 16000
        Chart_Height     = 10000
 		Chart_New_XPos   =  Chart_New_XPos + Chart_Width + 900
		if i = 0 then Chart_New_XPos = 0
		        
		DefaultChartName  = "statChart_"
		genChartName      =  DefaultChartName & i
		
		'Creation of objects into variables
		oCalcDoc    = CreateCalcForChart()
		sName       = genChartName
		sDataRng    = split_DataRanges(i)
		oAddress    = oSheet.getCellRangeByName(sDataRng).getRangeAddress()
		oCharts     = oSheet.getCharts()
		oRange      = oSheet.getCellRangeByName( split_DataRanges(i) )
		
		
		'The size of the whole chart 
		If NOT oCharts.hasByName(sName) Then
		oRect       = createObject("com.sun.star.awt.Rectangle")
		oRect.X     = Chart_New_XPos
		oRect.Y     = Chart_YPos
		oRect.width = Chart_Width
		oRect.Height= Chart_Height
			
		oCharts.addNewByName(sName, oRect, Array(oAddress), True, True)
		End If		
		
		' Getting the Chart for manipulations
		oChart       = oCharts.getByName(sName)  
		oChart.setRanges(Array(oAddress))
		oChartDoc    = oChart.getEmbeddedObject()
		oDiagram     = oChartDoc.createInstance("com.sun.star.chart.ChartDiagram")
		oChartDoc.setDiagram(oDiagram)  
		oDiagram     = oChartDoc.getDiagram()
		
		'Inside the Chart, Setting Position and Size of the Diagram
		oChartDoc.RefreshAddInAllowed = True
		Pos_Chart.X                   = 300
		Pos_Chart.Y                   = 1200
		Size_Chart.width              = Chart_Width  - 800
		Size_Chart.height             = Chart_Height - 1500
		oDiagram.setPosition( Pos_Chart )
		oDiagram.setSize(     Size_Chart )
		
		oDiagram.Wall.FillColor       = cYellow + 0
	
		
		
		'Min / Max scale values on x-y axis plus Font format
		oDiagram.HasXAxis             = True
		oDiagram.HasXAxisDescription  = True
		oDiagram.HasXAxisTitle        = False
		oDiagram.HasXAxis             = True
		oXaxis                        = oDiagram.getXAxis()
		oXaxis.AutoMin                = False
		oXaxis.AutoMax                = False
		oXaxis.Min                    = 1
		oXaxis.Max                    = 5
		oXaxis.CharColor              = cElectricBlue + 0
		oXaxis.CharFontName           = "Liberation San"
		oXaxis.CharHeight             = 11              ' Font Size
		oXaxis.CharWeight             = 110             ' Bold in %
		oXaxis.CharPosture            = 0               ' Italics - see specs
	    oXaxis.TextBreak              = True            
        oXaxis.TextCanOverlap         = True
		
		oDiagram.HasYAxis             = True
		oDiagram.HasYAxisDescription  = True
		oDiagram.HasYAxisTitle        = False
		oDiagram.HasYAxis             = True
		oYaxis                        = oDiagram.getYAxis()
		oYaxis.AutoMin                = False
		oYaxis.AutoMax                = False
		oYaxis.Min                    = 1
		oYaxis.Max                    = 5
		oYaxis.CharColor              = cBlack
		oYaxis.CharFontName           = "Liberation San"
		oYaxis.CharHeight             = 8              ' Font Size
		oYaxis.CharWeight             = 120             ' Bold in %
		oYaxis.CharPosture            = 0               ' Italics
    
    
        ' Number Formatting of Y Axis from "#,###" to "#.#" 
        oYaxis.LinkNumberFormatToSource = False
		oLocale               =  oYaxis.getPropertyValue("CharLocale")
		oLocale.Language      =  "rue"
		oLocale.Country       =  "RU"
		oLocale.Variant       =  ""
        NumberFormatYaxis     = "#.0"
        oYaxis.NumberFormat   = oYaxis.NumberFormats.queryKey(NumberFormatYaxis, oLocale, True)





		'Position and Size of x axis Title plus Font format
		'oXaxis.AxisTitle.string       = "ccccc"
		'oXaxis.AxisTitle.CharColor    = RGB(121,32,72)
		'oXaxis.AxisTitle.CharFontName = "Liberation San"
		'oXaxis.AxisTitle.CharHeight   = 10              ' Font Size
		'oXaxis.AxisTitle.CharWeight   = 100             ' Bold in %
		'oXaxis.AxisTitle.CharPosture  = 0               ' Italics
		
		'Pos_xTitle.X                  = 1000
		'Pos_xTitle.Y                  = 800
		'Size_xTitle.width             = 18000
		'Size_xTitle.height            = 8000
		'oXaxis.setPosition( Pos_xTitle  )
		'oXaxis.setSize(     Size_xTitle )
		

		
		'Position and Size of y axis Title plus Font Format
		'oYaxis.AxisTitle.string       = "ccccc"
		'oYaxis.AxisTitle.CharColor    = RGB(11,63,23)
		'oYaxis.AxisTitle.CharFontName = "Liberation San"
		'oYaxis.AxisTitle.CharHeight   = 10              ' Font Size
		'oYaxis.AxisTitle.CharWeight   = 100             ' Bold in %
		'oYaxis.AxisTitle.CharPosture  = 0               ' Italics
		
		'Pos_yTitle.X                  = 1000
		'Pos_yTitle.Y                  = 800
		'Size_yTitle.width             = 18000
		'Size_yTitle.height            = 8000
		'oYaxis.setPosition( Pos_yTitle  )
		'oYaxis.setSize(     Size_yTitle )


	    cellTitle         = oSheet.getCellRangeByName( split_ChartTitles(i) )
	    
		'Formating Chart Title and Chart Subtitle
		oChartDoc.hasMainTitle       = True  
		oTitle                       = oChartDoc.getTitle()  
		oTitle.String                = cellTitle.getString() 
		oTitle.CharColor             = cBlack
		oTitle.CharFontName          = "Liberation San"
		oTitle.CharHeight            = 12             ' Font Size
		oTitle.CharWeight            = 170            ' Bold in %
		oTitle.CharPosture           = 0              ' Italics

		
		oChartDoc.hasSubTitle        = False  
		oSubTitle                    = oChartDoc.getSubtitle() 
		'oSubTitle.String            = "My title"
		'oSubTitle.CharColor         = RGB(20,32,202)
		'oSubTitle.CharFontName      = "Liberation San"
		'oSubTitle.CharHeight        = 10              ' Font Size
		'oSubTitle.CharWeight        = 150             ' Bold in %
		'oSubTitle.CharPosture       = 0               ' Italics
		
		
		'Position and Size of Chart Title and Chart Subtitle
		Pos_Title.X                  = 200
		Pos_Title.Y                  = 0
		Size_Title.width             = 0
		Size_Title.height            = 0
		oTitle.setPosition( Pos_Title  )
		oTitle.setSize(     Size_Title )
		
		'Pos_SubTitle.X               = 5000
		'Pos_SubTitle.Y               = 800
		'Size_SubTitle.width          = 0
		'Size_SubTitle.height         = 0
		'oSubTitle.setPosition( Pos_SubTitle  )
		'oSubTitle.setSize(     Size_SubTitle )
		
		
		'Formating Chart Legend  
		oChartDoc.HasLegend           = True 
		oLegend                       = oChartDoc.getLegend()
		oLegend.AutomaticPosition     = True
		oLegend.Alignment             = 3
		oLegend.CharHeight            = 8             ' Font Size
		oLegend.CharWeight            = 150            ' Bold in %
		oLegend.CharFontName          = "Liberation San"
		oLegend.FillColor             = cGray + 0 
		oLegend.CharColor             = cBlack
		oLegend.CharPosture           = 0               'Italics
 

		' Position and Size of Chart Legend  
		Size_Legend.Width             = Chart_Width  / 1.4
		Size_Legend.Height            = Chart_Height / 7.5
		Pos_Legend.X                  = Chart_Width - Size_Legend.Width
		Pos_Legend.Y                  = 0  
		oLegend.setPosition( Pos_Legend )
		oLegend.setSize(     Size_Legend )
		
	     NumberOfBars    = oRange.Columns.Count - 2

         genColors = array( cLightBlue, cLightPurple, cLightGreen, _
                            cBlue, cOrange, cGreen, cBlack)

	    for ii =  0 to NumberOfBars step 1
            BarColor                   = oDiagram.getDataRowProperties(ii)
            BarColor.FillTransparence  = 0
	        BarColor.FillStyle         = 1
	        BarColor.FillBackground    = True
	        BarColor.FillColor         = genColors(ii)
	       
	      next ii    
      
    next i
   
       
end sub
1 Like