Jump to content
Sign in to follow this  
Fatum48

Excel Chart Series XValue and Value Question

Recommended Posts

Fatum48

Hi everyone!

I'm Working on a Excel project including many Charts added dynamically into sheets.

So far so good I can add the charts where I want and add series to them (I'm talking about charts of the style "Line with markers)

Usually in VBA I can set those values on a serie:

XValues = someRange

Values = someRange

Here's my code:

$oChartRng = $oSheet2.Range("H" & $oStoreDataDestRng.Row & ":P" & $iStoreAvgRow)
        $oNewChart = $oSheet2.ChartObjects.Add($oChartRng.Left, $oChartRng.Top, $oChartRng.Width, $oChartRng.Height)
        $oChart = $oNewChart.Chart
        $oChart.ChartType = 65
            
        
        For $j = 1 to 4
            $oNewChartSerie = $oChart.SeriesCollection.NewSeries ;- Working

            with $oChart.SeriesCollection($j)
                .Name = $aChartSeriesName[$j] ;- Working
                .Values = $aChartSeriesRng[$j] ;- Not Working
                .XValues = $aChartSeriesRng[0] ;- Not Working
            EndWith

        Next

The $aChartSeriesRng variant in an array filled with Range objects (which is working in VB) and seems to work in AutoIt also cause I can MsgBox(0,"",$aChartSeriesRng[$j].Address)

I've been searching all around the forum to find how to tell Autoit to assign the XValues and Values to a series and I did not find nothing about it. Ime wondering why the .Name is working and not .XValues or .Values

Usually AutoIt syntax for Excel is pretty near than VBA Syntax

Thanks very much for your help!

Share this post


Link to post
Share on other sites
PsaltyDS

Add a COM error handler (see OBJ\COM Reference in the help file) and see if you get more detailed failure indications.

You might also do something like this to see if the object type is as expected:

ConsoleWrite("Debug: ObjName = " & ObjName($oChart.SeriesCollection($j)) & @LF)

:blink:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
ValeryVal

I'm Working on a Excel project including many Charts added dynamically into sheets.

About embedded Excel, Chart under AutoIt3 see

AGraph_OWC_Embedded.au3


The point of world view

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.