Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
how can I set the average in a line chart via macro?
set Graph = ActiveDocument.GetSheetObject("CH341")
set prop = Graph.GetProperties
set expr = prop.Expressions.Item(1).Item(0).Data. ?????
expr.Enable = true
Graph.SetProperties prop
I think something like this should do it, but how can the average accessed via macro?
Hi,
You can use the below code :-
set Graph = ActiveDocument.Sheets("Main").CreateLineChart
Graph.AddDimension "ProductType"
Graph.AddExpression "avg(Amount)"
- Manish
Thanks for your answer. The problem is that I have several expressions and I want to plot the average for each of them. Because of that I want to access the settings in the Trend lines box via macro.
Hi,
I found it in the new API-guide:
sub AddAverage
set Graph = ActiveDocument.GetSheetObject("CH03")
set prop = Graph.GetProperties
set expr = prop.Expressions
c=expr.Count - 1
for i = 0 to c
Graph.AddTrend i,1,0
next
end sub
Wedge,
have you tried using reference lines to graph out your trend line(expression). I had stack bar graphs, and I was having troubles graphing a trendline for the whole graph because built in trendlines only work for individual expression. However, with reference lines you can add custom expressions and I was able to do a trend line for the stack bars.