Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I need to add an expresion to a graph. I´ve been revised the classes and methods and I´ve found that tha classes GraphBasics and Graph have a method AddExpresion. The problem is that I can´t acces the graph. I can access with SheetObjects("CH01"), but the type returned is SheetObject, and iI need one of the previows ones. Is there a way of changing the types of a variable or to access directy to a graph???
Thanks.
I'm afraid you're wrong. Getting a reference with getsheetobject and then adding a dimension or expression works just fine for me. As does changing the charttype.
Here's an example from the API Guide qvw:
set chart = ActiveDocument.Sheets("Main").CreateBarChart
chart.AddDimension "ProductType"
chart.AddExpression "sum(Amount)"
set p = chart.GetProperties
p.GraphLayout.FastChange.Bar = true
p.GraphLayout.FastChange.Line = true
p.GraphLayout.FastChange.Combo = true
p.GraphLayout.FastChange.Pie = true
p.GraphLayout.FastChange.Scatter = false
p.GraphLayout.FastChange.Straight = false
p.GraphLayout.FastChange.Pivot = false
p.ChartProperties.FastChangeInChart = true
chart.SetProperties p
chart.SetChartType 4 'line
You can change the first line into something lik set chart = ActiveDocument.GetSheetObject("CH01") to get a reference to an existing chart
Hi
ActiveDocument.GetSheetObject("CH01") returns a SheetObject that hasn´t got the methods AddDimension, AddExpression or SetChartType. Those methods are from Graph, that is returned by CreateBarChart...
Finally I´ve used GetGraphs and getObjectId
Thx
I'm afraid you're wrong. Getting a reference with getsheetobject and then adding a dimension or expression works just fine for me. As does changing the charttype.
Hello
Don´t be afraid
I´ve just tried it again and it works fine. I don´t know what can I do wrong before.
Thanks a lot.