Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can someone tell me how I can limit the number of characters in legends in a bar chart using macro? (Basically set the value which can be accessed using Properties > Presentation > Legend > Limit Legend. )
Checked the available APIs, but couldn't find any relevant API.
Hi Balaji,
may be you can define the space area of your legend to get your goal.
set Graph = ActiveDocument.Sheets("Main").CreateBarChart
Graph.AddDimension "ProductType"
Graph.AddDimension "Customer"
Graph.AddExpression "sum(Amount)"
set p = Graph.GetProperties
set leg = p.ChartProperties.Legend
leg.DockedPosition = 4 'free floating
leg.Position.Top = 100
leg.Position.Left = 100
leg.Position.Height = 200
leg.Position.Width = 200
leg.OnTop = true
leg.UserSized = true
Graph.SetProperties p
Regards
Corrado.
Found out the answer, need to use the API MaxStringLength to limit the number of characters in a chart.
Hi,
Could you please share the code that worked for you? I'm working on something similar (displaying the legend, on/off).
thanks!