Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Change Font Size of Dimension Axis Label by Macro

Dear All,

I've created a bar chart and need to change the font size of label at Dimension Axis. I've found a way to do it thourgh Properties -> Axes ->Dimension Axis -> Font, but does anyone know how to change its size arbitrary, preferably by macro function? I couldn't find any tips even in the API guide.

Many Thanks in Advance.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Ok, found it by searching for one of the other features of the Dim axis.

sub chartfont
set chart = ActiveDocument.Sheets("Sheetname").CreateLineChart
chart.AddDimension "Product"
chart.AddExpression "sum(Sales)"
set p = chart.GetProperties
p.ChartProperties.XAxis.Font.PointSize1000 = 30000
chart.SetProperties p
end sub


View solution in original post

8 Replies
Anonymous
Not applicable
Author

Hi OGA,

The member is trickily named PointSize1000 and works like this:

sub DimFontSize
set chart = ActiveDocument.Sheets("SheetName").CreateLineChart
chart.AddDimension "Product"
chart.AddExpression "sum(Sales)"
set p = chart.GetProperties
p.Expressions.Item(0).Item(0).Data.AxisData.Font.PointSize1000 = 30000
chart.SetProperties p
end sub


Not applicable
Author

Hi, Johannes

Thanks for the reply. I've alredy found and tried this code, but this changes the font size of Expressions Axes labels. (it's generally called Y-Axis Label, maybe) But I need to change the one of Dimension Axis (called X-Axis, maybe).

Thanks for your help, though.

Anonymous
Not applicable
Author

Ah, sorry, was a bit quick on the old keyboard.

Right, dimension.. that was trickier. Can't find anything in the API guide either. Can only find font settings for Expression axes, Legend, Text objects and Title.

Not applicable
Author

Right. I've tried all of them...but didn't work for Dimension Axis.

Since I can change its font thourhg properties, I'm assuming there's got to be a way to change it by macro function...

Anonymous
Not applicable
Author

Ok, found it by searching for one of the other features of the Dim axis.

sub chartfont
set chart = ActiveDocument.Sheets("Sheetname").CreateLineChart
chart.AddDimension "Product"
chart.AddExpression "sum(Sales)"
set p = chart.GetProperties
p.ChartProperties.XAxis.Font.PointSize1000 = 30000
chart.SetProperties p
end sub


Not applicable
Author

It worked!!!!!! I really appreciate your help!!!!

but how did you find it??

Anonymous
Not applicable
Author

Took a little detective work. Pulled up the chart properties and the Axes tab. Looked for one of the features that only exist for the Dimension Axis, Backcast. Found it in the API guide and found the Font under the IAxisDef class as well.

Not applicable
Author

I got it. That was a little tricky. I've always searching in API guide from "Font" key word.

Anyway, it was such a great help!! Thanks for your kindness!!

Many thanks, again.